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

Add tooltip to flow add button

This commit is contained in:
Nick O'Leary 2018-10-17 13:45:57 +01:00
parent 242398c724
commit 2816b3edae
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 19 additions and 9 deletions

View File

@ -23,6 +23,7 @@
"confirmDelete": "Confirm delete", "confirmDelete": "Confirm delete",
"delete": "Are you sure you want to delete '__label__'?", "delete": "Are you sure you want to delete '__label__'?",
"dropFlowHere": "Drop the flow here", "dropFlowHere": "Drop the flow here",
"addFlow": "Add Flow",
"status": "Status", "status": "Status",
"enabled": "Enabled", "enabled": "Enabled",
"disabled":"Disabled", "disabled":"Disabled",

View File

@ -34,14 +34,24 @@ RED.tabs = (function() {
if (options.vertical) { if (options.vertical) {
wrapper.addClass("red-ui-tabs-vertical"); wrapper.addClass("red-ui-tabs-vertical");
} }
if (options.addButton && typeof options.addButton === 'function') { if (options.addButton) {
wrapper.addClass("red-ui-tabs-add"); wrapper.addClass("red-ui-tabs-add");
var addButton = $('<div class="red-ui-tab-button"><a href="#"><i class="fa fa-plus"></i></a></div>').appendTo(wrapper); var addButton = $('<div class="red-ui-tab-button"><a href="#"><i class="fa fa-plus"></i></a></div>').appendTo(wrapper);
addButton.find('a').click(function(evt) { addButton.find('a').click(function(evt) {
evt.preventDefault(); evt.preventDefault();
options.addButton(); if (typeof options.addButton === 'function') {
options.addButton();
} else if (typeof options.addButton === 'string') {
RED.actions.invoke(options.addButton);
}
}) })
if (typeof options.addButton === 'string') {
var l = options.addButton;
if (options.addButtonCaption) {
l = options.addButtonCaption
}
RED.popover.tooltip(addButton,l,options.addButton);
}
} }
var scrollLeft; var scrollLeft;
var scrollRight; var scrollRight;

View File

@ -289,9 +289,8 @@ RED.workspaces = (function() {
}, },
minimumActiveTabWidth: 150, minimumActiveTabWidth: 150,
scrollable: true, scrollable: true,
addButton: function() { addButton: "core:add-flow",
addWorkspace(); addButtonCaption: RED._("workspace.addFlow")
}
}); });
workspaceTabCount = 0; workspaceTabCount = 0;
} }
@ -339,9 +338,9 @@ RED.workspaces = (function() {
if (workspace_tabs.contains(ws.id)) { if (workspace_tabs.contains(ws.id)) {
workspace_tabs.removeTab(ws.id); workspace_tabs.removeTab(ws.id);
} }
} if (ws.id === activeWorkspace) {
if (ws.id === activeWorkspace) { activeWorkspace = 0;
activeWorkspace = 0; }
} }
} }