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

Replace palette-edit button with menu option

This commit is contained in:
Nick O'Leary 2016-09-30 20:33:27 +01:00
parent 538a16a5fb
commit b00985f99f
5 changed files with 64 additions and 65 deletions

View File

@ -171,9 +171,9 @@ var RED = (function() {
}
function loadEditor() {
RED.menu.init({id:"btn-sidemenu",
options: [
{id:"menu-item-view-menu",label:RED._("menu.label.view.view"),options:[
var menuOptions = [];
menuOptions.push({id:"menu-item-view-menu",label:RED._("menu.label.view.view"),options:[
{id:"menu-item-view-show-grid",label:RED._("menu.label.view.showGrid"),toggle:true,onselect:RED.view.toggleShowGrid},
{id:"menu-item-view-snap-grid",label:RED._("menu.label.view.snapGrid"),toggle:true,onselect:RED.view.toggleSnapGrid},
{id:"menu-item-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:toggleStatus, selected: true},
@ -186,39 +186,45 @@ var RED = (function() {
]},
null,
{id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true}
]},
null,
{id:"menu-item-import",label:RED._("menu.label.import"),options:[
]});
menuOptions.push(null);
menuOptions.push({id:"menu-item-import",label:RED._("menu.label.import"),options:[
{id:"menu-item-import-clipboard",label:RED._("menu.label.clipboard"),onselect:RED.clipboard.import},
{id:"menu-item-import-library",label:RED._("menu.label.library"),options:[]}
]},
{id:"menu-item-export",label:RED._("menu.label.export"),disabled:true,options:[
]});
menuOptions.push({id:"menu-item-export",label:RED._("menu.label.export"),disabled:true,options:[
{id:"menu-item-export-clipboard",label:RED._("menu.label.clipboard"),disabled:true,onselect:RED.clipboard.export},
{id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:RED.library.export}
]},
null,
{id:"menu-item-search",label:RED._("menu.label.search"),onselect:RED.search.show},
null,
{id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function() {}},
{id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[
]});
menuOptions.push(null);
menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:RED.search.show});
menuOptions.push(null);
menuOptions.push({id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function() {}});
menuOptions.push({id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[
{id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:RED.workspaces.add},
{id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:RED.workspaces.edit},
{id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:RED.workspaces.remove},
null
]},
{id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [
]});
menuOptions.push({id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [
{id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:RED.subflow.createSubflow},
{id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:RED.subflow.convertToSubflow},
]},
null,
{id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:RED.keyboard.showHelp},
{id:"menu-item-help",
label: RED.settings.theme("menu.menu-item-help.label","Node-RED Website"),
]});
menuOptions.push(null);
if (RED.settings.theme('palette.editable') !== false) {
RED.palette.editor.init();
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:RED.palette.editor.show});
menuOptions.push(null);
}
menuOptions.push({id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:RED.keyboard.showHelp});
menuOptions.push({id:"menu-item-help",
label: RED.settings.theme("menu.menu-item-help.label","Node-RED website"),
href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs")
},
{id:"menu-item-node-red-version", label:"v"+RED.settings.version, onselect: showAbout }
]
});
menuOptions.push({id:"menu-item-node-red-version", label:"v"+RED.settings.version, onselect: showAbout });
RED.menu.init({id:"btn-sidemenu",options: menuOptions});
RED.user.init();

View File

@ -256,6 +256,9 @@ RED.palette.editor = (function() {
}
function showPaletteEditor() {
if (RED.settings.theme('palette.editable') === false) {
return;
}
$("#header-shade").show();
$("#editor-shade").show();
$("#sidebar-shade").show();
@ -368,8 +371,9 @@ RED.palette.editor = (function() {
}
function init() {
$(".palette-editor-button").show();
if (RED.settings.theme('palette.editable') === false) {
return;
}
editorTabs = RED.tabs.create({
id:"palette-editor-tabs",
@ -402,13 +406,7 @@ RED.palette.editor = (function() {
hidePaletteEditor();
}
});
$("#palette-edit").on("click",function(e) {
if ($("#main-container").hasClass("palette-expanded")) {
hidePaletteEditor();
} else {
showPaletteEditor();
}
});
$("#palette-editor-close").on("click", function(e) {
hidePaletteEditor();
})
@ -737,5 +735,6 @@ RED.palette.editor = (function() {
return {
init: init,
show: showPaletteEditor
}
})();

View File

@ -467,10 +467,6 @@ RED.palette = (function() {
}
}
});
if (RED.settings.theme('palette.editable') !== false) {
RED.palette.editor.init();
}
}
return {

View File

@ -66,9 +66,6 @@
</div>
<div id="palette-container" class="palette-scroll hide"></div>
<div id="palette-footer">
<div style="float:left" class="palette-editor-button hide">
<a class="palette-button palette-button-left" id="palette-edit" href="#"><i class="fa fa-cog"></i></a>
</div>
<a class="palette-button" id="palette-collapse-all" href="#"><i class="fa fa-angle-double-up"></i></a>
<a class="palette-button" id="palette-expand-all" href="#"><i class="fa fa-angle-double-down"></i></a>
</div>

View File

@ -50,9 +50,10 @@
"add": "Add",
"rename": "Rename",
"delete": "Delete",
"keyboardShortcuts": "Keyboard Shortcuts",
"keyboardShortcuts": "Keyboard shortcuts",
"login": "Login",
"logout": "Logout"
"logout": "Logout",
"editPalette":"Manage palette"
}
},
"user": {