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,54 +171,60 @@ var RED = (function() {
} }
function loadEditor() { function loadEditor() {
RED.menu.init({id:"btn-sidemenu",
options: [ var menuOptions = [];
{id:"menu-item-view-menu",label:RED._("menu.label.view.view"),options:[ 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-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-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}, {id:"menu-item-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:toggleStatus, selected: true},
null, null,
{id:"menu-item-bidi",label:RED._("menu.label.view.textDir"),options:[ {id:"menu-item-bidi",label:RED._("menu.label.view.textDir"),options:[
{id:"menu-item-bidi-default",toggle:"text-direction",label:RED._("menu.label.view.defaultDir"),selected: true, onselect:function(s) { if(s){RED.text.bidi.setTextDirection("")}}}, {id:"menu-item-bidi-default",toggle:"text-direction",label:RED._("menu.label.view.defaultDir"),selected: true, onselect:function(s) { if(s){RED.text.bidi.setTextDirection("")}}},
{id:"menu-item-bidi-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("ltr")}}}, {id:"menu-item-bidi-ltr",toggle:"text-direction",label:RED._("menu.label.view.ltr"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("ltr")}}},
{id:"menu-item-bidi-rtl",toggle:"text-direction",label:RED._("menu.label.view.rtl"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("rtl")}}}, {id:"menu-item-bidi-rtl",toggle:"text-direction",label:RED._("menu.label.view.rtl"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("rtl")}}},
{id:"menu-item-bidi-auto",toggle:"text-direction",label:RED._("menu.label.view.auto"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("auto")}}} {id:"menu-item-bidi-auto",toggle:"text-direction",label:RED._("menu.label.view.auto"), onselect:function(s) { if(s){RED.text.bidi.setTextDirection("auto")}}}
]}, ]},
null, null,
{id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true} {id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true}
]}, ]});
null, menuOptions.push(null);
{id:"menu-item-import",label:RED._("menu.label.import"),options:[ 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-clipboard",label:RED._("menu.label.clipboard"),onselect:RED.clipboard.import},
{id:"menu-item-import-library",label:RED._("menu.label.library"),options:[]} {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-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} {id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:RED.library.export}
]}, ]});
null, menuOptions.push(null);
{id:"menu-item-search",label:RED._("menu.label.search"),onselect:RED.search.show}, menuOptions.push({id:"menu-item-search",label:RED._("menu.label.search"),onselect:RED.search.show});
null, menuOptions.push(null);
{id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function() {}}, menuOptions.push({id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function() {}});
{id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[ 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-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-edit",label:RED._("menu.label.rename"),onselect:RED.workspaces.edit},
{id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:RED.workspaces.remove}, {id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:RED.workspaces.remove},
null 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-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}, {id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:RED.subflow.convertToSubflow},
]}, ]});
null, menuOptions.push(null);
{id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:RED.keyboard.showHelp}, if (RED.settings.theme('palette.editable') !== false) {
{id:"menu-item-help", RED.palette.editor.init();
label: RED.settings.theme("menu.menu-item-help.label","Node-RED Website"), menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:RED.palette.editor.show});
href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs") menuOptions.push(null);
}, }
{id:"menu-item-node-red-version", label:"v"+RED.settings.version, onselect: showAbout }
] 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")
}); });
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(); RED.user.init();

View File

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

View File

@ -66,9 +66,6 @@
</div> </div>
<div id="palette-container" class="palette-scroll hide"></div> <div id="palette-container" class="palette-scroll hide"></div>
<div id="palette-footer"> <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-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> <a class="palette-button" id="palette-expand-all" href="#"><i class="fa fa-angle-double-down"></i></a>
</div> </div>

View File

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