Ghost/ghost/admin/controllers/modals/delete-post.js

37 lines
1.0 KiB
JavaScript
Raw Normal View History

2014-03-31 08:07:05 +04:00
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.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;
}
},
2014-03-31 08:07:05 +04:00
confirm: {
accept: {
text: 'Delete',
buttonClass: 'button-delete'
2014-03-31 08:07:05 +04:00
},
reject: {
text: 'Cancel',
buttonClass: 'button'
2014-03-31 08:07:05 +04:00
}
}
2014-03-31 08:07:05 +04:00
});
export default DeletePostController;