[DE] show FileMenu from the toolbar
This commit is contained in:
parent
62587692c6
commit
b0935bca7a
|
@ -82,7 +82,9 @@ define([
|
|||
'recent:open': _.bind(this.onOpenRecent, this)
|
||||
},
|
||||
'Toolbar': {
|
||||
'file:settings': _.bind(this.clickToolbarSettings,this)
|
||||
'file:settings': _.bind(this.clickToolbarSettings,this),
|
||||
'file:open': this.clickToolbarTab.bind(this, 'file'),
|
||||
'file:close': this.clickToolbarTab.bind(this, 'other')
|
||||
},
|
||||
'SearchDialog': {
|
||||
'hide': _.bind(this.onSearchDlgHide, this),
|
||||
|
@ -249,7 +251,7 @@ define([
|
|||
|
||||
if (close_menu) {
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -265,14 +267,14 @@ define([
|
|||
if (btn == 'ok') {
|
||||
this.api.asc_DownloadAs(format);
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
} else {
|
||||
this.api.asc_DownloadAs(format);
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
}
|
||||
} else
|
||||
this.api.asc_DownloadOrigin();
|
||||
|
@ -319,7 +321,7 @@ define([
|
|||
this.api.put_ShowSnapLines(value===null || parseInt(value) == 1);
|
||||
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
},
|
||||
|
||||
onCreateNew: function(menu, type) {
|
||||
|
@ -332,14 +334,14 @@ define([
|
|||
|
||||
if (menu) {
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
}
|
||||
},
|
||||
|
||||
onOpenRecent: function(menu, url) {
|
||||
if (menu) {
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
}
|
||||
|
||||
var recentDocPage = window.open(url);
|
||||
|
@ -350,15 +352,18 @@ define([
|
|||
},
|
||||
|
||||
clickToolbarSettings: function(obj) {
|
||||
if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == 'opts')
|
||||
this.leftMenu.showMenu('file:opts');
|
||||
},
|
||||
|
||||
clickToolbarTab: function (tab, e) {
|
||||
if (tab == 'file')
|
||||
this.leftMenu.showMenu('file'); else
|
||||
this.leftMenu.close();
|
||||
else
|
||||
this.leftMenu.showMenu('file:opts');
|
||||
},
|
||||
|
||||
/** coauthoring begin **/
|
||||
clickStatusbarUsers: function() {
|
||||
this.leftMenu.btnFile.panel.panels['rights'].changeAccessRights();
|
||||
this.leftMenu.menuFile.panels['rights'].changeAccessRights();
|
||||
},
|
||||
|
||||
onHideChat: function() {
|
||||
|
@ -514,7 +519,7 @@ define([
|
|||
},
|
||||
|
||||
menuFilesHide: function(obj) {
|
||||
$(this.leftMenu.btnFile.el).blur();
|
||||
// $(this.leftMenu.btnFile.el).blur();
|
||||
},
|
||||
|
||||
onMenuChange: function (value) {
|
||||
|
@ -536,8 +541,8 @@ 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.mode.canDownloadOrigin) {
|
||||
|
@ -574,7 +579,7 @@ define([
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
|
||||
if (this.leftMenu.menuFile.isVisible() || this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
|
||||
$(e.target).parents('#left-menu').length ) {
|
||||
this.leftMenu.close();
|
||||
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
|
||||
|
|
|
@ -1419,6 +1419,7 @@ define([
|
|||
},
|
||||
|
||||
onAdvSettingsClick: function(btn, e) {
|
||||
this.toolbar.setTab('file');
|
||||
this.toolbar.fireEvent('file:settings', this);
|
||||
btn.cmpEl.blur();
|
||||
},
|
||||
|
|
|
@ -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"> </span></button>
|
||||
<button id="left-btn-search" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-search"> </span></button>
|
||||
<!-- /** coauthoring begin **/ -->
|
||||
<button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><span class="btn-icon img-toolbarmenu btn-menu-comments"> </span></button>
|
||||
|
|
|
@ -49,6 +49,7 @@ define([
|
|||
|
||||
DE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({
|
||||
el: '#file-menu-panel',
|
||||
options: {alias:'FileMenu'},
|
||||
|
||||
template: _.template(tpl),
|
||||
|
||||
|
@ -198,7 +199,6 @@ define([
|
|||
panel = this.active || ((this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info');
|
||||
this.$el.show();
|
||||
this.selectMenu(panel, opts);
|
||||
if (this.mode.isEdit) DE.getController('Toolbar').DisableToolbar(true);
|
||||
this.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
|
||||
|
@ -313,6 +313,10 @@ define([
|
|||
this.items[6][(disable || !this.mode.canRename || this.mode.isDesktopApp) ?'hide':'show']();
|
||||
},
|
||||
|
||||
isVisible: function () {
|
||||
return !this.$el.is(':hidden');
|
||||
},
|
||||
|
||||
btnSaveCaption : 'Save',
|
||||
btnDownloadCaption : 'Download as...',
|
||||
btnInfoCaption : 'Document Info...',
|
||||
|
|
|
@ -91,15 +91,6 @@ define([
|
|||
el.html(this.template({
|
||||
}));
|
||||
|
||||
this.btnFile = new Common.UI.Button({
|
||||
action: 'file',
|
||||
el: $('#left-btn-file'),
|
||||
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'),
|
||||
|
@ -160,11 +151,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 DE.Views.FileMenu({});
|
||||
menuFile.options = {alias:'FileMenu'};
|
||||
this.btnFile.panel = menuFile.render();
|
||||
this.menuFile = new DE.Views.FileMenu();
|
||||
this.menuFile.render();
|
||||
this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Document Editor'})).render();
|
||||
|
||||
return this;
|
||||
|
@ -187,9 +176,13 @@ define([
|
|||
|
||||
onBtnMenuClick: function(btn, e) {
|
||||
this.supressEvents = true;
|
||||
this.btnFile.toggle(false);
|
||||
this.btnAbout.toggle(false);
|
||||
|
||||
if ( this.menuFile.isVisible() ) {
|
||||
this.menuFile.hide();
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
}
|
||||
|
||||
if (btn.options.action == 'search') {
|
||||
} else {
|
||||
if (btn.pressed) {
|
||||
|
@ -264,31 +257,36 @@ define([
|
|||
/** coauthoring end **/
|
||||
|
||||
close: function(menu) {
|
||||
this.btnFile.toggle(false);
|
||||
this.btnAbout.toggle(false);
|
||||
this.$el.width(SCALE_MIN);
|
||||
/** coauthoring begin **/
|
||||
if (this.mode.canCoAuthoring) {
|
||||
if (this.mode.canComments) {
|
||||
this.panelComments['hide']();
|
||||
if (this.btnComments.pressed)
|
||||
this.fireEvent('comments:hide', this);
|
||||
this.btnComments.toggle(false, true);
|
||||
if ( this.menuFile.$el.is(':visible') ) {
|
||||
this.menuFile.hide();
|
||||
Common.NotificationCenter.trigger('layout:changed', 'menufile');
|
||||
} else {
|
||||
|
||||
this.btnAbout.toggle(false);
|
||||
this.$el.width(SCALE_MIN);
|
||||
/** coauthoring begin **/
|
||||
if (this.mode.canCoAuthoring) {
|
||||
if (this.mode.canComments) {
|
||||
this.panelComments['hide']();
|
||||
if (this.btnComments.pressed)
|
||||
this.fireEvent('comments:hide', this);
|
||||
this.btnComments.toggle(false, true);
|
||||
}
|
||||
if (this.mode.canChat) {
|
||||
this.panelChat['hide']();
|
||||
this.btnChat.toggle(false, true);
|
||||
}
|
||||
}
|
||||
if (this.mode.canChat) {
|
||||
this.panelChat['hide']();
|
||||
this.btnChat.toggle(false, true);
|
||||
/** coauthoring end **/
|
||||
if (this.mode.canPlugins && this.panelPlugins) {
|
||||
this.panelPlugins['hide']();
|
||||
this.btnPlugins.toggle(false, true);
|
||||
}
|
||||
}
|
||||
/** coauthoring end **/
|
||||
if (this.mode.canPlugins && this.panelPlugins) {
|
||||
this.panelPlugins['hide']();
|
||||
this.btnPlugins.toggle(false, true);
|
||||
}
|
||||
},
|
||||
|
||||
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 **/
|
||||
|
@ -296,7 +294,6 @@ define([
|
|||
},
|
||||
|
||||
disableMenu: function(menu, disable) {
|
||||
this.btnFile.setDisabled(false);
|
||||
this.btnSearch.setDisabled(false);
|
||||
this.btnAbout.setDisabled(false);
|
||||
this.btnSupport.setDisabled(false);
|
||||
|
@ -309,12 +306,11 @@ define([
|
|||
|
||||
showMenu: function(menu, opts) {
|
||||
var re = /^(\w+):?(\w*)$/.exec(menu);
|
||||
if (re[1] == 'file' && this.btnFile.isVisible() ) {
|
||||
if (!this.btnFile.pressed) {
|
||||
this.btnFile.toggle(true);
|
||||
// this.onBtnMenuClick(this.btnFile);
|
||||
if ( re[1] == 'file' ) {
|
||||
if ( !this.menuFile.isVisible() ) {
|
||||
// this.btnFile.toggle(true);
|
||||
}
|
||||
this.btnFile.panel.show(re[2].length ? re[2] : undefined, opts);
|
||||
this.menuFile.show(re[2].length ? re[2] : undefined, opts);
|
||||
} else {
|
||||
/** coauthoring begin **/
|
||||
if (menu == 'chat') {
|
||||
|
@ -341,7 +337,7 @@ define([
|
|||
getMenu: function(type) {
|
||||
switch (type) {
|
||||
default: return null;
|
||||
case 'file': return this.btnFile.panel;
|
||||
case 'file': return this.menuFile;
|
||||
case 'about': return this.btnAbout.panel;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -64,6 +64,10 @@ button.notify .btn-menu-comments {background-position: -0*@toolbar-icon-size -60
|
|||
}
|
||||
|
||||
#file-menu-panel {
|
||||
height: calc(~"100% + @{height-controls}");
|
||||
top: -@height-controls;
|
||||
box-shadow: -1px 0 0 0 @gray-dark;
|
||||
|
||||
> div {
|
||||
height: 100%;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue