mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 11:54:33 +03:00
9833b96e3e
no issue - ember-cli's asset rewriting was not picking up the asset URLs when they were directly embedded in a template string, fix is to ensure the image location is unambiguous by assigning it to a variable first
35 lines
1023 B
JavaScript
35 lines
1023 B
JavaScript
import Component from '@ember/component';
|
|
import Ember from 'ember';
|
|
import moment from 'moment';
|
|
import {computed} from '@ember/object';
|
|
import {htmlSafe} from '@ember/string';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
const {Handlebars} = Ember;
|
|
|
|
export default Component.extend({
|
|
ghostPaths: service(),
|
|
|
|
tagName: '',
|
|
|
|
user: null,
|
|
|
|
userDefault: computed('ghostPaths', function () {
|
|
let image = '/img/user-image.png';
|
|
return `${this.get('ghostPaths.assetRoot')}${image}`;
|
|
}),
|
|
|
|
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)';
|
|
})
|
|
});
|