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