1
0
mirror of https://github.com/flarum/core.git synced 2025-10-12 07:24:27 +02:00

Massive JavaScript cleanup

- Use JSX for templates
- Docblock/comment everything
- Mostly passes ESLint (still some work to do)
- Lots of renaming, refactoring, etc.

CSS hasn't been updated yet.
This commit is contained in:
Toby Zerner
2015-07-15 14:00:11 +09:30
parent 4480e0a83f
commit ab6c03c0cc
220 changed files with 9785 additions and 5919 deletions

View File

@@ -0,0 +1,51 @@
import Post from 'flarum/components/Post';
import usernameHelper from 'flarum/helpers/username';
import icon from 'flarum/helpers/icon';
/**
* The `EventPost` component displays a post which indicating a discussion
* event, like a discussion being renamed or stickied. Subclasses must implement
* the `icon` and `description` methods.
*
* ### Props
*
* - All of the props for `Post`
*
* @abstract
*/
export default class EventPost extends Post {
attrs() {
return {
className: 'event-post ' + this.props.post.contentType() + '-post'
};
}
content() {
const user = this.props.post.user();
const username = usernameHelper(user);
return [
icon(this.icon(), {className: 'event-post-icon'}),
<div class="event-post-info">
{user ? <a className="post-user" href={app.route.user(user)} config={m.route}>{username}</a> : username}
{this.description()}
</div>
];
}
/**
* Get the name of the event icon.
*
* @return {String}
*/
icon() {
}
/**
* Get the description of the event.
*
* @return {VirtualElement}
*/
description() {
}
}