diff --git a/framework/core/js/forum/src/components/activity-post.js b/framework/core/js/forum/src/components/activity-post.js deleted file mode 100644 index 214304a80..000000000 --- a/framework/core/js/forum/src/components/activity-post.js +++ /dev/null @@ -1,38 +0,0 @@ -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 ActivityPost 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.activity-post', {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; - } -} diff --git a/framework/core/js/forum/src/components/post-comment.js b/framework/core/js/forum/src/components/comment-post.js similarity index 91% rename from framework/core/js/forum/src/components/post-comment.js rename to framework/core/js/forum/src/components/comment-post.js index be75b83e9..b846bb5c5 100644 --- a/framework/core/js/forum/src/components/post-comment.js +++ b/framework/core/js/forum/src/components/comment-post.js @@ -4,7 +4,7 @@ import PostHeaderUser from 'flarum/components/post-header-user'; import PostHeaderMeta from 'flarum/components/post-header-meta'; import PostHeaderEdited from 'flarum/components/post-header-edited'; import PostHeaderToggle from 'flarum/components/post-header-toggle'; -import ComposerEdit from 'flarum/components/composer-edit'; +import EditComposer from 'flarum/components/edit-composer'; import Composer from 'flarum/components/composer'; import ItemList from 'flarum/utils/item-list'; import listItems from 'flarum/helpers/list-items'; @@ -14,7 +14,7 @@ import listItems from 'flarum/helpers/list-items'; (controls, header, and footer) surrounding the post's HTML content. Allows the post to be edited with the composer, hidden, or restored. */ -export default class PostComment extends Post { +export default class CommentPost extends Post { constructor(props) { super(props); @@ -32,11 +32,11 @@ export default class PostComment extends Post { m('aside.post-actions', m('ul', listItems(this.actionItems().toArray()))) ], { className: classList({ - 'post-comment': true, + 'comment-post': true, 'is-hidden': post.isHidden(), 'is-edited': post.isEdited(), 'reveal-content': this.revealContent, - 'editing': app.composer.component instanceof ComposerEdit && + 'editing': app.composer.component instanceof EditComposer && app.composer.component.props.post === this.props.post && app.composer.position() !== Composer.PositionEnum.MINIMIZED }) diff --git a/framework/core/js/forum/src/components/composer-discussion.js b/framework/core/js/forum/src/components/discussion-composer.js similarity index 97% rename from framework/core/js/forum/src/components/composer-discussion.js rename to framework/core/js/forum/src/components/discussion-composer.js index 93d5ee8b6..99a9ad0ea 100644 --- a/framework/core/js/forum/src/components/composer-discussion.js +++ b/framework/core/js/forum/src/components/discussion-composer.js @@ -8,7 +8,7 @@ import ActionButton from 'flarum/components/action-button'; control so the user can enter the title of their discussion. Also overrides the `submit` and `willExit` actions to account for the title. */ -export default class ComposerDiscussion extends ComposerBody { +export default class DiscussionComposer extends ComposerBody { constructor(props) { props.placeholder = props.placeholder || 'Write a post...'; props.submitLabel = props.submitLabel || 'Post Discussion'; diff --git a/framework/core/js/forum/src/components/discussion-page.js b/framework/core/js/forum/src/components/discussion-page.js index 3d9a844f9..d6a475e0a 100644 --- a/framework/core/js/forum/src/components/discussion-page.js +++ b/framework/core/js/forum/src/components/discussion-page.js @@ -5,7 +5,7 @@ import DiscussionList from 'flarum/components/discussion-list'; import DiscussionHero from 'flarum/components/discussion-hero'; import StreamContent from 'flarum/components/stream-content'; import StreamScrubber from 'flarum/components/stream-scrubber'; -import ComposerReply from 'flarum/components/composer-reply'; +import ReplyComposer from 'flarum/components/reply-composer'; import ActionButton from 'flarum/components/action-button'; import LoadingIndicator from 'flarum/components/loading-indicator'; import DropdownSplit from 'flarum/components/dropdown-split'; diff --git a/framework/core/js/forum/src/components/notification-discussion-renamed.js b/framework/core/js/forum/src/components/discussion-renamed-notification.js similarity index 85% rename from framework/core/js/forum/src/components/notification-discussion-renamed.js rename to framework/core/js/forum/src/components/discussion-renamed-notification.js index 02bec5566..77290a1da 100644 --- a/framework/core/js/forum/src/components/notification-discussion-renamed.js +++ b/framework/core/js/forum/src/components/discussion-renamed-notification.js @@ -1,7 +1,7 @@ import Notification from 'flarum/components/notification'; import username from 'flarum/helpers/username'; -export default class NotificationDiscussionRenamed extends Notification { +export default class DiscussionRenamedNotification extends Notification { view() { var notification = this.props.notification; diff --git a/framework/core/js/forum/src/components/post-discussion-renamed.js b/framework/core/js/forum/src/components/discussion-renamed-post.js similarity index 68% rename from framework/core/js/forum/src/components/post-discussion-renamed.js rename to framework/core/js/forum/src/components/discussion-renamed-post.js index b54675109..fbf912241 100644 --- a/framework/core/js/forum/src/components/post-discussion-renamed.js +++ b/framework/core/js/forum/src/components/discussion-renamed-post.js @@ -1,6 +1,6 @@ -import PostActivity from 'flarum/components/post-activity'; +import EventPost from 'flarum/components/event-post'; -export default class PostDiscussionRenamed extends PostActivity { +export default class DiscussionRenamedPost extends EventPost { view() { var post = this.props.post; var oldTitle = post.content()[0]; diff --git a/framework/core/js/forum/src/components/composer-edit.js b/framework/core/js/forum/src/components/edit-composer.js similarity index 96% rename from framework/core/js/forum/src/components/composer-edit.js rename to framework/core/js/forum/src/components/edit-composer.js index 3f1695fba..bd1bb495c 100644 --- a/framework/core/js/forum/src/components/composer-edit.js +++ b/framework/core/js/forum/src/components/edit-composer.js @@ -8,7 +8,7 @@ import ActionButton from 'flarum/components/action-button'; content of the post that is being edited, and adds a title control to indicate which post is being edited. */ -export default class ComposerEdit extends ComposerBody { +export default class EditComposer extends ComposerBody { constructor(props) { props.submitLabel = props.submitLabel || 'Save Changes'; props.confirmExit = props.confirmExit || 'You have not saved your changes. Do you wish to discard them?'; diff --git a/framework/core/js/forum/src/components/post-activity.js b/framework/core/js/forum/src/components/event-post.js similarity index 69% rename from framework/core/js/forum/src/components/post-activity.js rename to framework/core/js/forum/src/components/event-post.js index db71254af..f22852e18 100644 --- a/framework/core/js/forum/src/components/post-activity.js +++ b/framework/core/js/forum/src/components/event-post.js @@ -4,20 +4,20 @@ 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 { +export default class EventPost extends Post { view(iconName, content, attrs) { var post = this.props.post; attrs = attrs || {}; - attrs.className = 'post-activity post-'+dasherize(post.contentType())+' '+(attrs.className || ''); + attrs.className = 'event-post post-'+dasherize(post.contentType())+' '+(attrs.className || ''); return super.view([ icon(iconName+' post-icon'), - m('div.post-activity-info', [ + m('div.event-post-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())) + m('div.event-post-time', humanTime(post.time())) ], attrs); } } diff --git a/framework/core/js/forum/src/components/index-page.js b/framework/core/js/forum/src/components/index-page.js index 1ac471c69..87e0459bb 100644 --- a/framework/core/js/forum/src/components/index-page.js +++ b/framework/core/js/forum/src/components/index-page.js @@ -6,7 +6,7 @@ import mixin from 'flarum/utils/mixin'; import DiscussionList from 'flarum/components/discussion-list'; import WelcomeHero from 'flarum/components/welcome-hero'; -import ComposerDiscussion from 'flarum/components/composer-discussion'; +import DiscussionComposer from 'flarum/components/discussion-composer'; import LoginModal from 'flarum/components/login-modal'; import DiscussionPage from 'flarum/components/discussion-page'; @@ -148,7 +148,7 @@ export default class IndexPage extends Component { newDiscussion() { if (app.session.user()) { - app.composer.load(new ComposerDiscussion({ user: app.session.user() })); + app.composer.load(new DiscussionComposer({ user: app.session.user() })); app.composer.show(); return true; } else { diff --git a/framework/core/js/forum/src/components/activity-join.js b/framework/core/js/forum/src/components/join-activity.js similarity index 88% rename from framework/core/js/forum/src/components/activity-join.js rename to framework/core/js/forum/src/components/join-activity.js index 048c295d1..bce3ee5bf 100644 --- a/framework/core/js/forum/src/components/activity-join.js +++ b/framework/core/js/forum/src/components/join-activity.js @@ -2,7 +2,7 @@ import Component from 'flarum/component'; import humanTime from 'flarum/helpers/human-time'; import avatar from 'flarum/helpers/avatar'; -export default class ActivityJoin extends Component { +export default class JoinActivity extends Component { view() { var activity = this.props.activity; var user = activity.user(); diff --git a/framework/core/js/forum/src/components/composer-reply.js b/framework/core/js/forum/src/components/reply-composer.js similarity index 96% rename from framework/core/js/forum/src/components/composer-reply.js rename to framework/core/js/forum/src/components/reply-composer.js index 3b8b3eeab..55039bc57 100644 --- a/framework/core/js/forum/src/components/composer-reply.js +++ b/framework/core/js/forum/src/components/reply-composer.js @@ -4,7 +4,7 @@ import Alert from 'flarum/components/alert'; import ActionButton from 'flarum/components/action-button'; import Composer from 'flarum/components/composer'; -export default class ComposerReply extends ComposerBody { +export default class ReplyComposer extends ComposerBody { constructor(props) { props.placeholder = props.placeholder || 'Write your reply...'; props.submitLabel = props.submitLabel || 'Post Reply'; @@ -14,7 +14,7 @@ export default class ComposerReply extends ComposerBody { } view() { - return super.view('composer-reply'); + return super.view('reply-composer'); } headerItems() { diff --git a/framework/core/js/forum/src/components/user-page.js b/framework/core/js/forum/src/components/user-page.js index 47ccbb2be..e3be133a4 100644 --- a/framework/core/js/forum/src/components/user-page.js +++ b/framework/core/js/forum/src/components/user-page.js @@ -5,7 +5,7 @@ import DiscussionList from 'flarum/components/discussion-list'; import StreamContent from 'flarum/components/stream-content'; import StreamScrubber from 'flarum/components/stream-scrubber'; import UserCard from 'flarum/components/user-card'; -import ComposerReply from 'flarum/components/composer-reply'; +import ReplyComposer from 'flarum/components/reply-composer'; import ActionButton from 'flarum/components/action-button'; import LoadingIndicator from 'flarum/components/loading-indicator'; import DropdownSplit from 'flarum/components/dropdown-split'; diff --git a/framework/core/js/forum/src/initializers/components.js b/framework/core/js/forum/src/initializers/components.js index 8fa216c92..92cb63ab8 100644 --- a/framework/core/js/forum/src/initializers/components.js +++ b/framework/core/js/forum/src/initializers/components.js @@ -1,21 +1,21 @@ -import PostComment from 'flarum/components/post-comment'; -import PostDiscussionRenamed from 'flarum/components/post-discussion-renamed'; -import ActivityPost from 'flarum/components/activity-post'; -import ActivityJoin from 'flarum/components/activity-join'; -import NotificationDiscussionRenamed from 'flarum/components/notification-discussion-renamed'; +import CommentPost from 'flarum/components/comment-post'; +import DiscussionRenamedPost from 'flarum/components/discussion-renamed-post'; +import PostActivity from 'flarum/components/post-activity'; +import JoinActivity from 'flarum/components/join-activity'; +import DiscussionRenamedNotification from 'flarum/components/discussion-renamed-notification'; export default function(app) { app.postComponentRegistry = { - comment: PostComment, - discussionRenamed: PostDiscussionRenamed + comment: CommentPost, + discussionRenamed: DiscussionRenamedPost }; app.activityComponentRegistry = { - post: ActivityPost, - join: ActivityJoin + post: PostActivity, + join: JoinActivity }; app.notificationComponentRegistry = { - discussionRenamed: NotificationDiscussionRenamed + discussionRenamed: DiscussionRenamedNotification }; } diff --git a/framework/core/js/forum/src/initializers/discussion-controls.js b/framework/core/js/forum/src/initializers/discussion-controls.js index f57b85222..b2cb324aa 100644 --- a/framework/core/js/forum/src/initializers/discussion-controls.js +++ b/framework/core/js/forum/src/initializers/discussion-controls.js @@ -1,6 +1,6 @@ import Discussion from 'flarum/models/discussion'; import DiscussionPage from 'flarum/components/discussion-page'; -import ComposerReply from 'flarum/components/composer-reply'; +import ReplyComposer from 'flarum/components/reply-composer'; import LoginModal from 'flarum/components/login-modal'; import ActionButton from 'flarum/components/action-button'; import Separator from 'flarum/components/separator'; @@ -13,8 +13,8 @@ export default function(app) { app.current.streamContent.goToLast(); } var component = app.composer.component; - if (!(component instanceof ComposerReply) || component.props.discussion !== this || component.props.user !== app.session.user() || forceRefresh) { - component = new ComposerReply({ + if (!(component instanceof ReplyComposer) || component.props.discussion !== this || component.props.user !== app.session.user() || forceRefresh) { + component = new ReplyComposer({ user: app.session.user(), discussion: this }); diff --git a/framework/core/js/forum/src/initializers/post-controls.js b/framework/core/js/forum/src/initializers/post-controls.js index 925759643..384df6ecc 100644 --- a/framework/core/js/forum/src/initializers/post-controls.js +++ b/framework/core/js/forum/src/initializers/post-controls.js @@ -1,13 +1,13 @@ import Post from 'flarum/models/post'; import DiscussionPage from 'flarum/components/discussion-page'; -import ComposerEdit from 'flarum/components/composer-edit'; +import EditComposer from 'flarum/components/edit-composer'; import ActionButton from 'flarum/components/action-button'; import Separator from 'flarum/components/separator'; import ItemList from 'flarum/utils/item-list'; export default function(app) { function editAction() { - app.composer.load(new ComposerEdit({ post: this })); + app.composer.load(new EditComposer({ post: this })); app.composer.show(); } diff --git a/framework/core/less/forum/discussion.less b/framework/core/less/forum/discussion.less index 97c3ed079..8c4132afa 100644 --- a/framework/core/less/forum/discussion.less +++ b/framework/core/less/forum/discussion.less @@ -329,7 +329,7 @@ .post-icon { float: left; } -.post-activity { +.event-post { &, & a { color: @fl-body-muted-color; } @@ -337,11 +337,11 @@ font-weight: bold; } } -.post-activity-info { +.event-post-info { font-size: 15px; margin-bottom: 5px; } -.post-discussion-renamed { +.discussion-renamed-post { & .old-title, & .new-title { font-weight: normal; font-style: italic; @@ -439,7 +439,7 @@ } } } - .post-activity { + .event-post { padding-left: 30px; } .post-icon { diff --git a/framework/core/less/forum/user.less b/framework/core/less/forum/user.less index 5c9854678..374028467 100644 --- a/framework/core/less/forum/user.less +++ b/framework/core/less/forum/user.less @@ -162,7 +162,7 @@ } } } -.activity-post { +.post-activity { overflow: hidden; & .title {