2014-03-04 00:18:10 +04:00
|
|
|
var PostController = Ember.ObjectController.extend({
|
2014-05-31 22:32:22 +04:00
|
|
|
isPublished: Ember.computed.equal('status', 'published'),
|
2014-06-16 09:44:07 +04:00
|
|
|
classNameBindings: ['featured'],
|
2014-05-21 17:53:00 +04:00
|
|
|
|
2014-04-20 18:48:34 +04:00
|
|
|
actions: {
|
2014-05-09 09:00:10 +04:00
|
|
|
toggleFeatured: function () {
|
2014-07-15 08:02:34 +04:00
|
|
|
var options = {disableNProgress: true},
|
2014-06-16 09:44:07 +04:00
|
|
|
self = this;
|
2014-05-09 09:00:10 +04:00
|
|
|
|
2014-07-15 08:02:34 +04:00
|
|
|
this.toggleProperty('featured');
|
|
|
|
this.get('model').save(options).catch(function (errors) {
|
2014-06-21 01:36:44 +04:00
|
|
|
self.notifications.showErrors(errors);
|
2014-06-16 09:44:07 +04:00
|
|
|
});
|
2014-09-10 05:22:11 +04:00
|
|
|
},
|
|
|
|
showPostContent: function () {
|
2014-09-16 08:55:37 +04:00
|
|
|
this.transitionToRoute('posts.post', this.get('model'));
|
2014-04-20 18:48:34 +04:00
|
|
|
}
|
|
|
|
}
|
2014-03-04 00:18:10 +04:00
|
|
|
});
|
|
|
|
|
2014-06-30 01:45:03 +04:00
|
|
|
export default PostController;
|