mirror of
https://github.com/flarum/core.git
synced 2025-07-29 04:30:56 +02:00
Show badges in notifications
This commit is contained in:
@@ -2,6 +2,7 @@ import Component from 'flarum/component';
|
|||||||
import avatar from 'flarum/helpers/avatar';
|
import avatar from 'flarum/helpers/avatar';
|
||||||
import icon from 'flarum/helpers/icon';
|
import icon from 'flarum/helpers/icon';
|
||||||
import username from 'flarum/helpers/username';
|
import username from 'flarum/helpers/username';
|
||||||
|
import listItems from 'flarum/helpers/list-items';
|
||||||
import DropdownButton from 'flarum/components/dropdown-button';
|
import DropdownButton from 'flarum/components/dropdown-button';
|
||||||
import ActionButton from 'flarum/components/action-button';
|
import ActionButton from 'flarum/components/action-button';
|
||||||
import ItemList from 'flarum/utils/item-list';
|
import ItemList from 'flarum/utils/item-list';
|
||||||
@@ -49,11 +50,18 @@ export default class NotificationList extends Component {
|
|||||||
]),
|
]),
|
||||||
m('div.notifications-content', groups.length
|
m('div.notifications-content', groups.length
|
||||||
? groups.map(group => {
|
? groups.map(group => {
|
||||||
|
var badges = group.discussion && group.discussion.badges().toArray();
|
||||||
|
|
||||||
return m('div.notification-group', [
|
return m('div.notification-group', [
|
||||||
group.discussion ? m('a.notification-group-header', {
|
group.discussion
|
||||||
href: app.route.discussion(group.discussion),
|
? m('a.notification-group-header', {
|
||||||
config: m.route
|
href: app.route.discussion(group.discussion),
|
||||||
}, group.discussion.title()) : m('div.notification-group-header', app.config['forum_title']),
|
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 => {
|
m('ul.notification-group-list', group.notifications.map(notification => {
|
||||||
var NotificationComponent = app.notificationComponentRegistry[notification.contentType()];
|
var NotificationComponent = app.notificationComponentRegistry[notification.contentType()];
|
||||||
return NotificationComponent ? m('li', NotificationComponent.component({notification})) : '';
|
return NotificationComponent ? m('li', NotificationComponent.component({notification})) : '';
|
||||||
|
@@ -84,6 +84,18 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
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 {
|
.notification-group-list {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
Reference in New Issue
Block a user