mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
6020702462
closes #2893, issue #2850, issue #2856 - this is a stable, but quick and dirty validations layer for the time constraints - this could be replaced with a unified server/client layer later. the infrastructure is there. - create a validation engine mixin to match validators with models - override the save method in the mixin to perform validations first - create a post validator - fixup calls to .save() to make sure they catch errors properly
19 lines
No EOL
644 B
JavaScript
19 lines
No EOL
644 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;
|
|
|
|
this.get('model').save().then(function () {
|
|
self.notifications.showSuccess('Post successfully marked as ' + (featured ? 'featured' : 'not featured') + '.');
|
|
}).catch(function (errors) {
|
|
self.notifications.showErrors(errors);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
export default PostController; |