[DE] Use config.customization.layout for menu File
This commit is contained in:
parent
d9f719f870
commit
7e850a9ac0
|
@ -1,6 +1,6 @@
|
|||
<div class="panel-menu">
|
||||
<li class="fm-first-item"></li>
|
||||
<li id="fm-btn-return" class="fm-btn"></li>
|
||||
<li id="fm-btn-return" class="fm-btn" data-layout-name="toolbar-file-close"></li>
|
||||
<li class="devider"></li>
|
||||
<li id="fm-btn-save" class="fm-btn"></li>
|
||||
<li id="fm-btn-edit" class="fm-btn"></li>
|
||||
|
@ -14,11 +14,11 @@
|
|||
<li id="fm-btn-recent" class="fm-btn"></li>
|
||||
<li id="fm-btn-create" class="fm-btn"></li>
|
||||
<li class="devider"></li>
|
||||
<li id="fm-btn-info" class="fm-btn"></li>
|
||||
<li id="fm-btn-info" class="fm-btn" data-layout-name="toolbar-file-info"></li>
|
||||
<li id="fm-btn-rights" class="fm-btn"></li>
|
||||
<li id="fm-btn-history" class="fm-btn"></li>
|
||||
<li class="devider" class="fm-btn"></li>
|
||||
<li id="fm-btn-settings" class="fm-btn"></li>
|
||||
<li id="fm-btn-settings" class="fm-btn" data-layout-name="toolbar-file-settings"></li>
|
||||
<li class="devider"></li>
|
||||
<li id="fm-btn-help" class="fm-btn"></li>
|
||||
<li class="devider"></li>
|
||||
|
|
|
@ -84,6 +84,16 @@ define([
|
|||
render: function () {
|
||||
var $markup = $(this.template());
|
||||
|
||||
this.miClose = new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-return'),
|
||||
action : 'back',
|
||||
caption : this.btnCloseMenuCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
});
|
||||
|
||||
this.miSave = new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-save'),
|
||||
action : 'save',
|
||||
|
@ -199,6 +209,16 @@ define([
|
|||
dataHintOffset: [2, 14]
|
||||
});
|
||||
|
||||
this.miInfo = new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-info'),
|
||||
action : 'info',
|
||||
caption : this.btnInfoCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
});
|
||||
|
||||
this.miAccess = new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-rights'),
|
||||
action : 'rights',
|
||||
|
@ -223,6 +243,16 @@ define([
|
|||
delete this.options.miHistory;
|
||||
}
|
||||
|
||||
this.miSettings = new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-settings'),
|
||||
action : 'opts',
|
||||
caption : this.btnSettingsCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
});
|
||||
|
||||
this.miHelp = new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-help'),
|
||||
action : 'help',
|
||||
|
@ -233,17 +263,19 @@ define([
|
|||
dataHintOffset: [2, 14]
|
||||
});
|
||||
|
||||
this.miBack = new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-back'),
|
||||
action : 'exit',
|
||||
caption : this.btnBackCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
});
|
||||
|
||||
this.items = [];
|
||||
this.items.push(
|
||||
new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-return'),
|
||||
action : 'back',
|
||||
caption : this.btnCloseMenuCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
}),
|
||||
this.miClose,
|
||||
this.miSave,
|
||||
this.miEdit,
|
||||
this.miDownload,
|
||||
|
@ -254,37 +286,12 @@ define([
|
|||
this.miProtect,
|
||||
this.miRecent,
|
||||
this.miNew,
|
||||
new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-info'),
|
||||
action : 'info',
|
||||
caption : this.btnInfoCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
}),
|
||||
this.miInfo,
|
||||
this.miAccess,
|
||||
this.miHistory,
|
||||
new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-settings'),
|
||||
action : 'opts',
|
||||
caption : this.btnSettingsCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
}),
|
||||
this.miSettings,
|
||||
this.miHelp,
|
||||
new Common.UI.MenuItem({
|
||||
el : $markup.elementById('#fm-btn-back'),
|
||||
// el : _get_el('fm-btn-back'),
|
||||
action : 'exit',
|
||||
caption : this.btnBackCaption,
|
||||
canFocused: false,
|
||||
dataHint: 1,
|
||||
dataHintDirection: 'left-top',
|
||||
dataHintOffset: [2, 14]
|
||||
})
|
||||
this.miBack
|
||||
);
|
||||
|
||||
this.rendered = true;
|
||||
|
@ -350,6 +357,14 @@ define([
|
|||
|
||||
if (!this.mode) return;
|
||||
|
||||
var lastSeparator,
|
||||
separatorVisible = false;
|
||||
|
||||
var isVisible = Common.UI.LayoutManager.isElementVisible('toolbar-file-close');
|
||||
this.miClose[isVisible?'show':'hide']();
|
||||
this.miClose.$el.find('+.devider')[isVisible?'show':'hide']();
|
||||
isVisible && (lastSeparator = this.miClose.$el.find('+.devider'));
|
||||
|
||||
this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||
var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false;
|
||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide']();
|
||||
|
@ -359,22 +374,45 @@ define([
|
|||
this.miPrint[this.mode.canPrint?'show':'hide']();
|
||||
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
|
||||
this.miProtect[this.mode.canProtect ?'show':'hide']();
|
||||
var isVisible = this.mode.canDownload || this.mode.canDownloadOrigin || this.mode.isEdit || this.mode.canPrint || this.mode.canProtect ||
|
||||
!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights || this.mode.canRename && !this.mode.isDesktopApp;
|
||||
this.miProtect.$el.find('+.devider')[isVisible && !this.mode.isDisconnected?'show':'hide']();
|
||||
separatorVisible = (this.mode.canDownload || this.mode.canDownloadOrigin || this.mode.isEdit || this.mode.canPrint || this.mode.canProtect ||
|
||||
!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights || this.mode.canRename && !this.mode.isDesktopApp) && !this.mode.isDisconnected;
|
||||
this.miProtect.$el.find('+.devider')[separatorVisible?'show':'hide']();
|
||||
separatorVisible && (lastSeparator = this.miProtect.$el.find('+.devider'));
|
||||
|
||||
this.miRecent[this.mode.canOpenRecent?'show':'hide']();
|
||||
this.miNew[this.mode.canCreateNew?'show':'hide']();
|
||||
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
|
||||
separatorVisible = this.mode.canCreateNew;
|
||||
this.miNew.$el.find('+.devider')[separatorVisible?'show':'hide']();
|
||||
separatorVisible && (lastSeparator = this.miNew.$el.find('+.devider'));
|
||||
|
||||
this.miAccess[(!this.mode.isOffline && this.document&&this.document.info &&
|
||||
(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
|
||||
(this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings)))?'show':'hide']();
|
||||
isVisible = Common.UI.LayoutManager.isElementVisible('toolbar-file-info');
|
||||
separatorVisible = isVisible;
|
||||
this.miInfo[isVisible?'show':'hide']();
|
||||
isVisible = !this.mode.isOffline && this.document&&this.document.info &&
|
||||
(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 ||
|
||||
(this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings));
|
||||
separatorVisible = separatorVisible || isVisible;
|
||||
this.miAccess[isVisible?'show':'hide']();
|
||||
isVisible = this.mode.canUseHistory&&!this.mode.isDisconnected;
|
||||
separatorVisible = separatorVisible || isVisible;
|
||||
this.miHistory[isVisible?'show':'hide']();
|
||||
this.miHistory.$el.find('+.devider')[separatorVisible?'show':'hide']();
|
||||
separatorVisible && (lastSeparator = this.miHistory.$el.find('+.devider'));
|
||||
|
||||
this.miHelp[this.mode.canHelp ?'show':'hide']();
|
||||
this.miHelp.$el.prev()[this.mode.canHelp ?'show':'hide']();
|
||||
isVisible = Common.UI.LayoutManager.isElementVisible('toolbar-file-settings');
|
||||
this.miSettings[isVisible?'show':'hide']();
|
||||
this.miSettings.$el.find('+.devider')[isVisible?'show':'hide']();
|
||||
isVisible && (lastSeparator = this.miSettings.$el.find('+.devider'));
|
||||
|
||||
isVisible = this.mode.canHelp;
|
||||
this.miHelp[isVisible ?'show':'hide']();
|
||||
this.miHelp.$el.find('+.devider')[isVisible?'show':'hide']();
|
||||
isVisible && (lastSeparator = this.miHelp.$el.find('+.devider'));
|
||||
|
||||
isVisible = this.mode.canBack;
|
||||
this.miBack[isVisible ?'show':'hide']();
|
||||
lastSeparator && !isVisible && lastSeparator.hide();
|
||||
|
||||
this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() :
|
||||
this.$el.find('#fm-btn-back').hide().prev().hide();
|
||||
if (!this.customizationDone) {
|
||||
this.customizationDone = true;
|
||||
Common.Utils.applyCustomization(this.mode.customization, {goback: '#fm-btn-back > a'});
|
||||
|
@ -415,8 +453,6 @@ define([
|
|||
this.panels['help'] = ((new DE.Views.FileMenuPanels.Help({menu: this})).render());
|
||||
this.panels['help'].setLangConfig(this.mode.lang);
|
||||
}
|
||||
|
||||
this.miHistory[this.mode.canUseHistory&&!this.mode.isDisconnected?'show':'hide']();
|
||||
},
|
||||
|
||||
setMode: function(mode, delay) {
|
||||
|
|
Loading…
Reference in a new issue