2014-03-30 23:07:05 -05:00
|
|
|
var DeletePostController = Ember.Controller.extend({
|
2014-06-03 16:10:54 -05:00
|
|
|
actions: {
|
|
|
|
confirmAccept: function () {
|
2014-06-19 13:31:56 -05:00
|
|
|
var self = this,
|
|
|
|
model = this.get('model');
|
2014-06-03 16:10:54 -05:00
|
|
|
|
2014-06-19 13:31:56 -05:00
|
|
|
// definitely want to clear the data store and post of any unsaved, client-generated tags
|
|
|
|
model.updateTags();
|
|
|
|
|
|
|
|
model.destroyRecord().then(function () {
|
2014-06-05 23:04:49 -05:00
|
|
|
self.get('popover').closePopovers();
|
2014-06-03 16:10:54 -05:00
|
|
|
self.transitionToRoute('posts.index');
|
2014-08-01 00:40:49 -05:00
|
|
|
self.notifications.showSuccess('Your post has been deleted.', { delayed: true });
|
2014-06-03 16:10:54 -05:00
|
|
|
}, function () {
|
|
|
|
self.notifications.showError('Your post could not be deleted. Please try again.');
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
confirmReject: function () {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
2014-03-30 23:07:05 -05:00
|
|
|
confirm: {
|
|
|
|
accept: {
|
2014-06-01 15:53:16 -05:00
|
|
|
text: 'Delete',
|
|
|
|
buttonClass: 'button-delete'
|
2014-03-30 23:07:05 -05:00
|
|
|
},
|
|
|
|
reject: {
|
2014-06-01 15:53:16 -05:00
|
|
|
text: 'Cancel',
|
|
|
|
buttonClass: 'button'
|
2014-03-30 23:07:05 -05:00
|
|
|
}
|
2014-06-01 15:53:16 -05:00
|
|
|
}
|
2014-03-30 23:07:05 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
export default DeletePostController;
|