Update post/notification components

This commit is contained in:
Toby Zerner 2015-05-05 17:31:42 +09:30
parent 11804b3306
commit 7ec714af82
2 changed files with 13 additions and 21 deletions

View File

@ -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())]
});
}
}

View File

@ -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), '.']);
}
}