From: Olivier Lamy Date: Tue, 5 Jun 2012 23:18:13 +0000 (+0000) Subject: add a confirm dialog for deleting artifact X-Git-Tag: archiva-1.4-M3~634 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bdec4d4bccd1a8e02c486dd1c6483a24b700e9f4;p=archiva.git add a confirm dialog for deleting artifact git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1346654 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index cf0c0da0c..00159c2b9 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -391,22 +391,33 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock this.artifacts=ko.observableArray(artifacts); var self=this; deleteArtifact=function(artifact){ - $.log("deleteArtifact"); + clearUserMessages(); - $.ajax({ - url:"restServices/archivaServices/repositoriesService/deleteArtifact", - type:"POST", - dataType:"json", - contentType: 'application/json', - data: ko.toJSON(artifact), - success:function(data){ - self.artifacts.remove(artifact); - displaySuccessMessage( $.i18n.prop('artifact.deleted')); - }, - error:function(data){ - displayRestError(data,"user-messages"); - } - }); + + openDialogConfirm(function(){ + $.ajax({ + url:"restServices/archivaServices/repositoriesService/deleteArtifact", + type:"POST", + dataType:"json", + contentType: 'application/json', + data: ko.toJSON(artifact), + success:function(data){ + self.artifacts.remove(artifact); + displaySuccessMessage( $.i18n.prop('artifact.deleted')); + }, + error:function(data){ + displayRestError(data,"user-messages"); + }, + complete:function(){ + closeDialogConfirm(); + } + }); + }, $.i18n.prop('ok'), + $.i18n.prop('cancel'), + $.i18n.prop('artifact.delete.confirm.title'), + $.i18n.prop('artifact.delete.confirm.save')); + + }