2014-03-31 08:07:05 +04:00
|
|
|
var DeletePostController = Ember.Controller.extend({
|
2014-06-04 01:10:54 +04:00
|
|
|
actions: {
|
|
|
|
confirmAccept: function () {
|
2014-06-19 22:31:56 +04:00
|
|
|
var self = this,
|
|
|
|
model = this.get('model');
|
2014-06-04 01:10:54 +04:00
|
|
|
|
2014-06-19 22:31:56 +04:00
|
|
|
// definitely want to clear the data store and post of any unsaved, client-generated tags
|
|
|
|
model.updateTags();
|
|
|
|
|
|
|
|
model.destroyRecord().then(function () {
|
2014-06-06 08:04:49 +04:00
|
|
|
self.get('popover').closePopovers();
|
2014-06-04 01:10:54 +04:00
|
|
|
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: {
|
2014-06-02 00:53:16 +04:00
|
|
|
text: 'Delete',
|
|
|
|
buttonClass: 'button-delete'
|
2014-03-31 08:07:05 +04:00
|
|
|
},
|
|
|
|
reject: {
|
2014-06-02 00:53:16 +04:00
|
|
|
text: 'Cancel',
|
|
|
|
buttonClass: 'button'
|
2014-03-31 08:07:05 +04:00
|
|
|
}
|
2014-06-02 00:53:16 +04:00
|
|
|
}
|
2014-03-31 08:07:05 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default DeletePostController;
|