mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 11:54:33 +03:00
cf36851265
replaces #41, #60 - update ember-suave and grunt-jscs to 3.0 - standardize Ember global de-structuring rules across app & tests
33 lines
761 B
JavaScript
33 lines
761 B
JavaScript
import Ember from 'ember';
|
|
|
|
const {
|
|
Component,
|
|
computed,
|
|
inject: {service},
|
|
String: {htmlSafe}
|
|
} = Ember;
|
|
|
|
export default Component.extend({
|
|
tagName: '',
|
|
|
|
user: null,
|
|
|
|
ghostPaths: service(),
|
|
|
|
userDefault: computed('ghostPaths', function () {
|
|
return `${this.get('ghostPaths.subdir')}/ghost/img/user-image.png`;
|
|
}),
|
|
|
|
userImageBackground: computed('user.image', 'userDefault', function () {
|
|
let url = this.get('user.image') || this.get('userDefault');
|
|
|
|
return htmlSafe(`background-image: url(${url})`);
|
|
}),
|
|
|
|
lastLogin: computed('user.lastLogin', function () {
|
|
let lastLogin = this.get('user.lastLogin');
|
|
|
|
return lastLogin ? moment(lastLogin).fromNow() : '(Never)';
|
|
})
|
|
});
|