From 9befc68ea3b5a2ff37b27ca0433ab64c6d4a7e51 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 18 May 2015 18:50:43 +0930 Subject: [PATCH] GitHub for Mac sucks, why does it leave out a file sometimes? --- .../js/forum/src/components/post-activity.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 framework/core/js/forum/src/components/post-activity.js diff --git a/framework/core/js/forum/src/components/post-activity.js b/framework/core/js/forum/src/components/post-activity.js new file mode 100644 index 000000000..8cbf66263 --- /dev/null +++ b/framework/core/js/forum/src/components/post-activity.js @@ -0,0 +1,38 @@ +import Component from 'flarum/component'; +import humanTime from 'flarum/helpers/human-time'; +import avatar from 'flarum/helpers/avatar'; +import listItems from 'flarum/helpers/list-items'; +import ItemList from 'flarum/utils/item-list'; + +export default class PostActivity extends Component { + view() { + var activity = this.props.activity; + var user = activity.user(); + var post = activity.post(); + var discussion = post.discussion(); + + return m('div', [ + avatar(user, {className: 'activity-icon'}), + m('div.activity-info', [ + m('strong', post.number() == 1 ? 'Started a discussion' : 'Posted a reply'), + humanTime(activity.time()) + ]), + m('a.activity-content.post-activity', {href: app.route('discussion.near', { + id: discussion.id(), + slug: discussion.slug(), + near: post.number() + }), config: m.route}, [ + m('ul.list-inline', listItems(this.headerItems().toArray())), + m('div.body', m.trust(post.contentHtml())) + ]) + ]); + } + + headerItems() { + var items = new ItemList(); + + items.add('title', m('h3.title', this.props.activity.post().discussion().title())); + + return items; + } +}