0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/controllers/posts/post.js
Paul Adam Davis d54af1b926 Update content list styles
Closes #4425

- Adds the author avatar (with defalt fallback)
- Shows author name when hovering the avatar (falls back to email address)
- Slightly adjusts type, colour, and spacing
2015-01-24 17:51:19 +00:00

29 lines
1 KiB
JavaScript

var PostController = Ember.Controller.extend({
isPublished: Ember.computed.equal('model.status', 'published'),
classNameBindings: ['model.featured'],
authorName: Ember.computed('model.author.name', 'model.author.email', function () {
return this.get('model.author.name') || this.get('model.author.email');
}),
authorAvatar: Ember.computed('model.author.image', function () {
return this.get('model.author.image') || this.get('ghostPaths.url').asset('/shared/img/user-image.png');
}),
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;