mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Ember.ObjectController (and Ember.ArrayController) will be deprecated in Ember 1.11 (and removed from core in Ember 2.0). The reasoning is detailed in the Ember 2.0 RFC. This PR does the following: * Updates templates/controllers/views to explicitly reference model properties (instead of relying on proxying behavior). * Clearly delineate where certain properties are being set or retrieved from (for example it was not clear exactly where `scratch` and `titleScratch` were stored). * Remove usage of `Ember.ObjectController`. * Add JSCS rule to prevent future PR's from adding regressions.
21 lines
657 B
JavaScript
21 lines
657 B
JavaScript
var PostController = Ember.Controller.extend({
|
|
isPublished: Ember.computed.equal('model.status', 'published'),
|
|
classNameBindings: ['model.featured'],
|
|
|
|
actions: {
|
|
toggleFeatured: function () {
|
|
var options = {disableNProgress: true},
|
|
self = this;
|
|
|
|
this.toggleProperty('model.featured');
|
|
this.get('model').save(options).catch(function (errors) {
|
|
self.notifications.showErrors(errors);
|
|
});
|
|
},
|
|
showPostContent: function () {
|
|
this.transitionToRoute('posts.post', this.get('model'));
|
|
}
|
|
}
|
|
});
|
|
|
|
export default PostController;
|