[SSE] Add handlers for show toolbar, combine statusbar buttons in view tab

This commit is contained in:
JuliaSvinareva 2021-12-12 17:49:49 +03:00
parent 0e75d15d57
commit b68e5b68f5
6 changed files with 27 additions and 6 deletions

View file

@ -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]);
}

View file

@ -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]);
}

View file

@ -70,6 +70,9 @@ define([
},
'Common.Views.Header': {
'statusbar:setcompact': _.bind(this.onChangeViewMode, this)
},
'ViewTab': {
'statusbar:setcompact': _.bind(this.onChangeViewMode, this)
}
});
},

View file

@ -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));

View file

@ -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));

View file

@ -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',