Show badges in notifications

This commit is contained in:
Toby Zerner 2015-06-26 12:09:28 +09:30
parent fa094102d6
commit 1e592f544d
2 changed files with 24 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import Component from 'flarum/component';
import avatar from 'flarum/helpers/avatar';
import icon from 'flarum/helpers/icon';
import username from 'flarum/helpers/username';
import listItems from 'flarum/helpers/list-items';
import DropdownButton from 'flarum/components/dropdown-button';
import ActionButton from 'flarum/components/action-button';
import ItemList from 'flarum/utils/item-list';
@ -49,11 +50,18 @@ export default class NotificationList extends Component {
]),
m('div.notifications-content', groups.length
? groups.map(group => {
var badges = group.discussion && group.discussion.badges().toArray();
return m('div.notification-group', [
group.discussion ? m('a.notification-group-header', {
href: app.route.discussion(group.discussion),
config: m.route
}, group.discussion.title()) : m('div.notification-group-header', app.config['forum_title']),
group.discussion
? m('a.notification-group-header', {
href: app.route.discussion(group.discussion),
config: m.route
},
badges && badges.length ? m('ul.badges', listItems(badges)) : '',
group.discussion.title()
)
: m('div.notification-group-header', app.config['forum_title']),
m('ul.notification-group-list', group.notifications.map(notification => {
var NotificationComponent = app.notificationComponentRegistry[notification.contentType()];
return NotificationComponent ? m('li', NotificationComponent.component({notification})) : '';

View File

@ -84,6 +84,18 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
& .badges {
margin-left: -2px;
margin-right: 18px;
vertical-align: 1px;
& .badge {
margin-right: -13px;
position: relative;
.badge-size(21px);
}
}
}
.notification-group-list {
list-style: none;