From efeb236feb46cf44e038710a0307e49f69a4ddf0 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 5 May 2015 17:30:18 +0930 Subject: [PATCH] Change notification type components to be like post types --- .../notification-discussion-renamed.js | 29 ++++++++----------- js/forum/src/components/notification.js | 19 ++++++++---- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/js/forum/src/components/notification-discussion-renamed.js b/js/forum/src/components/notification-discussion-renamed.js index fe402d91f..bbc2b3a78 100644 --- a/js/forum/src/components/notification-discussion-renamed.js +++ b/js/forum/src/components/notification-discussion-renamed.js @@ -1,26 +1,21 @@ 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'; export default class NotificationDiscussionRenamed extends Notification { - content() { + view() { var notification = this.props.notification; var discussion = notification.subject(); - return m('a', {href: app.route('discussion.near', { - id: discussion.id(), - slug: discussion.slug(), - near: notification.content().number - }), config: m.route}, [ - avatar(notification.sender()), - m('h3.notification-title', notification.content().oldTitle), - m('div.notification-info', [ - icon('pencil'), - ' Renamed by ', username(notification.sender()), - ' ', humanTime(notification.time()) - ]) - ]); + return super.view({ + href: app.route('discussion.near', { + id: discussion.id(), + slug: discussion.slug(), + near: notification.content().number + }), + config: m.route, + title: notification.content().oldTitle, + icon: 'pencil', + content: ['Renamed by ', username(notification.sender())] + }); } } diff --git a/js/forum/src/components/notification.js b/js/forum/src/components/notification.js index a9b83fbda..34541ee8f 100644 --- a/js/forum/src/components/notification.js +++ b/js/forum/src/components/notification.js @@ -1,17 +1,24 @@ import Component from 'flarum/component'; +import avatar from 'flarum/helpers/avatar'; +import icon from 'flarum/helpers/icon'; +import humanTime from 'flarum/helpers/human-time'; export default class Notification extends Component { - view() { + view(args) { var notification = this.props.notification; return m('div.notification.notification-'+notification.contentType(), { classNames: !notification.isRead() ? 'unread' : '', onclick: this.read.bind(this) - }, this.content()); - } - - content() { - // + }, m('a', {href: args.href, config: args.config}, [ + avatar(notification.sender()), + m('h3.notification-title', args.title), + m('div.notification-info', [ + icon(args.icon), ' ', + args.content, ' ', + humanTime(notification.time()) + ]) + ])); } read() {