[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() {
|
createDelayedElements: function() {
|
||||||
var me = this,
|
var me = this,
|
||||||
menuItems = this.view.btnOptions.menu.items,
|
menuItems = this.view.btnOptions.menu.items,
|
||||||
itemsCount = menuItems.length-3;
|
itemsCount = menuItems.length-4;
|
||||||
var initMenu = function(menu) {
|
var initMenu = function(menu) {
|
||||||
var last;
|
var last;
|
||||||
|
// print
|
||||||
if (!menuItems[0].isVisible())
|
if (!menuItems[0].isVisible())
|
||||||
menuItems[1].setVisible(false);
|
menuItems[1].setVisible(false);
|
||||||
else
|
else
|
||||||
last = menuItems[1];
|
last = menuItems[1];
|
||||||
|
|
||||||
|
// download
|
||||||
if (!menuItems[2].isVisible() && !menuItems[3].isVisible() && !menuItems[4].isVisible())
|
if (!menuItems[2].isVisible() && !menuItems[3].isVisible() && !menuItems[4].isVisible())
|
||||||
menuItems[5].setVisible(false);
|
menuItems[5].setVisible(false);
|
||||||
else
|
else
|
||||||
last = menuItems[5];
|
last = menuItems[5];
|
||||||
|
|
||||||
if (!menuItems[6].isVisible() && !menuItems[7].isVisible())
|
// theme
|
||||||
menuItems[8].setVisible(false);
|
if (!menuItems[6].isVisible())
|
||||||
|
menuItems[7].setVisible(false);
|
||||||
else
|
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);
|
last && last.setVisible(false);
|
||||||
|
|
||||||
menu.off('show:after', initMenu);
|
menu.off('show:after', initMenu);
|
||||||
|
@ -1106,23 +1127,43 @@ define([
|
||||||
itemsCount -= 2;
|
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);
|
menuItems[6].setVisible(false);
|
||||||
itemsCount--;
|
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) {
|
if (!this.appOptions.canBackToFolder) {
|
||||||
menuItems[7].setVisible(false);
|
|
||||||
itemsCount--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) {
|
|
||||||
menuItems[9].setVisible(false);
|
menuItems[9].setVisible(false);
|
||||||
itemsCount--;
|
itemsCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) {
|
||||||
|
menuItems[11].setVisible(false);
|
||||||
|
itemsCount--;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !this.embedConfig.fullscreenUrl ) {
|
if ( !this.embedConfig.fullscreenUrl ) {
|
||||||
menuItems[10].setVisible(false);
|
menuItems[12].setVisible(false);
|
||||||
itemsCount--;
|
itemsCount--;
|
||||||
}
|
}
|
||||||
if (itemsCount<1)
|
if (itemsCount<1)
|
||||||
|
|
|
@ -23,6 +23,15 @@ define([
|
||||||
{caption: this.txtDownloadDocx, value: 'download-docx', iconCls: 'mi-icon svg-icon download'},
|
{caption: this.txtDownloadDocx, value: 'download-docx', iconCls: 'mi-icon svg-icon download'},
|
||||||
{caption: this.txtDownloadPdf, value: 'download-pdf', iconCls: 'mi-icon'},
|
{caption: this.txtDownloadPdf, value: 'download-pdf', iconCls: 'mi-icon'},
|
||||||
{caption: '--'},
|
{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.txtShare, value: 'share', iconCls: 'mi-icon svg-icon share'},
|
||||||
{caption: this.txtFileLocation, value: 'close', iconCls: 'mi-icon svg-icon go-to-location'},
|
{caption: this.txtFileLocation, value: 'close', iconCls: 'mi-icon svg-icon go-to-location'},
|
||||||
{caption: '--'},
|
{caption: '--'},
|
||||||
|
@ -81,6 +90,7 @@ define([
|
||||||
txtDownloadPdf: 'Download as pdf',
|
txtDownloadPdf: 'Download as pdf',
|
||||||
textNext: 'Next Field',
|
textNext: 'Next Field',
|
||||||
textClear: 'Clear All Fields',
|
textClear: 'Clear All Fields',
|
||||||
textSubmit: 'Submit'
|
textSubmit: 'Submit',
|
||||||
|
txtTheme: 'Interface theme'
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -57,5 +57,6 @@
|
||||||
"DE.ApplicationView.txtShare": "Share",
|
"DE.ApplicationView.txtShare": "Share",
|
||||||
"DE.ApplicationView.textSubmit": "Submit",
|
"DE.ApplicationView.textSubmit": "Submit",
|
||||||
"DE.ApplicationView.textClear": "Clear All Fields",
|
"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