1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Pass deployButton and userMenu theme options to ui

This commit is contained in:
Nick O'Leary 2015-04-13 09:48:49 +01:00
parent dcd579b5e3
commit 2b8ed9850b
3 changed files with 47 additions and 13 deletions

View File

@ -178,7 +178,8 @@ var RED = (function() {
RED.workspaces.init();
RED.clipboard.init();
RED.view.init();
RED.deploy.init();
RED.deploy.init(RED.settings.editorTheme?RED.settings.editorTheme.deployButton:null);
RED.keyboard.add(/* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();});
RED.comms.connect();
@ -192,7 +193,7 @@ var RED = (function() {
$(function() {
if ((window.location.hostname !== "localhost") && (window.location.hostname !== "127.0.0.1")) {
document.title = "Node-RED : "+window.location.hostname;
document.title = document.title+" : "+window.location.hostname;
}
ace.require("ace/ext/language_tools");

View File

@ -144,13 +144,16 @@ RED.user = (function() {
function init() {
if (RED.settings.user) {
$('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"><i class="fa fa-user"></i></a></li>')
.prependTo(".header-toolbar");
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
RED.menu.init({id:"btn-usermenu",
options: []
});
updateUserMenu();
$('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"><i class="fa fa-user"></i></a></li>')
.prependTo(".header-toolbar");
RED.menu.init({id:"btn-usermenu",
options: []
});
updateUserMenu();
}
}
}

View File

@ -28,7 +28,17 @@ var themeContext = {
header: {
title: "Node-RED",
image: "red/images/node-red.png"
}
},
//deployButton: {
///**
// * options:
// * type: "default" - Button with drop-down options - no further customisation available
// * type: "simple" - Button without dropdown. Customisations:
// * label: the text to display - default: "Deploy"
// * icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.png"
// */
//
//}
};
var themeSettings = null;
@ -69,7 +79,7 @@ module.exports = {
for (i=0;i<styles.length;i++) {
url = serveFile(themeApp,"/css/",styles[i]);
if (url) {
themeContext.page.css.push("/theme"+url);
themeContext.page.css.push("theme"+url);
}
}
}
@ -77,7 +87,7 @@ module.exports = {
if (theme.page.favicon) {
url = serveFile(themeApp,"/favicon/",theme.page.favicon)
if (url) {
themeContext.page.favicon = "/theme"+url;
themeContext.page.favicon = "theme"+url;
}
}
@ -91,7 +101,7 @@ module.exports = {
if (theme.header.image) {
url = serveFile(themeApp,"/header/",theme.header.image);
if (url) {
themeContext.header.image = "/theme"+url;
themeContext.header.image = "theme"+url;
}
} else {
themeContext.header.image = null;
@ -99,6 +109,26 @@ module.exports = {
}
}
if (theme.deployButton) {
if (theme.deployButton.type == "simple") {
themeSettings.deployButton = {
type: "simple"
}
if (theme.deployButton.label) {
themeSettings.deployButton.label = theme.deployButton.label;
}
if (theme.deployButton.icon) {
url = serveFile(themeApp,"/deploy/",theme.deployButton.icon);
if (url) {
themeSettings.deployButton.icon = "theme"+url;
}
}
}
}
if (theme.hasOwnProperty("userMenu")) {
themeSettings.userMenu = theme.userMenu;
}
//themeSettings.deployButton = theme.deployButton || themeSettings.deployButton;
return themeApp;