From 0dfd81ec5a10dd30af9e8514020a3826fd1da50a Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Thu, 27 Apr 2017 18:34:19 +0300 Subject: [PATCH] [SSE] removed FileMenu button from 'tools' menu --- .../main/app/controller/LeftMenu.js | 49 +++++++------------ .../main/app/template/LeftMenu.template | 1 - .../main/app/template/Viewport.template | 6 +-- .../main/app/view/FileMenu.js | 4 ++ .../main/app/view/LeftMenu.js | 33 +++---------- 5 files changed, 32 insertions(+), 61 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index b0300bd43b..de855f50b2 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -111,7 +111,6 @@ define([ this.leftMenu.$el.find('button').each(function() { $(this).on('keydown', function (e) { if (Common.UI.Keys.RETURN === e.keyCode || Common.UI.Keys.SPACE === e.keyCode) { - me.leftMenu.btnFile.toggle(false); me.leftMenu.btnAbout.toggle(false); this.blur(); @@ -225,7 +224,6 @@ define([ if (close_menu) { menu.hide(); - this.leftMenu.btnFile.toggle(false, true); } }, @@ -240,14 +238,12 @@ define([ if (btn == 'ok') { this.api.asc_DownloadAs(format); menu.hide(); - this.leftMenu.btnFile.toggle(false, true); } }, this) }); } else { this.api.asc_DownloadAs(format); menu.hide(); - this.leftMenu.btnFile.toggle(false, true); } }, @@ -276,7 +272,6 @@ define([ if (value!==null) this.api.asc_setLocale(parseInt(value)); menu.hide(); - this.leftMenu.btnFile.toggle(false, true); this.leftMenu.fireEvent('settings:apply'); }, @@ -291,14 +286,12 @@ define([ if (menu) { menu.hide(); - this.leftMenu.btnFile.toggle(false, true); } }, onOpenRecent: function(menu, url) { if (menu) { menu.hide(); - this.leftMenu.btnFile.toggle(false, true); } var recentDocPage = window.open(url); @@ -309,15 +302,13 @@ define([ }, clickToolbarSettings: function(obj) { - if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == 'opts') - this.leftMenu.close(); - else - this.leftMenu.showMenu('file:opts'); + this.leftMenu.showMenu('file:opts'); + }, }, /** coauthoring begin **/ clickStatusbarUsers: function() { - this.leftMenu.btnFile.panel.panels['rights'].changeAccessRights(); + this.leftMenu.menuFile.panels['rights'].changeAccessRights(); }, onHideChat: function() { @@ -566,8 +557,6 @@ define([ if (this.api) { this.api.asc_closeCellEditor(); this.api.asc_enableKeyEvents(!state); - - if (!state) $(this.leftMenu.btnFile.el).blur(); } }, @@ -593,12 +582,13 @@ define([ Common.UI.Menu.Manager.hideAll(); this.showSearchDlg(true,s); this.leftMenu.btnSearch.toggle(true,true); - this.leftMenu.btnFile.toggle(false); this.leftMenu.btnAbout.toggle(false); + + this.leftMenu.menuFile.hide(); } return false; case 'save': - if (this.mode.canDownload && !this.leftMenu.btnFile.isDisabled()) { + if ( this.mode.canDownload ) { if (this.mode.isDesktopApp && this.mode.isOffline) { this.api.asc_DownloadAs(); } else { @@ -608,20 +598,22 @@ define([ } return false; case 'help': - if (!this.leftMenu.btnFile.isDisabled()) { - Common.UI.Menu.Manager.hideAll(); - this.api.asc_closeCellEditor(); - this.leftMenu.showMenu('file:help'); - } + Common.UI.Menu.Manager.hideAll(); + this.api.asc_closeCellEditor(); + this.leftMenu.showMenu('file:help'); + return false; case 'file': - if (!this.leftMenu.btnFile.isDisabled()) { - Common.UI.Menu.Manager.hideAll(); - this.leftMenu.showMenu('file'); - } + Common.UI.Menu.Manager.hideAll(); + this.leftMenu.showMenu('file'); + return false; case 'escape': -// if (!this.leftMenu.isOpened()) return true; + if ( this.leftMenu.menuFile.isVisible() ) { + this.leftMenu.menuFile.hide(); + return false; + } + var statusbar = SSE.getController('Statusbar'); var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]'); if (menu_opened.length) { @@ -635,7 +627,7 @@ define([ return false; } } - if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || + if ( this.leftMenu.btnAbout.pressed || ($(e.target).parents('#left-menu').length || this.leftMenu.btnPlugins.pressed || this.leftMenu.btnComments.pressed) && this.api.isCellEdited!==true) { this.leftMenu.close(); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); @@ -670,7 +662,6 @@ define([ onCellsRange: function(status) { var isRangeSelection = (status != Asc.c_oAscSelectionDialogType.None); - this.leftMenu.btnFile.setDisabled(isRangeSelection); this.leftMenu.btnAbout.setDisabled(isRangeSelection); this.leftMenu.btnSearch.setDisabled(isRangeSelection); if (this.mode.canPlugins && this.leftMenu.panelPlugins) { @@ -680,10 +671,8 @@ define([ }, onApiEditCell: function(state) { - var isEditFormula = (state == Asc.c_oAscCellEditorState.editFormula); - this.leftMenu.btnFile.setDisabled(isEditFormula); this.leftMenu.btnAbout.setDisabled(isEditFormula); this.leftMenu.btnSearch.setDisabled(isEditFormula); if (this.mode.canPlugins && this.leftMenu.panelPlugins) { diff --git a/apps/spreadsheeteditor/main/app/template/LeftMenu.template b/apps/spreadsheeteditor/main/app/template/LeftMenu.template index 4ff3ea7200..70f94a475c 100644 --- a/apps/spreadsheeteditor/main/app/template/LeftMenu.template +++ b/apps/spreadsheeteditor/main/app/template/LeftMenu.template @@ -1,6 +1,5 @@
- diff --git a/apps/spreadsheeteditor/main/app/template/Viewport.template b/apps/spreadsheeteditor/main/app/template/Viewport.template index 0b9cc6885e..b6c6b4ce59 100644 --- a/apps/spreadsheeteditor/main/app/template/Viewport.template +++ b/apps/spreadsheeteditor/main/app/template/Viewport.template @@ -1,12 +1,12 @@
- - +
+ +
-
diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index da32afd4cf..187c0e360c 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -289,6 +289,10 @@ define([ this.panels['info'].updateInfo(this.document); }, + isVisible: function () { + return !this.$el.is(':hidden'); + }, + btnSaveCaption : 'Save', btnDownloadCaption : 'Download as...', btnInfoCaption : 'Document Info...', diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index b84e365429..1070aa59ef 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -81,15 +81,6 @@ define([ el.html(this.template({ })); - this.btnFile = new Common.UI.Button({ - action: 'file', - el: $('#left-btn-file', this.el), - hint: this.tipFile + Common.Utils.String.platformKey('Alt+F'), - enableToggle: true, - disabled: true, - toggleGroup: 'leftMenuGroup' - }); - this.btnSearch = new Common.UI.Button({ action: 'search', el: $('#left-btn-search', this.el), @@ -150,10 +141,9 @@ define([ this.btnSearch.on('click', _.bind(this.onBtnMenuClick, this)); this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this)); - this.btnFile.on('toggle', _.bind(this.onBtnMenuToggle, this)); - var menuFile = new SSE.Views.FileMenu({}); - this.btnFile.panel = menuFile.render(); + this.menuFile = new SSE.Views.FileMenu({}); + this.menuFile.render(); this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Spreadsheet Editor'})).render(); return this; @@ -161,15 +151,12 @@ define([ onBtnMenuToggle: function(btn, state) { if (state) { - this.btnFile.pressed && this.fireEvent('file:show', this); - btn.panel['show'](); this.$el.width(SCALE_MIN); if (this.btnSearch.isActive()) this.btnSearch.toggle(false); } else { - (this.btnFile.id == btn.id) && this.fireEvent('file:hide', this); btn.panel['hide'](); } if (this.mode.isEdit) SSE.getController('Toolbar').DisableToolbar(state==true); @@ -177,7 +164,6 @@ define([ }, onBtnMenuClick: function(btn, e) { - this.btnFile.toggle(false); this.btnAbout.toggle(false); if (btn.options.action == 'search') { @@ -248,7 +234,6 @@ define([ /** coauthoring end **/ close: function(menu) { - this.btnFile.toggle(false); this.btnAbout.toggle(false); this.$el.width(SCALE_MIN); /** coauthoring begin **/ @@ -272,7 +257,7 @@ define([ }, isOpened: function() { - var isopened = this.btnFile.pressed || this.btnSearch.pressed; + var isopened = this.btnSearch.pressed; /** coauthoring begin **/ !isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed); /** coauthoring end **/ @@ -280,7 +265,6 @@ define([ }, disableMenu: function(menu, disable) { - this.btnFile.setDisabled(false); this.btnAbout.setDisabled(false); this.btnSupport.setDisabled(false); this.btnSearch.setDisabled(false); @@ -293,13 +277,8 @@ define([ showMenu: function(menu) { var re = /^(\w+):?(\w*)$/.exec(menu); - if (re[1] == 'file' && this.btnFile.isVisible()) { - if (!this.btnFile.pressed) { - this.btnFile.toggle(true); - this.btnFile.$el.focus(); -// this.onBtnMenuClick(this.btnFile); - } - this.btnFile.panel.show(re[2].length ? re[2] : undefined); + if ( re[1] == 'file' ) { + this.menuFile.show(re[2].length ? re[2] : undefined); } else { /** coauthoring begin **/ if (menu == 'chat') { @@ -326,7 +305,7 @@ define([ getMenu: function(type) { switch (type) { - case 'file': return this.btnFile.panel; + case 'file': return this.menuFile; case 'about': return this.btnAbout.panel; default: return null; }