Ghost/core/client/controllers/posts/post.js
Fabian Becker c649d23936 Content screen: Featured posts
fixes #2748
- Properly handle marking post as featured/non-featured
- Show correct notifications
2014-06-16 09:32:40 +00:00

22 lines
701 B
JavaScript

var PostController = Ember.ObjectController.extend({
isPublished: Ember.computed.equal('status', 'published'),
classNameBindings: ['featured'],
actions: {
toggleFeatured: function () {
var featured = !this.get('featured'),
self = this;
this.set('featured', featured);
this.get('model').save().then(function () {
self.notifications.showSuccess('Post successfully marked as ' + (featured ? 'featured' : 'not featured') + '.');
}, function() {
self.notifications.showError('An error occured while saving the post.');
});
}
}
});
export default PostController;