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 56e9f09277 Update user image styles
Related to #4844

The newly added user image in the content list uses a CSS property to
crop `img` tags, but it's not supported in IE or Firefox. This issue
corrects that by chancing them to be background images which can be
cropped cross-browser.

It also adjusts the nav bar user image (previously an `img` tag) which
would squash a non-square image.

Also removes the border around the settings/users/ user images, to be
consistent with the rest of the UI.
2015-01-29 11:34:14 +00:00

33 lines
1.2 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');
}),
authorAvatarBackground: Ember.computed('authorAvatar', function () {
return 'background-image: url(' + this.get('authorAvatar') + ')';
}),
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;