mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-16 04:08:34 +03:00
6aabb08660
closes #3012 - Inject notification object into router - Listen to didTransition / observe currentPath to close notifications - Close notifications on successful save actions
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
var DeletePostController = Ember.Controller.extend({
|
|
actions: {
|
|
confirmAccept: function () {
|
|
var self = this,
|
|
model = this.get('model');
|
|
|
|
// definitely want to clear the data store and post of any unsaved, client-generated tags
|
|
model.updateTags();
|
|
|
|
model.destroyRecord().then(function () {
|
|
self.get('popover').closePopovers();
|
|
self.transitionToRoute('posts.index');
|
|
self.notifications.showSuccess('Your post has been deleted.', true);
|
|
}, 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;
|