Skip to content

Commit 2b8ed98

Browse files
committed
Pass deployButton and userMenu theme options to ui
1 parent dcd579b commit 2b8ed98

3 files changed

Lines changed: 47 additions & 13 deletions

File tree

editor/js/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ var RED = (function() {
178178
RED.workspaces.init();
179179
RED.clipboard.init();
180180
RED.view.init();
181-
RED.deploy.init();
181+
182+
RED.deploy.init(RED.settings.editorTheme?RED.settings.editorTheme.deployButton:null);
182183

183184
RED.keyboard.add(/* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();});
184185
RED.comms.connect();
@@ -192,7 +193,7 @@ var RED = (function() {
192193
$(function() {
193194

194195
if ((window.location.hostname !== "localhost") && (window.location.hostname !== "127.0.0.1")) {
195-
document.title = "Node-RED : "+window.location.hostname;
196+
document.title = document.title+" : "+window.location.hostname;
196197
}
197198

198199
ace.require("ace/ext/language_tools");

editor/js/user.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,16 @@ RED.user = (function() {
144144

145145
function init() {
146146
if (RED.settings.user) {
147-
$('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"><i class="fa fa-user"></i></a></li>')
148-
.prependTo(".header-toolbar");
149-
150-
RED.menu.init({id:"btn-usermenu",
151-
options: []
152-
});
153-
updateUserMenu();
147+
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
148+
149+
$('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"><i class="fa fa-user"></i></a></li>')
150+
.prependTo(".header-toolbar");
151+
152+
RED.menu.init({id:"btn-usermenu",
153+
options: []
154+
});
155+
updateUserMenu();
156+
}
154157
}
155158

156159
}

red/api/theme.js

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ var themeContext = {
2828
header: {
2929
title: "Node-RED",
3030
image: "red/images/node-red.png"
31-
}
31+
},
32+
//deployButton: {
33+
///**
34+
// * options:
35+
// * type: "default" - Button with drop-down options - no further customisation available
36+
// * type: "simple" - Button without dropdown. Customisations:
37+
// * label: the text to display - default: "Deploy"
38+
// * icon : the icon to use. Null removes the icon. default: "red/images/deploy-full-o.png"
39+
// */
40+
//
41+
//}
3242
};
3343

3444
var themeSettings = null;
@@ -69,15 +79,15 @@ module.exports = {
6979
for (i=0;i<styles.length;i++) {
7080
url = serveFile(themeApp,"/css/",styles[i]);
7181
if (url) {
72-
themeContext.page.css.push("/theme"+url);
82+
themeContext.page.css.push("theme"+url);
7383
}
7484
}
7585
}
7686

7787
if (theme.page.favicon) {
7888
url = serveFile(themeApp,"/favicon/",theme.page.favicon)
7989
if (url) {
80-
themeContext.page.favicon = "/theme"+url;
90+
themeContext.page.favicon = "theme"+url;
8191
}
8292
}
8393

@@ -91,14 +101,34 @@ module.exports = {
91101
if (theme.header.image) {
92102
url = serveFile(themeApp,"/header/",theme.header.image);
93103
if (url) {
94-
themeContext.header.image = "/theme"+url;
104+
themeContext.header.image = "theme"+url;
95105
}
96106
} else {
97107
themeContext.header.image = null;
98108
}
99109
}
100110
}
101111

112+
if (theme.deployButton) {
113+
if (theme.deployButton.type == "simple") {
114+
themeSettings.deployButton = {
115+
type: "simple"
116+
}
117+
if (theme.deployButton.label) {
118+
themeSettings.deployButton.label = theme.deployButton.label;
119+
}
120+
if (theme.deployButton.icon) {
121+
url = serveFile(themeApp,"/deploy/",theme.deployButton.icon);
122+
if (url) {
123+
themeSettings.deployButton.icon = "theme"+url;
124+
}
125+
}
126+
}
127+
}
128+
129+
if (theme.hasOwnProperty("userMenu")) {
130+
themeSettings.userMenu = theme.userMenu;
131+
}
102132
//themeSettings.deployButton = theme.deployButton || themeSettings.deployButton;
103133

104134
return themeApp;

0 commit comments

Comments
 (0)