Add confirmation modal to admin group deletion

This commit is contained in:
Michael Campagnaro
2013-07-21 22:37:01 -04:00
committed by Michael Campagnaro
parent 58e7c3e1f3
commit 9616767bff
23 changed files with 196 additions and 28 deletions
+7 -1
View File
@@ -36,12 +36,18 @@ Discourse.Group = Discourse.Model.extend({
}.property('users'),
destroy: function(){
if(!this.id) return;
var group = this;
group.set('disableSave', true);
return Discourse.ajax("/admin/groups/" + this.get("id"), {type: "DELETE"})
return Discourse.ajax("/admin/groups/" + group.id, {type: "DELETE"})
.then(function(){
return true;
}, function(jqXHR, status, error) {
group.set('disableSave', false);
bootbox.alert(I18n.t("admin.groups.delete_failed"));
return false;
});
},