1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/components/gh-user-active.js
Austin Burdine 2dff7edd3d convert remainder of components to use ember-cli-shims (#101)
follow up from #95
- converts components to use ember-cli-shims
2016-06-30 19:14:25 +01:00

28 lines
832 B
JavaScript

import Component from 'ember-component';
import computed from 'ember-computed';
import injectService from 'ember-service/inject';
import {htmlSafe} from 'ember-string';
export default Component.extend({
tagName: '',
user: null,
ghostPaths: injectService(),
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})`);
}),
lastLoginUTC: computed('user.lastLoginUTC', function () {
let lastLoginUTC = this.get('user.lastLoginUTC');
return lastLoginUTC ? moment(lastLoginUTC).fromNow() : '(Never)';
})
});