]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5052 Rework widgets drag'n'drop
authorStas Vilchik <vilchiks@gmail.com>
Tue, 11 Feb 2014 10:19:09 +0000 (16:19 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 11 Feb 2014 10:19:09 +0000 (16:19 +0600)
sonar-server/src/main/webapp/javascripts/dashboard.js

index 626e6398fd35f46fdd910cba32a3abb183a13ecb..cc70df9bf8ab70d12e120b0de3be935c6fe75755 100644 (file)
@@ -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) {
           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();
     }
   };