Merge pull request #3588 from felixrieseberg/iss3529

Working delete user modal & button
This commit is contained in:
Hannah Wolfe 2014-08-04 23:00:49 +01:00
commit aea25693e5
3 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,33 @@
var DeleteUserController = Ember.Controller.extend({
actions: {
confirmAccept: function () {
var self = this,
user = this.get('model');
user.destroyRecord().then(function () {
self.store.unloadAll('post');
self.transitionToRoute('settings.users');
self.notifications.showSuccess('The user has been deleted.', { delayed: true });
}, function () {
self.notifications.showError('The user could not be deleted. Please try again.');
});
},
confirmReject: function () {
return false;
}
},
confirm: {
accept: {
text: 'Delete User',
buttonClass: 'button-delete'
},
reject: {
text: 'Cancel',
buttonClass: 'button'
}
}
});
export default DeleteUserController;

View File

@ -0,0 +1,7 @@
{{#gh-modal-dialog action="closeModal" showClose=true type="action" style="wide,centered" animation="fade"
title="Are you sure you want to delete this user?" confirm=confirm}}
<p>All posts and associated data will also be deleted. There is no way to recover this data.
</p>
{{/gh-modal-dialog}}

View File

@ -2,5 +2,5 @@
<a href="javascript:void(0);" {{action "openModal" "transfer-owner" this}}>Make Owner</a>
{{/if}}
{{#if view.parentView.deleteUserActionIsVisible}}
<a href="javascript:void(0);" class="delete">Delete User</a>
<a href="javascript:void(0);" {{action "openModal" "delete-user" this}} class="delete">Delete User</a>
{{/if}}