Commits

Sebastian Sdorra committed e4e4c60

added confirmation dialog before delete

  • Participants
  • Parent commits c8eb681

Comments (0)

Files changed (1)

File scm-webapp/src/main/webapp/resources/js/sonia.rest.js

         console.debug( 'remove item ' + id );
       }
 
-      // TODO show confirmation dialog
+      var store = this.store;
+      var url = String.format( this.restRemoveUrlPattern, id );
 
-      var store = this.store;
-
-      var url = String.format( this.restRemoveUrlPattern, id );
-      Ext.Ajax.request({
-        url: url,
-        method: 'DELETE',
-        success: function(){
-          store.reload();
-        },
-        failure: function(){
-          alert( 'failure' );
+      Ext.MessageBox.show({
+        title: 'Remove Item',
+        msg: 'Remove Item "' + id + '"?',
+        buttons: Ext.MessageBox.OKCANCEL,
+        icon: Ext.MessageBox.QUESTION,
+        fn: function(result){
+          if ( result == 'ok' ){
+            Ext.Ajax.request({
+              url: url,
+              method: 'DELETE',
+              success: function(){
+                store.reload();
+              },
+              failure: function(){
+                alert( 'failure' );
+              }
+            });
+          }
         }
       });
+
     }
   },