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

39 lines
1.0 KiB
JavaScript
Raw Normal View History

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