[SSE] removed FileMenu button from 'tools' menu

This commit is contained in:
Maxim Kadushkin 2017-04-27 18:34:19 +03:00
parent a80342235d
commit 0dfd81ec5a
5 changed files with 32 additions and 61 deletions

View file

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

View file

@ -1,6 +1,5 @@
<div id="view-left-menu" class="tool-menu left">
<div class="tool-menu-btns">
<button id="left-btn-file" class="btn btn-category" content-target="left-panel-file"><span class="btn-icon img-toolbarmenu btn-menu-file">&nbsp;</span></button>
<button id="left-btn-search" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-search">&nbsp;</i></button>
<!-- /** coauthoring begin **/ -->
<button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><i class="icon img-toolbarmenu btn-menu-comments">&nbsp;</i></button>

View file

@ -1,12 +1,12 @@
<div class="layout-region">
<div id="viewport-vbox-layout" class="layout-ct vbox">
<div id="header" class="layout-item"></div>
<div class="layout-item" style="border-bottom: 1px solid #cbcbcb;display:none;"></div>
<section class="layout-ct">
<div id="file-menu-panel" class="toolbar-fullview-panel" style="display:none;"></div>
</section>
<div id="toolbar" class="layout-item"></div>
<div class="layout-item">
<div id="viewport-hbox-layout" class="layout-ct hbox">
<div id="left-menu" class="layout-item" style="width: 40px;"></div>
<div id="file-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div class="layout-item">
<div class="layout-ct vbox">

View file

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

View file

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