Ghost/ghost/admin/app/components/gh-user-active.js

32 lines
744 B
JavaScript
Raw Normal View History

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