0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/client/app/components/gh-user-active.js

32 lines
742 B
JavaScript
Raw Normal View History

import Ember from 'ember';
2016-01-19 07:03:27 -06:00
const {
Component,
computed,
inject: {service}
} = Ember;
export default Component.extend({
tagName: '',
user: null,
2016-01-19 07:03:27 -06:00
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');
2015-11-20 17:45:43 -05:00
return Ember.String.htmlSafe(`background-image: url(${url})`);
}),
lastLogin: computed('user.lastLogin', function () {
let lastLogin = this.get('user.lastLogin');
return lastLogin ? lastLogin.fromNow() : '(Never)';
})
});