Ghost/ghost/admin/controllers/posts/post.js
Fabian Becker 6deb206e84 Implements page class toggling.
- Toggles page class when post is marked as static/non-static
2014-06-16 17:08:58 +03:00

22 lines
702 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;