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

View File

@ -33,12 +33,16 @@ Discourse.AdminGroupsController = Ember.Controller.extend({
},
destroy: function(group){
var list = this.get("model");
if(group.get("id")){
group.destroy().then(function(){
list.removeObject(group);
});
}
var _this = this;
return bootbox.confirm(I18n.t("admin.groups.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
if (result) {
group.destroy().then(function(deleted) {
if (deleted) {
_this.get("model").removeObject(group);
}
});
}
});
}
});