diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index d312959c5..adaa0b7a9 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -45,14 +45,16 @@ define([ 'common/main/lib/util/Shortcuts', 'common/main/lib/view/SaveAsDlg', 'documenteditor/main/app/view/LeftMenu', - 'documenteditor/main/app/view/FileMenu' + 'documenteditor/main/app/view/FileMenu', + 'documenteditor/main/app/view/ViewTab', ], function () { 'use strict'; DE.Controllers.LeftMenu = Backbone.Controller.extend(_.extend({ views: [ 'LeftMenu', - 'FileMenu' + 'FileMenu', + 'ViewTab' ], initialize: function() { @@ -106,6 +108,9 @@ define([ }, 'Common.Views.ReviewChanges': { 'collaboration:chat': _.bind(this.onShowHideChat, this) + }, + 'ViewTab': { + 'viewtab:navigation': _.bind(this.onShowHideNavigation, this) } }); @@ -914,6 +919,16 @@ define([ } }, + onShowHideNavigation: function(state) { + if (state) { + Common.UI.Menu.Manager.hideAll(); + this.leftMenu.showMenu('navigation'); + } else { + this.leftMenu.btnNavigation.toggle(false, true); + this.leftMenu.onBtnMenuClick(this.leftMenu.btnNavigation); + } + }, + isCommentsVisible: function() { return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible(); }, diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 887118a8c..38864b0f0 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -58,6 +58,7 @@ define([ }, onLaunch: function () { this._state = {}; + Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, setApi: function (api) { @@ -97,5 +98,20 @@ define([ this.SetDisabled(true); }, + onAppReady: function (config) { + var me = this; + (new Promise(function (accept, reject) { + accept(); + })).then(function(){ + me.view.setEvents(); + }); + if (me.view.btnNavigation) { + me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function(btn, state){ + if (state !== me.view.btnNavigation.pressed) + me.view.turnNavigation(state); + }); + } + }, + }, DE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index f222b4403..69ef3d49f 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -378,6 +378,13 @@ define([ this.onBtnMenuClick(this.btnComments); this.onCoauthOptions(); } + } else if (menu == 'navigation') { + if (this.btnNavigation.isVisible() && + !this.btnNavigation.isDisabled() && !this.btnNavigation.pressed) { + this.btnNavigation.toggle(true); + this.onBtnMenuClick(this.btnNavigation); + this.onCoauthOptions(); + } } /** coauthoring end **/ } diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index 5a00b2c14..cc94834b5 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -46,13 +46,16 @@ define([ 'use strict'; DE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ - function setEvents() { - var me = this; - } - return { options: {}, + setEvents() { + var me = this; + me.btnNavigation && me.btnNavigation.on('click', function (btn, e) { + me.fireEvent('viewtab:navigation', [btn.pressed]); + }); + }, + initialize: function (options) { Common.UI.BaseView.prototype.initialize.call(this); this.toolbar = options.toolbar; @@ -68,6 +71,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-navigation', caption: this.textNavigation, + enableToggle: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -190,6 +194,10 @@ define([ }, this); }, + turnNavigation: function (state) { + this.btnNavigation && this.btnNavigation.toggle(state, true); + }, + textNavigation: 'Navigation', textZoom: 'Zoom', textFitToPage: 'Fit To Page',