mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 03:59:39 +08:00
Update post/notification components
This commit is contained in:
parent
11804b3306
commit
7ec714af82
@ -1,28 +1,23 @@
|
||||
import Notification from 'flarum/components/notification';
|
||||
import avatar from 'flarum/helpers/avatar';
|
||||
import icon from 'flarum/helpers/icon';
|
||||
import username from 'flarum/helpers/username';
|
||||
import humanTime from 'flarum/helpers/human-time';
|
||||
import categoryLabel from 'categories/helpers/category-label';
|
||||
|
||||
export default class NotificationDiscussionMoved extends Notification {
|
||||
content() {
|
||||
view() {
|
||||
var notification = this.props.notification;
|
||||
var discussion = notification.subject();
|
||||
var category = discussion.category();
|
||||
|
||||
return m('a', {href: app.route('discussion.near', {
|
||||
id: discussion.id(),
|
||||
slug: discussion.slug(),
|
||||
near: notification.content().postNumber
|
||||
}), config: m.route}, [
|
||||
avatar(notification.sender()),
|
||||
m('h3.notification-title', discussion.title()),
|
||||
m('div.notification-info', [
|
||||
icon('arrow-right'),
|
||||
' Moved to ', categoryLabel(category), ' by ', username(notification.sender()),
|
||||
' ', humanTime(notification.time())
|
||||
])
|
||||
]);
|
||||
return super.view({
|
||||
href: app.route('discussion.near', {
|
||||
id: discussion.id(),
|
||||
slug: discussion.slug(),
|
||||
near: notification.content().postNumber
|
||||
}),
|
||||
config: m.route,
|
||||
title: discussion.title(),
|
||||
icon: 'arrow-right',
|
||||
content: ['Moved to ', categoryLabel(category), ' by ', username(notification.sender())]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,6 @@ export default class PostDiscussionMoved extends PostActivity {
|
||||
var oldCategory = app.store.getById('categories', post.content()[0]);
|
||||
var newCategory = app.store.getById('categories', post.content()[1]);
|
||||
|
||||
return super.view(['moved the discussion from ', categoryLabel(oldCategory), ' to ', categoryLabel(newCategory), '.'], {
|
||||
className: 'post-discussion-moved',
|
||||
icon: 'arrow-right'
|
||||
});
|
||||
return super.view('arrow-right', ['moved the discussion from ', categoryLabel(oldCategory), ' to ', categoryLabel(newCategory), '.']);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user