mirror of
https://github.com/flarum/framework.git
synced 2025-05-22 14:49:57 +08:00
24 lines
812 B
JavaScript
24 lines
812 B
JavaScript
import Post from 'flarum/components/post';
|
|
import username from 'flarum/helpers/username';
|
|
import icon from 'flarum/helpers/icon';
|
|
import humanTime from 'flarum/utils/human-time';
|
|
import { dasherize } from 'flarum/utils/string';
|
|
|
|
export default class PostActivity extends Post {
|
|
view(iconName, content, attrs) {
|
|
var post = this.props.post;
|
|
|
|
attrs = attrs || {};
|
|
attrs.className = 'post-activity post-'+dasherize(post.contentType())+' '+(attrs.className || '');
|
|
|
|
return super.view([
|
|
icon(iconName+' post-icon'),
|
|
m('div.post-activity-info', [
|
|
m('a.post-user', {href: app.route('user', { username: post.user().username() }), config: m.route}, username(post.user())), ' ',
|
|
content
|
|
]),
|
|
m('div.post-activity-time', humanTime(post.time()))
|
|
], attrs);
|
|
}
|
|
}
|