diff --git a/core/client/controllers/modals/delete-user.js b/core/client/controllers/modals/delete-user.js new file mode 100644 index 0000000000..7be8e70fc3 --- /dev/null +++ b/core/client/controllers/modals/delete-user.js @@ -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; diff --git a/core/client/templates/modals/delete-user.hbs b/core/client/templates/modals/delete-user.hbs new file mode 100644 index 0000000000..7792078fc9 --- /dev/null +++ b/core/client/templates/modals/delete-user.hbs @@ -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}} + +
All posts and associated data will also be deleted. There is no way to recover this data. +
+ +{{/gh-modal-dialog}} \ No newline at end of file diff --git a/core/client/templates/user-actions-menu.hbs b/core/client/templates/user-actions-menu.hbs index 996b417fde..a6995f2f77 100644 --- a/core/client/templates/user-actions-menu.hbs +++ b/core/client/templates/user-actions-menu.hbs @@ -2,5 +2,5 @@ Make Owner {{/if}} {{#if view.parentView.deleteUserActionIsVisible}} -Delete User +Delete User {{/if}} \ No newline at end of file