mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-17 13:31:39 +03:00
c649d23936
fixes #2748 - Properly handle marking post as featured/non-featured - Show correct notifications
22 lines
701 B
JavaScript
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;
|