mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Merge pull request #3588 from felixrieseberg/iss3529
Working delete user modal & button
This commit is contained in:
commit
aea25693e5
3 changed files with 41 additions and 1 deletions
33
core/client/controllers/modals/delete-user.js
Normal file
33
core/client/controllers/modals/delete-user.js
Normal 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;
|
7
core/client/templates/modals/delete-user.hbs
Normal file
7
core/client/templates/modals/delete-user.hbs
Normal 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}}
|
|
@ -2,5 +2,5 @@
|
||||||
<a href="javascript:void(0);" {{action "openModal" "transfer-owner" this}}>Make Owner</a>
|
<a href="javascript:void(0);" {{action "openModal" "transfer-owner" this}}>Make Owner</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if view.parentView.deleteUserActionIsVisible}}
|
{{#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}}
|
{{/if}}
|
Loading…
Add table
Reference in a new issue