[DE] Disable items in the Navigation context menu when editing is disabled

This commit is contained in:
Julia Radzhabova 2018-03-07 13:47:41 +03:00
parent dbe086d14f
commit cd45f0ae06
4 changed files with 19 additions and 4 deletions

View file

@ -557,6 +557,7 @@ define([
app.getController('RightMenu').SetDisabled(disable, false);
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
app.getController('DocumentHolder').getView().SetDisabled(disable);
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
var leftMenu = app.getController('LeftMenu').leftMenu;

View file

@ -900,7 +900,7 @@ define([
leftmenuController.getView('LeftMenu').getMenu('file').loadDocument({doc:me.document});
leftmenuController.setMode(me.appOptions).createDelayedElements().setApi(me.api);
navigationController.setApi(me.api);
navigationController.setApi(me.api).setMode(this.appOptions);
chatController.setApi(this.api).setMode(this.appOptions);
application.getController('Common.Controllers.ExternalDiagramEditor').setApi(this.api).loadConfig({config:this.editorConfig, customization: this.editorConfig.customization});

View file

@ -77,6 +77,7 @@ define([
});
this.panelNavigation.on('render:after', _.bind(this.onAfterRender, this));
this._navigationObject = null;
this._isDisabled = false;
},
setApi: function(api) {
@ -90,6 +91,8 @@ define([
},
setMode: function(mode) {
this.mode = mode;
return this;
},
onAfterRender: function(panelNavigation) {
@ -163,10 +166,16 @@ define([
top = e.clientY*Common.Utils.zoom();
showPoint = [e.clientX*Common.Utils.zoom() + 5, top - parentOffset.top + 5];
for (var i=0; i<7; i++) {
menu.items[i].setVisible(this.mode.isEdit);
}
var isNotHeader = record.get('isNotHeader');
menu.items[0].setDisabled(isNotHeader);
menu.items[1].setDisabled(isNotHeader);
menu.items[3].setDisabled(isNotHeader);
menu.items[0].setDisabled(isNotHeader || this._isDisabled);
menu.items[1].setDisabled(isNotHeader || this._isDisabled);
menu.items[3].setDisabled(isNotHeader || this._isDisabled);
menu.items[4].setDisabled(this._isDisabled);
menu.items[5].setDisabled(this._isDisabled);
menu.items[7].setDisabled(isNotHeader);
if (showPoint != undefined) {
@ -224,6 +233,10 @@ define([
this.panelNavigation.viewNavigationList.expandToLevel(item.value-1);
},
SetDisabled: function(state) {
this._isDisabled = state;
},
txtBeginning: 'Beginning of document',
txtGotoBeginning: 'Go to the beginning of the document'

View file

@ -361,6 +361,7 @@ define([
DE.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
DE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
DE.getController('DocumentHolder').getView().SetDisabled(disable, true);
DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable);
var leftMenu = DE.getController('LeftMenu').leftMenu;
leftMenu.btnComments.setDisabled(disable);