diff --git a/apps/documenteditor/main/app/controller/Statusbar.js b/apps/documenteditor/main/app/controller/Statusbar.js index e09d34c1a..1beb2a86b 100644 --- a/apps/documenteditor/main/app/controller/Statusbar.js +++ b/apps/documenteditor/main/app/controller/Statusbar.js @@ -175,7 +175,7 @@ define([ this.statusbar.setVisible(!status); Common.localStorage.setBool('de-hidden-status', status); - if ($(view).parent().prop('id') !== 'slot-btn-options') { + if (view.$el.closest('.btn-slot').prop('id') === 'slot-btn-options') { this.statusbar.fireEvent('view:hide', [this, status]); } diff --git a/apps/presentationeditor/main/app/controller/Statusbar.js b/apps/presentationeditor/main/app/controller/Statusbar.js index 87ef9a162..60c55cc43 100644 --- a/apps/presentationeditor/main/app/controller/Statusbar.js +++ b/apps/presentationeditor/main/app/controller/Statusbar.js @@ -227,7 +227,7 @@ define([ this.statusbar.setVisible(!status); Common.localStorage.setBool('pe-hidden-status', status); - if ($(view).parent().prop('id') !== 'slot-btn-options') { + if (view.$el.closest('.btn-slot').prop('id') === 'slot-btn-options') { this.statusbar.fireEvent('view:hide', [this, status]); } diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index aeb0f0679..bb11dd582 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -70,6 +70,9 @@ define([ }, 'Common.Views.Header': { 'statusbar:setcompact': _.bind(this.onChangeViewMode, this) + }, + 'ViewTab': { + 'statusbar:setcompact': _.bind(this.onChangeViewMode, this) } }); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 5d238ee34..c6e2a730e 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -145,6 +145,9 @@ define([ }, 'CellSettings': { 'cf:init': this.onShowBeforeCondFormat + }, + 'ViewTab': { + 'viewtab:showtoolbar': this.onChangeViewMode.bind(this) } }); Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this)); diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 8aeffa90a..d2c6886bf 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -79,7 +79,8 @@ define([ this.toolbar = config.toolbar; this.view = this.createView('ViewTab', { toolbar: this.toolbar.toolbar, - mode: config.mode + mode: config.mode, + compactToolbar: this.toolbar.toolbar.isCompactView }); this.addListeners({ 'ViewTab': { @@ -95,7 +96,15 @@ define([ 'viewtab:manager': this.onOpenManager }, 'Statusbar': { - 'sheet:changed': this.onApiSheetChanged.bind(this) + 'sheet:changed': this.onApiSheetChanged.bind(this), + 'view:compact': _.bind(function (statusbar, state) { + this.view.chStatusbar.setValue(state, true); + }, this) + }, + 'Toolbar': { + 'view:compact': _.bind(function (toolbar, state) { + this.view.chToolbar.setValue(!state, true); + }, this) } }); Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this)); diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index 8ed8aaba5..ead56e3eb 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -75,6 +75,12 @@ define([ this.cmbZoom.on('selected', function(combo, record) { me.fireEvent('viewtab:zoom', [record.value]); }); + this.chToolbar.on('change', function (field, value) { + me.fireEvent('viewtab:showtoolbar', [field, value !== 'checked']); + }); + this.chStatusbar.on('change', function (field, value) { + me.fireEvent('statusbar:setcompact', [field, value === 'checked']); + }); } return { @@ -225,7 +231,7 @@ define([ this.chStatusbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-statusbar'), labelText: this.textCombineSheetAndStatusBars, - value : true, + value : Common.localStorage.getBool('sse-compact-statusbar', true), lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell], dataHint : '1', dataHintDirection: 'left', @@ -236,7 +242,7 @@ define([ this.chToolbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-toolbar'), labelText: this.textAlwaysShowToolbar, - value : true, + value : !options.compactToolbar, lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell], dataHint : '1', dataHintDirection: 'left',