2015-06-13 09:34:09 -05:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
const {Component, computed, inject} = Ember;
|
|
|
|
|
|
|
|
export default Component.extend({
|
2015-06-13 09:34:09 -05:00
|
|
|
tagName: '',
|
|
|
|
|
|
|
|
user: null,
|
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
ghostPaths: inject.service('ghost-paths'),
|
2015-06-13 09:34:09 -05:00
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
userDefault: computed('ghostPaths', function () {
|
2015-06-13 09:34:09 -05:00
|
|
|
return this.get('ghostPaths.url').asset('/shared/img/user-image.png');
|
|
|
|
}),
|
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
userImageBackground: computed('user.image', 'userDefault', function () {
|
|
|
|
let url = this.get('user.image') || this.get('userDefault');
|
2015-06-13 09:34:09 -05:00
|
|
|
|
2015-11-20 17:45:43 -05:00
|
|
|
return Ember.String.htmlSafe(`background-image: url(${url})`);
|
2015-06-13 09:34:09 -05:00
|
|
|
}),
|
|
|
|
|
2015-10-28 11:36:45 +00:00
|
|
|
lastLogin: computed('user.last_login', function () {
|
|
|
|
let lastLogin = this.get('user.last_login');
|
2015-06-13 09:34:09 -05:00
|
|
|
|
|
|
|
return lastLogin ? lastLogin.fromNow() : '(Never)';
|
|
|
|
})
|
|
|
|
});
|