From 2de194916771e13b77fbd2a4683053a2553c6e67 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 5 Sep 2010 19:26:33 +0200 Subject: [PATCH] added confirmation dialog before delete --- .../main/webapp/resources/js/sonia.rest.js | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.rest.js b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js index 22c1fd46c6..107ec7bb2b 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.rest.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js @@ -186,21 +186,30 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, { console.debug( 'remove item ' + id ); } - // TODO show confirmation dialog - 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' ); + } + }); + } } }); + } },