framework/ember/app/models/user.js

32 lines
773 B
JavaScript
Raw Normal View History

2014-12-20 14:26:46 +08:00
import DS from 'ember-data';
import HasItemLists from 'flarum/mixins/has-item-lists';
2015-02-13 09:15:14 +08:00
import stringToColor from 'flarum/utils/string-to-color';
export default DS.Model.extend(HasItemLists, {
itemLists: ['badges'],
username: DS.attr('string'),
email: DS.attr('string'),
password: DS.attr('string'),
avatarUrl: DS.attr('string'),
bio: DS.attr('string'),
bioHtml: DS.attr('string'),
2014-12-20 14:26:46 +08:00
groups: DS.hasMany('group'),
2014-12-20 14:26:46 +08:00
joinTime: DS.attr('date'),
lastSeenTime: DS.attr('date'),
readTime: DS.attr('date'),
2014-12-20 14:26:46 +08:00
discussionsCount: DS.attr('number'),
2015-03-12 10:29:32 +08:00
commentsCount: DS.attr('number'),
2014-12-20 14:26:46 +08:00
canEdit: DS.attr('boolean'),
2015-02-13 09:15:14 +08:00
canDelete: DS.attr('boolean'),
color: Ember.computed('username', function() {
2015-02-13 09:17:37 +08:00
return '#'+stringToColor(this.get('username'));
2015-02-13 09:15:14 +08:00
})
2014-12-20 14:26:46 +08:00
});