2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-05-26 05:10:50 +03:00
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
|
|
|
dropdown: Ember.inject.service(),
|
|
|
|
notifications: Ember.inject.service(),
|
|
|
|
|
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-09-28 19:39:25 +04:00
|
|
|
self.get('dropdown').closeDropdowns();
|
2014-06-04 01:10:54 +04:00
|
|
|
self.transitionToRoute('posts.index');
|
2015-05-26 05:10:50 +03:00
|
|
|
self.get('notifications').showSuccess('Your post has been deleted.', {delayed: true});
|
2014-06-04 01:10:54 +04:00
|
|
|
}, function () {
|
2015-05-26 05:10:50 +03:00
|
|
|
self.get('notifications').showError('Your post could not be deleted. Please try again.');
|
2014-06-04 01:10:54 +04:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
confirmReject: function () {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2014-03-31 08:07:05 +04:00
|
|
|
confirm: {
|
|
|
|
accept: {
|
2014-06-02 00:53:16 +04:00
|
|
|
text: 'Delete',
|
2014-08-06 15:34:08 +04:00
|
|
|
buttonClass: 'btn btn-red'
|
2014-03-31 08:07:05 +04:00
|
|
|
},
|
|
|
|
reject: {
|
2014-06-02 00:53:16 +04:00
|
|
|
text: 'Cancel',
|
2014-08-06 15:34:08 +04:00
|
|
|
buttonClass: 'btn btn-default btn-minor'
|
2014-03-31 08:07:05 +04:00
|
|
|
}
|
2014-06-02 00:53:16 +04:00
|
|
|
}
|
2014-03-31 08:07:05 +04:00
|
|
|
});
|