[PE] Add handlers to show toolbar, statusbar buttons in view tab
This commit is contained in:
parent
d4b08a16ed
commit
55cd0c22e5
|
@ -62,13 +62,10 @@ define([
|
|||
'langchanged': this.onLangMenu
|
||||
},
|
||||
'Common.Views.Header': {
|
||||
'statusbar:hide': function (view, status) {
|
||||
me.statusbar.setVisible(!status);
|
||||
Common.localStorage.setBool('pe-hidden-status', status);
|
||||
|
||||
Common.NotificationCenter.trigger('layout:changed', 'status');
|
||||
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
|
||||
}
|
||||
'statusbar:hide': _.bind(me.onChangeCompactView, me)
|
||||
},
|
||||
'ViewTab': {
|
||||
'statusbar:hide': _.bind(me.onChangeCompactView, me)
|
||||
}
|
||||
});
|
||||
this._state = {
|
||||
|
@ -226,6 +223,18 @@ define([
|
|||
this.api.put_TextPrLang(langid);
|
||||
},
|
||||
|
||||
onChangeCompactView: function (view, status) {
|
||||
this.statusbar.setVisible(!status);
|
||||
Common.localStorage.setBool('pe-hidden-status', status);
|
||||
|
||||
if ($(view).parent().prop('id') !== 'slot-btn-options') {
|
||||
this.statusbar.fireEvent('view:hide', [this, status]);
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('layout:changed', 'status');
|
||||
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
|
||||
},
|
||||
|
||||
zoomText : 'Zoom {0}%'
|
||||
}, PE.Controllers.Statusbar || {}));
|
||||
});
|
|
@ -177,6 +177,9 @@ define([
|
|||
'go:editor': function() {
|
||||
Common.Gateway.requestEditRights();
|
||||
}
|
||||
},
|
||||
'ViewTab': {
|
||||
'toolbar:setcompact': this.onChangeCompactView.bind(this)
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -76,7 +76,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': {
|
||||
|
@ -84,9 +85,16 @@ define([
|
|||
'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'),
|
||||
'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth')
|
||||
},
|
||||
'Toolbar': {
|
||||
'view:compact': _.bind(function (toolbar, state) {
|
||||
this.view.chToolbar.setValue(!state, true);
|
||||
}, this)
|
||||
},
|
||||
'Statusbar': {
|
||||
|
||||
}
|
||||
'view:hide': _.bind(function (statusbar, state) {
|
||||
this.view.chStatusbar.setValue(!state, true);
|
||||
}, this)
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -111,6 +111,11 @@ define([
|
|||
// Events generated by main view
|
||||
'Viewport': {
|
||||
|
||||
},
|
||||
'ViewTab': {
|
||||
'statusbar:hide': function (view, state) {
|
||||
me.header.mnuitemHideStatusBar.setChecked(state, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
Common.NotificationCenter.on('preview:start', this.onPreviewStart.bind(this));
|
||||
|
@ -237,7 +242,7 @@ define([
|
|||
}, this));
|
||||
}
|
||||
|
||||
var mnuitemHideStatusBar = new Common.UI.MenuItem({
|
||||
me.header.mnuitemHideStatusBar = new Common.UI.MenuItem({
|
||||
caption: me.header.textHideStatusBar,
|
||||
checked: Common.localStorage.getBool("pe-hidden-status"),
|
||||
checkable: true,
|
||||
|
@ -245,7 +250,7 @@ define([
|
|||
});
|
||||
|
||||
if ( config.canBrandingExt && config.customization && config.customization.statusBar === false )
|
||||
mnuitemHideStatusBar.hide();
|
||||
me.header.mnuitemHideStatusBar.hide();
|
||||
|
||||
var mnuitemHideRulers = new Common.UI.MenuItem({
|
||||
caption: me.header.textHideLines,
|
||||
|
@ -298,7 +303,7 @@ define([
|
|||
style: 'min-width: 180px;',
|
||||
items: [
|
||||
me.header.mnuitemCompactToolbar,
|
||||
mnuitemHideStatusBar,
|
||||
me.header.mnuitemHideStatusBar,
|
||||
mnuitemHideRulers,
|
||||
me.header.mnuitemHideNotes,
|
||||
{caption:'--'},
|
||||
|
|
|
@ -60,6 +60,12 @@ define([
|
|||
me.btnFitToWidth && me.btnFitToWidth.on('click', function () {
|
||||
me.fireEvent('zoom:towidth', [me.btnFitToWidth]);
|
||||
});
|
||||
me.chToolbar && me.chToolbar.on('change', _.bind(function(checkbox, state) {
|
||||
me.fireEvent('toolbar:setcompact', [me.chToolbar, state !== 'checked']);
|
||||
}, me));
|
||||
me.chStatusbar && me.chStatusbar.on('change', _.bind(function (checkbox, state) {
|
||||
me.fireEvent('statusbar:hide', [me.chStatusbar, state !== 'checked']);
|
||||
}, me));
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
|
@ -138,7 +144,7 @@ define([
|
|||
this.chStatusbar = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-statusbar'),
|
||||
labelText: this.textStatusBar,
|
||||
value: true, //!Common.localStorage.getBool(''),
|
||||
value: !Common.localStorage.getBool("pe-hidden-status"),
|
||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'left',
|
||||
|
@ -149,7 +155,7 @@ define([
|
|||
this.chToolbar = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-toolbar'),
|
||||
labelText: this.textAlwaysShowToolbar,
|
||||
value: true, //!Common.localStorage.getBool(''),
|
||||
value: !options.compactToolbar,
|
||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'left',
|
||||
|
|
Loading…
Reference in a new issue