0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/client/controllers/posts/post.js
Fabian Becker 1af5eb6248 Close notifications on user action properly.
fixes #3105, refs #3012
- Add additional closeAll() calls where users interact with data
2014-06-25 16:56:09 +00:00

23 lines
No EOL
839 B
JavaScript

var PostController = Ember.ObjectController.extend({
isPublished: Ember.computed.equal('status', 'published'),
classNameBindings: ['featured'],
actions: {
toggleFeatured: function () {
var featured = this.toggleProperty('featured'),
self = this;
// @TODO This should call closePassive() to only close passive notifications
self.notifications.closeAll();
this.get('model').save().then(function () {
self.notifications.showSuccess('Post successfully marked as ' + (featured ? 'featured' : 'not featured') + '.');
}).catch(function (errors) {
self.notifications.showErrors(errors);
return Ember.RSVP.reject(errors);
});
}
}
});
export default PostController;