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

Add 'view' menu and reorganise a few things

This commit is contained in:
Nick O'Leary 2016-01-09 20:39:03 +00:00
parent 9837f0e2e1
commit 66eaaf5a48
4 changed files with 29 additions and 28 deletions

View File

@ -156,12 +156,15 @@ var RED = (function() {
function loadEditor() { function loadEditor() {
RED.menu.init({id:"btn-sidemenu", RED.menu.init({id:"btn-sidemenu",
options: [ options: [
{id:"menu-item-sidebar-menu",label:RED._("menu.label.sidebar.sidebar"),options:[ {id:"menu-item-view-menu",label:RED._("menu.label.view.view"),options:[
{id:"menu-item-sidebar",label:RED._("menu.label.sidebar.show"),toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true}, {id:"menu-item-view-show-grid",label:RED._("menu.label.view.showGrid"),toggle:true,onselect:RED.view.toggleShowGrid},
null {id:"menu-item-view-snap-grid",label:RED._("menu.label.view.snapGrid"),toggle:true,onselect:RED.view.toggleSnapGrid},
]}, null,
{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-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:[ {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:[]}
@ -171,28 +174,24 @@ var RED = (function() {
{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, null,
{id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [ {id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function(){}},
{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-workspace",label:RED._("menu.label.flows"),options:[ {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
]}, ]},
null, {id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [
{id:"menu-item-layout",label:RED._("menu.label.layout.layout"), options: [ {id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:RED.subflow.createSubflow},
{id:"menu-item-layout-show-grid",label:RED._("menu.label.layout.showGrid"),toggle:true,onselect:RED.view.toggleShowGrid}, {id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:RED.subflow.convertToSubflow},
{id:"menu-item-layout-snap-grid",label:RED._("menu.label.layout.snapGrid"),toggle:true,onselect:RED.view.toggleSnapGrid}
]}, ]},
null, null,
{id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:RED.keyboard.showHelp}, {id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:RED.keyboard.showHelp},
{id:"menu-item-help", {id:"menu-item-help",
label: RED.settings.theme("menu.menu-item-help.label","Node-RED Website"), 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") href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs")
} },
{id:"menu-item-node-red-version", label:"v"+RED.settings.version}
] ]
}); });

View File

@ -60,8 +60,8 @@ RED.sidebar = (function() {
$(options.content).hide(); $(options.content).hide();
var id = options.id; var id = options.id;
RED.menu.addItem("menu-item-sidebar-menu",{ RED.menu.addItem("menu-item-view-menu",{
id:"menu-item-sidebar-menu-"+options.id, id:"menu-item-view-menu-"+options.id,
label:options.name, label:options.name,
onselect:function() { onselect:function() {
showSidebar(options.id); showSidebar(options.id);
@ -80,7 +80,7 @@ RED.sidebar = (function() {
sidebar_tabs.removeTab(id); sidebar_tabs.removeTab(id);
$(knownTabs[id].content).remove(); $(knownTabs[id].content).remove();
delete knownTabs[id]; delete knownTabs[id];
RED.menu.removeItem("menu-item-sidebar-menu-"+id); RED.menu.removeItem("menu-item-view-menu-"+id);
} }
var sidebarSeparator = {}; var sidebarSeparator = {};

View File

@ -116,6 +116,9 @@ RED.sidebar.config = (function() {
onchange: function() { refreshConfigNodeList(); } onchange: function() { refreshConfigNodeList(); }
}); });
RED.menu.setAction('menu-item-config-nodes',function() {
RED.sidebar.show('config');
})
$(".workspace-config-node-tray-header").on('click', function(e) { $(".workspace-config-node-tray-header").on('click', function(e) {
var icon = $(this).find("i"); var icon = $(this).find("i");
if (icon.hasClass("expanded")) { if (icon.hasClass("expanded")) {

View File

@ -17,11 +17,15 @@
}, },
"menu": { "menu": {
"label": { "label": {
"sidebar": { "view": {
"sidebar": "Sidebar", "view": "View",
"show": "Toggle Sidebar" "showGrid": "Show grid",
"snapGrid": "Snap to grid"
}, },
"displayStatus": "Display Node Status", "sidebar": {
"show": "Show sidebar"
},
"displayStatus": "Display node status",
"displayConfig": "Configuration Nodes", "displayConfig": "Configuration Nodes",
"import": "Import", "import": "Import",
"export": "Export", "export": "Export",
@ -30,18 +34,13 @@
"subflows": "Subflows", "subflows": "Subflows",
"createSubflow": "Create Subflow", "createSubflow": "Create Subflow",
"selectionToSubflow": "Selection to Subflow", "selectionToSubflow": "Selection to Subflow",
"flows": "Tabs", "flows": "Flows",
"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"
"layout": {
"layout": "Layout",
"showGrid": "Show grid",
"snapGrid": "Snap to grid"
}
} }
}, },
"user": { "user": {