[DE forms] Add interface theme to options menu
This commit is contained in:
parent
034fa5a25b
commit
bd9e655780
|
@ -1063,28 +1063,49 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onThemeClick: function(menu, item) {
|
||||
Common.UI.Themes.setTheme(item.value);
|
||||
},
|
||||
|
||||
onThemeChange: function() {
|
||||
var current = Common.UI.Themes.currentThemeId();
|
||||
_.each(this.view.mnuThemes.items, function(item){
|
||||
item.setChecked(current===item.value, true);
|
||||
});
|
||||
},
|
||||
|
||||
createDelayedElements: function() {
|
||||
var me = this,
|
||||
menuItems = this.view.btnOptions.menu.items,
|
||||
itemsCount = menuItems.length-3;
|
||||
itemsCount = menuItems.length-4;
|
||||
var initMenu = function(menu) {
|
||||
var last;
|
||||
// print
|
||||
if (!menuItems[0].isVisible())
|
||||
menuItems[1].setVisible(false);
|
||||
else
|
||||
last = menuItems[1];
|
||||
|
||||
// download
|
||||
if (!menuItems[2].isVisible() && !menuItems[3].isVisible() && !menuItems[4].isVisible())
|
||||
menuItems[5].setVisible(false);
|
||||
else
|
||||
last = menuItems[5];
|
||||
|
||||
if (!menuItems[6].isVisible() && !menuItems[7].isVisible())
|
||||
menuItems[8].setVisible(false);
|
||||
// theme
|
||||
if (!menuItems[6].isVisible())
|
||||
menuItems[7].setVisible(false);
|
||||
else
|
||||
last = menuItems[8];
|
||||
last = menuItems[7];
|
||||
|
||||
if (!menuItems[9].isVisible() && !menuItems[10].isVisible())
|
||||
// share, location
|
||||
if (!menuItems[8].isVisible() && !menuItems[9].isVisible())
|
||||
menuItems[10].setVisible(false);
|
||||
else
|
||||
last = menuItems[10];
|
||||
|
||||
// embed, fullscreen
|
||||
if (!menuItems[11].isVisible() && !menuItems[12].isVisible())
|
||||
last && last.setVisible(false);
|
||||
|
||||
menu.off('show:after', initMenu);
|
||||
|
@ -1106,23 +1127,43 @@ define([
|
|||
itemsCount -= 2;
|
||||
}
|
||||
|
||||
if ( !this.embedConfig.shareUrl || this.appOptions.canFillForms) {
|
||||
if (Common.UI.Themes.available()) {
|
||||
var current = Common.UI.Themes.currentThemeId();
|
||||
for (var t in Common.UI.Themes.map()) {
|
||||
this.view.mnuThemes.addItem(new Common.UI.MenuItem({
|
||||
caption : Common.UI.Themes.get(t).text,
|
||||
value : t,
|
||||
toggleGroup : 'themes',
|
||||
checkable : true,
|
||||
checked : t===current
|
||||
}));
|
||||
}
|
||||
}
|
||||
if (this.view.mnuThemes.items.length<1) {
|
||||
menuItems[6].setVisible(false);
|
||||
itemsCount--;
|
||||
} else {
|
||||
this.view.mnuThemes.on('item:click', _.bind(this.onThemeClick, this));
|
||||
Common.NotificationCenter.on('uitheme:changed', this.onThemeChange.bind(this));
|
||||
}
|
||||
|
||||
if ( !this.embedConfig.shareUrl || this.appOptions.canFillForms) {
|
||||
menuItems[8].setVisible(false);
|
||||
itemsCount--;
|
||||
}
|
||||
|
||||
if (!this.appOptions.canBackToFolder) {
|
||||
menuItems[7].setVisible(false);
|
||||
itemsCount--;
|
||||
}
|
||||
|
||||
if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) {
|
||||
menuItems[9].setVisible(false);
|
||||
itemsCount--;
|
||||
}
|
||||
|
||||
if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) {
|
||||
menuItems[11].setVisible(false);
|
||||
itemsCount--;
|
||||
}
|
||||
|
||||
if ( !this.embedConfig.fullscreenUrl ) {
|
||||
menuItems[10].setVisible(false);
|
||||
menuItems[12].setVisible(false);
|
||||
itemsCount--;
|
||||
}
|
||||
if (itemsCount<1)
|
||||
|
|
|
@ -23,6 +23,15 @@ define([
|
|||
{caption: this.txtDownloadDocx, value: 'download-docx', iconCls: 'mi-icon svg-icon download'},
|
||||
{caption: this.txtDownloadPdf, value: 'download-pdf', iconCls: 'mi-icon'},
|
||||
{caption: '--'},
|
||||
{caption: this.txtTheme, value: 'theme', iconCls: 'mi-icon',
|
||||
menu : this.mnuThemes = new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
menuAlign: 'tl-tr',
|
||||
restoreHeight: true,
|
||||
items: []
|
||||
})
|
||||
},
|
||||
{caption: '--'},
|
||||
{caption: this.txtShare, value: 'share', iconCls: 'mi-icon svg-icon share'},
|
||||
{caption: this.txtFileLocation, value: 'close', iconCls: 'mi-icon svg-icon go-to-location'},
|
||||
{caption: '--'},
|
||||
|
@ -81,6 +90,7 @@ define([
|
|||
txtDownloadPdf: 'Download as pdf',
|
||||
textNext: 'Next Field',
|
||||
textClear: 'Clear All Fields',
|
||||
textSubmit: 'Submit'
|
||||
textSubmit: 'Submit',
|
||||
txtTheme: 'Interface theme'
|
||||
});
|
||||
});
|
|
@ -57,5 +57,6 @@
|
|||
"DE.ApplicationView.txtShare": "Share",
|
||||
"DE.ApplicationView.textSubmit": "Submit",
|
||||
"DE.ApplicationView.textClear": "Clear All Fields",
|
||||
"DE.ApplicationView.textNext": "Next Field"
|
||||
"DE.ApplicationView.textNext": "Next Field",
|
||||
"DE.ApplicationView.txtTheme": "Interface theme"
|
||||
}
|
Loading…
Reference in a new issue