mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
39967b02da
Closes #2849 -wire up delete post action in ember admin -refactor ember modal dialog -override RESTAdapter.deleteRecord to workaround Ember expecting an empty response body on DELETEs
32 lines
847 B
JavaScript
32 lines
847 B
JavaScript
var DeletePostController = Ember.Controller.extend({
|
|
needs: 'posts/post',
|
|
actions: {
|
|
confirmAccept: function () {
|
|
var self = this;
|
|
|
|
this.get('model').destroyRecord().then(function () {
|
|
self.notifications.showSuccess('Your post has been deleted.');
|
|
self.transitionToRoute('posts.index');
|
|
}, function () {
|
|
self.notifications.showError('Your post could not be deleted. Please try again.');
|
|
});
|
|
|
|
},
|
|
|
|
confirmReject: function () {
|
|
return false;
|
|
}
|
|
},
|
|
confirm: {
|
|
accept: {
|
|
text: 'Delete',
|
|
buttonClass: 'button-delete'
|
|
},
|
|
reject: {
|
|
text: 'Cancel',
|
|
buttonClass: 'button'
|
|
}
|
|
}
|
|
});
|
|
|
|
export default DeletePostController;
|