mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 11:54:33 +03:00
5e5003126c
closes https://github.com/TryGhost/Ghost/issues/8389 - changed `user.image` to `user.profileImage`
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import Ember from 'ember';
|
|
import Component from 'ember-component';
|
|
import computed from 'ember-computed';
|
|
import injectService from 'ember-service/inject';
|
|
import {htmlSafe} from 'ember-string';
|
|
import moment from 'moment';
|
|
|
|
// ember-cli-shims doesn't export these
|
|
const {Handlebars} = Ember;
|
|
|
|
export default Component.extend({
|
|
tagName: '',
|
|
|
|
user: null,
|
|
|
|
ghostPaths: injectService(),
|
|
|
|
userDefault: computed('ghostPaths', function () {
|
|
return `${this.get('ghostPaths.assetRoot')}/img/user-image.png`;
|
|
}),
|
|
|
|
userImageBackground: computed('user.profileImage', 'userDefault', function () {
|
|
let url = this.get('user.profileImage') || this.get('userDefault');
|
|
let safeUrl = Handlebars.Utils.escapeExpression(url);
|
|
|
|
return htmlSafe(`background-image: url(${safeUrl})`);
|
|
}),
|
|
|
|
lastLoginUTC: computed('user.lastLoginUTC', function () {
|
|
let lastLoginUTC = this.get('user.lastLoginUTC');
|
|
|
|
return lastLoginUTC ? moment(lastLoginUTC).fromNow() : '(Never)';
|
|
})
|
|
});
|