Use GroupBadge component to display user badges

closes #277
This commit is contained in:
Toby Zerner 2015-08-31 13:44:05 +09:30
parent bb5c50d564
commit 6bad43e80b

View File

@ -5,7 +5,7 @@ import mixin from 'flarum/utils/mixin';
import stringToColor from 'flarum/utils/stringToColor';
import ItemList from 'flarum/utils/ItemList';
import computed from 'flarum/utils/computed';
import Badge from 'flarum/components/Badge';
import GroupBadge from 'flarum/components/GroupBadge';
export default class User extends mixin(Model, {
username: Model.attribute('username'),
@ -69,13 +69,7 @@ export default class User extends mixin(Model, {
groups.forEach(group => {
const name = group.nameSingular();
items.add('group' + group.id(),
Badge.component({
label: app.trans('core.group_' + name.toLowerCase(), undefined, name),
icon: group.icon(),
style: {backgroundColor: group.color()}
})
);
items.add('group' + group.id(), GroupBadge.component({group}));
});
}