From 7ec714af82f2bcaa310073547ec992a934b53bcc Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 5 May 2015 17:31:42 +0930 Subject: [PATCH] Update post/notification components --- .../notification-discussion-moved.js | 29 ++++++++----------- .../src/components/post-discussion-moved.js | 5 +--- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/extensions/tags/js/src/components/notification-discussion-moved.js b/extensions/tags/js/src/components/notification-discussion-moved.js index 9e870f17c..de61cea58 100644 --- a/extensions/tags/js/src/components/notification-discussion-moved.js +++ b/extensions/tags/js/src/components/notification-discussion-moved.js @@ -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())] + }); } } diff --git a/extensions/tags/js/src/components/post-discussion-moved.js b/extensions/tags/js/src/components/post-discussion-moved.js index 3dd465829..de0b3380b 100644 --- a/extensions/tags/js/src/components/post-discussion-moved.js +++ b/extensions/tags/js/src/components/post-discussion-moved.js @@ -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), '.']); } }