From 129c1569f5f426169f5ad9a655286ffae6013b12 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 11 Feb 2014 16:19:09 +0600 Subject: [PATCH] SONAR-5052 Rework widgets drag'n'drop --- .../src/main/webapp/javascripts/dashboard.js | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sonar-server/src/main/webapp/javascripts/dashboard.js b/sonar-server/src/main/webapp/javascripts/dashboard.js index 626e6398fd3..cc70df9bf8a 100644 --- a/sonar-server/src/main/webapp/javascripts/dashboard.js +++ b/sonar-server/src/main/webapp/javascripts/dashboard.js @@ -36,7 +36,8 @@ blocks .prop('draggable', true) - .on('dragstart', function() { + .on('dragstart', function(e) { + e.originalEvent.dataTransfer.setData('text/plain', 'drag'); draggable = $(this); }) .on('dragover', function(e) { @@ -99,6 +100,26 @@ data: postBody }); } + }, + + + editWidget: function(widgetId) { + $('#widget_title_' + widgetId).hide(); + $('#widget_' + widgetId).hide(); + $('#widget_props_' + widgetId).show(); + }, + + + cancelEditWidget: function(widgetId) { + $('widget_title_' + widgetId).show(); + $('#widget_' + widgetId).show(); + $('#widget_props_' + widgetId).hide(); + }, + + + deleteWidget: function(element) { + $(element).closest('.' + this.options.block).remove(); + this.saveDashboardsState(); } }; -- 2.39.5