From 419b044a123e2e75660f3a4dbe676b2e997e0e9d Mon Sep 17 00:00:00 2001 From: Nicholas O'Leary Date: Mon, 28 Oct 2013 20:28:44 +0000 Subject: [PATCH] Add delete button to tab edit dialog --- public/red/ui/sidebar.js | 1 - public/red/ui/view.js | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/public/red/ui/sidebar.js b/public/red/ui/sidebar.js index e905495ff..1474baf14 100644 --- a/public/red/ui/sidebar.js +++ b/public/red/ui/sidebar.js @@ -38,7 +38,6 @@ RED.sidebar = function() { content.style.paddingRight = "4px"; addTab("info",content); - sidebar_tabs.activateTab("tab-info"); $('#btn-sidebar').click(function() {toggleSidebar();}); RED.keyboard.add(/* SPACE */ 32,{ctrl:true},function(){toggleSidebar();d3.event.preventDefault();}); diff --git a/public/red/ui/view.js b/public/red/ui/view.js index b79c611b4..1e461e9c9 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -108,11 +108,15 @@ RED.view = function() { }); $('#btn-workspace-delete').on("click",function() { - var ws = RED.nodes.workspace(activeWorkspace); + deleteWorkspace(activeWorkspace); + }); + + function deleteWorkspace(id) { + var ws = RED.nodes.workspace(id); $( "#node-dialog-delete-workspace" ).dialog('option','workspace',ws); $( "#node-dialog-delete-workspace-name" ).text(ws.label); $( "#node-dialog-delete-workspace" ).dialog('open'); - }); + } //d3.select(window).on("keydown", keydown); @@ -1016,6 +1020,15 @@ RED.view = function() { width: 500, title: "Rename workspace", buttons: [ + { + class: 'leftButton', + text: "Delete", + click: function() { + var workspace = $(this).dialog('option','workspace'); + $( this ).dialog( "close" ); + deleteWorkspace(workspace.id); + } + }, { text: "Ok", click: function() {