mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 07:09:57 +08:00
Merge branch 'master' into composer
This commit is contained in:
@ -62,7 +62,7 @@ export default class AvatarEditor extends Component {
|
||||
items.add('upload',
|
||||
Button.component({
|
||||
icon: 'upload',
|
||||
children: app.trans('core.user_avatar_upload_button'),
|
||||
children: app.trans('core.forum.user_avatar_upload_button'),
|
||||
onclick: this.upload.bind(this)
|
||||
})
|
||||
);
|
||||
@ -70,7 +70,7 @@ export default class AvatarEditor extends Component {
|
||||
items.add('remove',
|
||||
Button.component({
|
||||
icon: 'times',
|
||||
children: app.trans('core.user_avatar_remove_button'),
|
||||
children: app.trans('core.forum.user_avatar_remove_button'),
|
||||
onclick: this.remove.bind(this)
|
||||
})
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ export default class ChangeEmailModal extends Modal {
|
||||
}
|
||||
|
||||
title() {
|
||||
return app.trans('core.change_email_title');
|
||||
return app.trans('core.forum.change_email_title');
|
||||
}
|
||||
|
||||
content() {
|
||||
@ -37,10 +37,10 @@ export default class ChangeEmailModal extends Modal {
|
||||
return (
|
||||
<div className="Modal-body">
|
||||
<div className="Form Form--centered">
|
||||
<p className="helpText">{app.trans('core.change_email_confirmation_message', {email: <strong>{this.email()}</strong>})}</p>
|
||||
<p className="helpText">{app.trans('core.forum.change_email_confirmation_message', {email: <strong>{this.email()}</strong>})}</p>
|
||||
<div className="Form-group">
|
||||
<Button className="Button Button--primary Button--block" onclick={this.hide.bind(this)}>
|
||||
{app.trans('core.change_email_dismiss_button')}
|
||||
{app.trans('core.forum.change_email_dismiss_button')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@ -63,7 +63,7 @@ export default class ChangeEmailModal extends Modal {
|
||||
className: 'Button Button--primary Button--block',
|
||||
type: 'submit',
|
||||
loading: this.loading,
|
||||
children: app.trans('core.change_email_submit_button')
|
||||
children: app.trans('core.forum.change_email_submit_button')
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -11,20 +11,20 @@ export default class ChangePasswordModal extends Modal {
|
||||
}
|
||||
|
||||
title() {
|
||||
return app.trans('core.change_password_title');
|
||||
return app.trans('core.forum.change_password_title');
|
||||
}
|
||||
|
||||
content() {
|
||||
return (
|
||||
<div className="Modal-body">
|
||||
<div className="Form Form--centered">
|
||||
<p className="helpText">{app.trans('core.change_password_text')}</p>
|
||||
<p className="helpText">{app.trans('core.forum.change_password_text')}</p>
|
||||
<div className="Form-group">
|
||||
{Button.component({
|
||||
className: 'Button Button--primary Button--block',
|
||||
type: 'submit',
|
||||
loading: this.loading,
|
||||
children: app.trans('core.change_password_send_button')
|
||||
children: app.trans('core.forum.change_password_send_button')
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -460,28 +460,28 @@ class Composer extends Component {
|
||||
if (this.position === Composer.PositionEnum.FULLSCREEN) {
|
||||
items.add('exitFullScreen', ComposerButton.component({
|
||||
icon: 'compress',
|
||||
title: app.trans('core.composer_exit_full_screen_tooltip'),
|
||||
title: app.trans('core.forum.composer_exit_full_screen_tooltip'),
|
||||
onclick: this.exitFullScreen.bind(this)
|
||||
}));
|
||||
} else {
|
||||
if (this.position !== Composer.PositionEnum.MINIMIZED) {
|
||||
items.add('minimize', ComposerButton.component({
|
||||
icon: 'minus minimize',
|
||||
title: app.trans('core.composer_minimize_tooltip'),
|
||||
title: app.trans('core.forum.composer_minimize_tooltip'),
|
||||
onclick: this.minimize.bind(this),
|
||||
itemClassName: 'App-backControl'
|
||||
}));
|
||||
|
||||
items.add('fullScreen', ComposerButton.component({
|
||||
icon: 'expand',
|
||||
title: app.trans('core.composer_full_screen_tooltip'),
|
||||
title: app.trans('core.forum.composer_full_screen_tooltip'),
|
||||
onclick: this.fullScreen.bind(this)
|
||||
}));
|
||||
}
|
||||
|
||||
items.add('close', ComposerButton.component({
|
||||
icon: 'times',
|
||||
title: app.trans('core.composer_close_tooltip'),
|
||||
title: app.trans('core.forum.composer_close_tooltip'),
|
||||
onclick: this.close.bind(this)
|
||||
}));
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ export default class DiscussionComposer extends ComposerBody {
|
||||
static initProps(props) {
|
||||
super.initProps(props);
|
||||
|
||||
props.placeholder = props.placeholder || extractText(app.trans('core.composer_discussion_body_placeholder'));
|
||||
props.submitLabel = props.submitLabel || app.trans('core.composer_discussion_submit_button');
|
||||
props.confirmExit = props.confirmExit || extractText(app.trans('core.composer_discussion_discard_confirmation'));
|
||||
props.titlePlaceholder = props.titlePlaceholder || extractText(app.trans('core.composer_discussion_title_placeholder'));
|
||||
props.placeholder = props.placeholder || extractText(app.trans('core.forum.composer_discussion_body_placeholder'));
|
||||
props.submitLabel = props.submitLabel || app.trans('core.forum.composer_discussion_submit_button');
|
||||
props.confirmExit = props.confirmExit || extractText(app.trans('core.forum.composer_discussion_discard_confirmation'));
|
||||
props.titlePlaceholder = props.titlePlaceholder || extractText(app.trans('core.forum.composer_discussion_title_placeholder'));
|
||||
}
|
||||
|
||||
headerItems() {
|
||||
|
@ -48,7 +48,7 @@ export default class DiscussionList extends Component {
|
||||
loading = LoadingIndicator.component();
|
||||
} else if (this.moreResults) {
|
||||
loading = Button.component({
|
||||
children: app.trans('core.discussion_list_load_more_button'),
|
||||
children: app.trans('core.forum.discussion_list_load_more_button'),
|
||||
className: 'Button',
|
||||
onclick: this.loadMore.bind(this)
|
||||
});
|
||||
|
@ -87,7 +87,7 @@ export default class DiscussionListItem extends Component {
|
||||
<div className={'DiscussionListItem-content Slidable-content' + (isUnread ? ' unread' : '') + (isRead ? ' read' : '')}>
|
||||
<a href={startUser ? app.route.user(startUser) : '#'}
|
||||
className="DiscussionListItem-author"
|
||||
title={extractText(app.trans('core.discussion_list_started_text', {user: startUser, ago: humanTime(discussion.startTime())}))}
|
||||
title={extractText(app.trans('core.forum.discussion_list_started_text', {user: startUser, ago: humanTime(discussion.startTime())}))}
|
||||
config={function(element) {
|
||||
$(element).tooltip({placement: 'right'});
|
||||
m.route.apply(this, arguments);
|
||||
@ -108,7 +108,7 @@ export default class DiscussionListItem extends Component {
|
||||
|
||||
<span className="DiscussionListItem-count"
|
||||
onclick={this.markAsRead.bind(this)}
|
||||
title={showUnread ? app.trans('core.discussion_list_mark_as_read_tooltip') : ''}>
|
||||
title={showUnread ? app.trans('core.forum.discussion_list_mark_as_read_tooltip') : ''}>
|
||||
{abbreviateNumber(discussion[showUnread ? 'unreadCount' : 'repliesCount']())}
|
||||
</span>
|
||||
|
||||
|
@ -20,6 +20,6 @@ export default class DiscussionRenamedNotification extends Notification {
|
||||
}
|
||||
|
||||
content() {
|
||||
return app.trans('core.notifications_discussion_renamed_text', {user: this.props.notification.sender()});
|
||||
return app.trans('core.forum.notifications_discussion_renamed_text', {user: this.props.notification.sender()});
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ export default class DiscussionRenamedPost extends EventPost {
|
||||
}
|
||||
|
||||
descriptionKey() {
|
||||
return 'core.post_stream_discussion_renamed_text';
|
||||
return 'core.forum.post_stream_discussion_renamed_text';
|
||||
}
|
||||
|
||||
descriptionData() {
|
||||
|
@ -28,11 +28,11 @@ export default class DiscussionsSearchSource {
|
||||
const results = this.results[query] || [];
|
||||
|
||||
return [
|
||||
<li className="Dropdown-header">{app.trans('core.search_discussions_heading')}</li>,
|
||||
<li className="Dropdown-header">{app.trans('core.forum.search_discussions_heading')}</li>,
|
||||
<li>
|
||||
{LinkButton.component({
|
||||
icon: 'search',
|
||||
children: app.trans('core.search_all_discussions_button', {query}),
|
||||
children: app.trans('core.forum.search_all_discussions_button', {query}),
|
||||
href: app.route('index', {q: query})
|
||||
})}
|
||||
</li>,
|
||||
|
@ -23,8 +23,8 @@ export default class EditPostComposer extends ComposerBody {
|
||||
static initProps(props) {
|
||||
super.initProps(props);
|
||||
|
||||
props.submitLabel = props.submitLabel || app.trans('core.composer_edit_submit_button');
|
||||
props.confirmExit = props.confirmExit || app.trans('core.composer_edit_discard_confirmation');
|
||||
props.submitLabel = props.submitLabel || app.trans('core.forum.composer_edit_submit_button');
|
||||
props.confirmExit = props.confirmExit || app.trans('core.forum.composer_edit_discard_confirmation');
|
||||
props.originalContent = props.originalContent || props.post.content();
|
||||
props.user = props.user || props.post.user();
|
||||
|
||||
@ -39,7 +39,7 @@ export default class EditPostComposer extends ComposerBody {
|
||||
<h3>
|
||||
{icon('pencil')}{' '}
|
||||
<a href={app.route.discussion(post.discussion(), post.number())} config={m.route}>
|
||||
{app.trans('core.composer_edit_post_link', {number: post.number(), discussion: post.discussion().title()})}
|
||||
{app.trans('core.forum.composer_edit_post_link', {number: post.number(), discussion: post.discussion().title()})}
|
||||
</a>
|
||||
</h3>
|
||||
));
|
||||
|
@ -38,7 +38,7 @@ export default class EditUserModal extends Modal {
|
||||
<div className="Form">
|
||||
<div className="Form-group">
|
||||
<label>Username</label>
|
||||
<input className="FormControl" placeholder={extractText(app.trans('core.edit_user_username_label'))}
|
||||
<input className="FormControl" placeholder={extractText(app.trans('core.forum.edit_user_username_label'))}
|
||||
value={this.username()}
|
||||
onchange={m.withAttr('value', this.username)} />
|
||||
</div>
|
||||
@ -46,7 +46,7 @@ export default class EditUserModal extends Modal {
|
||||
<div className="Form-group">
|
||||
<label>Email</label>
|
||||
<div>
|
||||
<input className="FormControl" placeholder={extractText(app.trans('core.edit_user_email_label'))}
|
||||
<input className="FormControl" placeholder={extractText(app.trans('core.forum.edit_user_email_label'))}
|
||||
value={this.email()}
|
||||
onchange={m.withAttr('value', this.email)} />
|
||||
</div>
|
||||
@ -65,7 +65,7 @@ export default class EditUserModal extends Modal {
|
||||
Set new password
|
||||
</label>
|
||||
{this.setPassword() ? (
|
||||
<input className="FormControl" type="password" name="password" placeholder={extractText(app.trans('core.edit_user_password_label'))}
|
||||
<input className="FormControl" type="password" name="password" placeholder={extractText(app.trans('core.forum.edit_user_password_label'))}
|
||||
value={this.password()}
|
||||
onchange={m.withAttr('value', this.password)} />
|
||||
) : ''}
|
||||
@ -94,7 +94,7 @@ export default class EditUserModal extends Modal {
|
||||
className: 'Button Button--primary',
|
||||
type: 'submit',
|
||||
loading: this.loading,
|
||||
children: app.trans('core.edit_user_submit_button')
|
||||
children: app.trans('core.forum.edit_user_submit_button')
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -35,7 +35,7 @@ export default class ForgotPasswordModal extends Modal {
|
||||
}
|
||||
|
||||
title() {
|
||||
return app.trans('core.forgot_password_title');
|
||||
return app.trans('core.forum.forgot_password_title');
|
||||
}
|
||||
|
||||
content() {
|
||||
@ -43,10 +43,10 @@ export default class ForgotPasswordModal extends Modal {
|
||||
return (
|
||||
<div className="Modal-body">
|
||||
<div className="Form Form--centered">
|
||||
<p className="helpText">{app.trans('core.forgot_password_email_sent_message')}</p>
|
||||
<p className="helpText">{app.trans('core.forum.forgot_password_email_sent_message')}</p>
|
||||
<div className="Form-group">
|
||||
<Button className="Button Button--primary Button--block" onclick={this.hide.bind(this)}>
|
||||
{app.trans('core.forgot_password_dismiss_button')}
|
||||
{app.trans('core.forum.forgot_password_dismiss_button')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@ -57,9 +57,9 @@ export default class ForgotPasswordModal extends Modal {
|
||||
return (
|
||||
<div className="Modal-body">
|
||||
<div className="Form Form--centered">
|
||||
<p className="helpText">{app.trans('core.forgot_password_text')}</p>
|
||||
<p className="helpText">{app.trans('core.forum.forgot_password_text')}</p>
|
||||
<div className="Form-group">
|
||||
<input className="FormControl" name="email" type="email" placeholder={extractText(app.trans('core.forgot_password_email_placeholder'))}
|
||||
<input className="FormControl" name="email" type="email" placeholder={extractText(app.trans('core.forum.forgot_password_email_placeholder'))}
|
||||
value={this.email()}
|
||||
onchange={m.withAttr('value', this.email)}
|
||||
disabled={this.loading} />
|
||||
@ -69,7 +69,7 @@ export default class ForgotPasswordModal extends Modal {
|
||||
className: 'Button Button--primary Button--block',
|
||||
type: 'submit',
|
||||
loading: this.loading,
|
||||
children: app.trans('core.forgot_password_submit_button')
|
||||
children: app.trans('core.forum.forgot_password_submit_button')
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,7 +64,7 @@ export default class HeaderSecondary extends Component {
|
||||
if (app.forum.attribute('allowSignUp')) {
|
||||
items.add('signUp',
|
||||
Button.component({
|
||||
children: app.trans('core.header_sign_up_link'),
|
||||
children: app.trans('core.forum.header_sign_up_link'),
|
||||
className: 'Button Button--link',
|
||||
onclick: () => app.modal.show(new SignUpModal())
|
||||
}), 10
|
||||
@ -73,7 +73,7 @@ export default class HeaderSecondary extends Component {
|
||||
|
||||
items.add('logIn',
|
||||
Button.component({
|
||||
children: app.trans('core.header_log_in_link'),
|
||||
children: app.trans('core.forum.header_log_in_link'),
|
||||
className: 'Button Button--link',
|
||||
onclick: () => app.modal.show(new LogInModal())
|
||||
}), 0
|
||||
|
@ -147,7 +147,7 @@ export default class IndexPage extends Page {
|
||||
|
||||
items.add('newDiscussion',
|
||||
Button.component({
|
||||
children: app.trans(canStartDiscussion ? 'core.index_start_discussion_button' : 'core.index_cannot_start_discussion_button'),
|
||||
children: app.trans(canStartDiscussion ? 'core.forum.index_start_discussion_button' : 'core.forum.index_cannot_start_discussion_button'),
|
||||
icon: 'edit',
|
||||
className: 'Button Button--primary IndexPage-newDiscussion',
|
||||
itemClassName: 'App-primaryControl',
|
||||
@ -180,7 +180,7 @@ export default class IndexPage extends Page {
|
||||
items.add('allDiscussions',
|
||||
LinkButton.component({
|
||||
href: app.route('index', params),
|
||||
children: app.trans('core.index_all_discussions_link'),
|
||||
children: app.trans('core.forum.index_all_discussions_link'),
|
||||
icon: 'comments-o'
|
||||
}),
|
||||
100
|
||||
@ -201,7 +201,7 @@ export default class IndexPage extends Page {
|
||||
|
||||
const sortOptions = {};
|
||||
for (const i in app.cache.discussionList.sortMap()) {
|
||||
sortOptions[i] = app.trans('core.index_sort_' + i + '_button');
|
||||
sortOptions[i] = app.trans('core.forum.index_sort_' + i + '_button');
|
||||
}
|
||||
|
||||
items.add('sort',
|
||||
@ -226,7 +226,7 @@ export default class IndexPage extends Page {
|
||||
|
||||
items.add('refresh',
|
||||
Button.component({
|
||||
title: app.trans('core.index_refresh_tooltip'),
|
||||
title: app.trans('core.forum.index_refresh_tooltip'),
|
||||
icon: 'refresh',
|
||||
className: 'Button Button--icon',
|
||||
onclick: () => app.cache.discussionList.refresh()
|
||||
@ -236,7 +236,7 @@ export default class IndexPage extends Page {
|
||||
if (app.session.user) {
|
||||
items.add('markAllAsRead',
|
||||
Button.component({
|
||||
title: app.trans('core.index_mark_all_as_read_tooltip'),
|
||||
title: app.trans('core.forum.index_mark_all_as_read_tooltip'),
|
||||
icon: 'check',
|
||||
className: 'Button Button--icon',
|
||||
onclick: this.markAllAsRead.bind(this)
|
||||
|
@ -38,7 +38,7 @@ export default class LogInModal extends Modal {
|
||||
}
|
||||
|
||||
title() {
|
||||
return app.trans('core.log_in_title');
|
||||
return app.trans('core.forum.log_in_title');
|
||||
}
|
||||
|
||||
content() {
|
||||
@ -48,14 +48,14 @@ export default class LogInModal extends Modal {
|
||||
|
||||
<div className="Form Form--centered">
|
||||
<div className="Form-group">
|
||||
<input className="FormControl" name="email" placeholder={extractText(app.trans('core.log_in_username_or_email_placeholder'))}
|
||||
<input className="FormControl" name="email" placeholder={extractText(app.trans('core.forum.log_in_username_or_email_placeholder'))}
|
||||
value={this.email()}
|
||||
onchange={m.withAttr('value', this.email)}
|
||||
disabled={this.loading} />
|
||||
</div>
|
||||
|
||||
<div className="Form-group">
|
||||
<input className="FormControl" name="password" type="password" placeholder={extractText(app.trans('core.log_in_password_placeholder'))}
|
||||
<input className="FormControl" name="password" type="password" placeholder={extractText(app.trans('core.forum.log_in_password_placeholder'))}
|
||||
value={this.password()}
|
||||
onchange={m.withAttr('value', this.password)}
|
||||
disabled={this.loading} />
|
||||
@ -66,20 +66,20 @@ export default class LogInModal extends Modal {
|
||||
className: 'Button Button--primary Button--block',
|
||||
type: 'submit',
|
||||
loading: this.loading,
|
||||
children: app.trans('core.log_in_submit_button')
|
||||
children: app.trans('core.forum.log_in_submit_button')
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
<div className="Modal-footer">
|
||||
<p className="LogInModal-forgotPassword">
|
||||
<a onclick={this.forgotPassword.bind(this)}>{app.trans('core.log_in_forgot_password_link')}</a>
|
||||
<a onclick={this.forgotPassword.bind(this)}>{app.trans('core.forum.log_in_forgot_password_link')}</a>
|
||||
</p>
|
||||
|
||||
{app.forum.attribute('allowSignUp') ? (
|
||||
<p className="LogInModal-signUp">
|
||||
{app.trans('core.log_in_no_account_text')}
|
||||
<a onclick={this.signUp.bind(this)}>{app.trans('core.log_in_sign_up_link')}</a>
|
||||
{app.trans('core.forum.log_in_no_account_text')}
|
||||
<a onclick={this.signUp.bind(this)}>{app.trans('core.forum.log_in_sign_up_link')}</a>
|
||||
</p>
|
||||
) : ''}
|
||||
</div>
|
||||
@ -132,12 +132,12 @@ export default class LogInModal extends Modal {
|
||||
|
||||
if (response && response.code === 'confirm_email') {
|
||||
this.alert = Alert.component({
|
||||
children: app.trans('core.log_in_confirmation_required_message', {email: response.email})
|
||||
children: app.trans('core.forum.log_in_confirmation_required_message', {email: response.email})
|
||||
});
|
||||
} else {
|
||||
this.alert = Alert.component({
|
||||
type: 'error',
|
||||
children: app.trans('core.log_in_invalid_login_message')
|
||||
children: app.trans('core.forum.log_in_invalid_login_message')
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ export default class NotificationGrid extends Component {
|
||||
* @type {Array}
|
||||
*/
|
||||
this.methods = [
|
||||
{name: 'alert', icon: 'bell', label: app.trans('core.settings_notify_by_web_heading')},
|
||||
{name: 'email', icon: 'envelope-o', label: app.trans('core.settings_notify_by_email_heading')}
|
||||
{name: 'alert', icon: 'bell', label: app.trans('core.forum.settings_notify_by_web_heading')},
|
||||
{name: 'email', icon: 'envelope-o', label: app.trans('core.forum.settings_notify_by_email_heading')}
|
||||
];
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ export default class NotificationGrid extends Component {
|
||||
items.add('discussionRenamed', {
|
||||
name: 'discussionRenamed',
|
||||
icon: 'pencil',
|
||||
label: app.trans('core.settings_notify_discussion_renamed_label')
|
||||
label: app.trans('core.forum.settings_notify_discussion_renamed_label')
|
||||
});
|
||||
|
||||
return items;
|
||||
|
@ -59,12 +59,12 @@ export default class NotificationList extends Component {
|
||||
{Button.component({
|
||||
className: 'Button Button--icon Button--link',
|
||||
icon: 'check',
|
||||
title: app.trans('core.notifications_mark_all_as_read_tooltip'),
|
||||
title: app.trans('core.forum.notifications_mark_all_as_read_tooltip'),
|
||||
onclick: this.markAllAsRead.bind(this)
|
||||
})}
|
||||
</div>
|
||||
|
||||
<h4 className="App-titleControl App-titleControl--text">{app.trans('core.notifications_title')}</h4>
|
||||
<h4 className="App-titleControl App-titleControl--text">{app.trans('core.forum.notifications_title')}</h4>
|
||||
</div>
|
||||
|
||||
<div className="NotificationList-content">
|
||||
@ -98,7 +98,7 @@ export default class NotificationList extends Component {
|
||||
);
|
||||
})
|
||||
: !this.loading
|
||||
? <div className="NotificationList-empty">{app.trans('core.notifications_empty_text')}</div>
|
||||
? <div className="NotificationList-empty">{app.trans('core.forum.notifications_empty_text')}</div>
|
||||
: LoadingIndicator.component({className: 'LoadingIndicator--block'})}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@ export default class NotificationsDropdown extends Dropdown {
|
||||
props.className = props.className || 'NotificationsDropdown';
|
||||
props.buttonClassName = props.buttonClassName || 'Button Button--flat';
|
||||
props.menuClassName = props.menuClassName || 'Dropdown-menu--right';
|
||||
props.label = props.label || app.trans('core.notifications_tooltip');
|
||||
props.label = props.label || app.trans('core.forum.notifications_tooltip');
|
||||
props.icon = props.icon || 'bell';
|
||||
|
||||
super.initProps(props);
|
||||
|
@ -15,7 +15,7 @@ export default class PostEdited extends Component {
|
||||
view() {
|
||||
const post = this.props.post;
|
||||
const editUser = post.editUser();
|
||||
const title = extractText(app.trans('core.post_edited_tooltip', {user: editUser, ago: humanTime(post.editTime())}));
|
||||
const title = extractText(app.trans('core.forum.post_edited_tooltip', {user: editUser, ago: humanTime(post.editTime())}));
|
||||
|
||||
return (
|
||||
<span className="PostEdited" title={title}>{icon('pencil')}</span>
|
||||
|
@ -33,7 +33,7 @@ export default class PostMeta extends Component {
|
||||
</a>
|
||||
|
||||
<div className="Dropdown-menu dropdown-menu">
|
||||
<span className="PostMeta-number">{app.trans('core.post_number_tooltip', {number: post.number()})}</span>{' '}
|
||||
<span className="PostMeta-number">{app.trans('core.forum.post_number_tooltip', {number: post.number()})}</span>{' '}
|
||||
{fullTime(time)}
|
||||
{touch
|
||||
? <a className="Button PostMeta-permalink" href={permalink}>{permalink}</a>
|
||||
|
@ -221,7 +221,7 @@ class PostStream extends mixin(Component, evented) {
|
||||
if (dt > 1000 * 60 * 60 * 24 * 4) {
|
||||
content = [
|
||||
<div className="PostStream-timeGap">
|
||||
<span>{app.trans('core.post_stream_time_lapsed_text', {period: moment.duration(dt).humanize()})}</span>
|
||||
<span>{app.trans('core.forum.post_stream_time_lapsed_text', {period: moment.duration(dt).humanize()})}</span>
|
||||
</div>,
|
||||
content
|
||||
];
|
||||
|
@ -71,7 +71,7 @@ export default class PostStreamScrubber extends Component {
|
||||
const unreadCount = this.props.stream.discussion.unreadCount();
|
||||
const unreadPercent = Math.min(this.count() - this.index, unreadCount) / this.count();
|
||||
|
||||
const viewing = app.trans('core.post_scrubber_viewing_text', {
|
||||
const viewing = app.trans('core.forum.post_scrubber_viewing_text', {
|
||||
index: <span className="Scrubber-index">{retain || formatNumber(this.visibleIndex())}</span>,
|
||||
count: <span className="Scrubber-count">{formatNumber(this.count())}</span>
|
||||
});
|
||||
@ -101,7 +101,7 @@ export default class PostStreamScrubber extends Component {
|
||||
<div className="Dropdown-menu dropdown-menu">
|
||||
<div className="Scrubber">
|
||||
<a className="Scrubber-first" onclick={this.goToFirst.bind(this)}>
|
||||
{icon('angle-double-up')} {app.trans('core.post_scrubber_original_post_link')}
|
||||
{icon('angle-double-up')} {app.trans('core.forum.post_scrubber_original_post_link')}
|
||||
</a>
|
||||
|
||||
<div className="Scrubber-scrollbar">
|
||||
@ -116,12 +116,12 @@ export default class PostStreamScrubber extends Component {
|
||||
<div className="Scrubber-after"/>
|
||||
|
||||
<div className="Scrubber-unread" config={styleUnread}>
|
||||
{app.trans('core.post_scrubber_unread_text', {count: unreadCount})}
|
||||
{app.trans('core.forum.post_scrubber_unread_text', {count: unreadCount})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a className="Scrubber-last" onclick={this.goToLast.bind(this)}>
|
||||
{icon('angle-double-down')} {app.trans('core.post_scrubber_now_link')}
|
||||
{icon('angle-double-down')} {app.trans('core.forum.post_scrubber_now_link')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -51,7 +51,7 @@ export default class PostsUserPage extends UserPage {
|
||||
footer = (
|
||||
<div className="PostsUserPage-loadMore">
|
||||
{Button.component({
|
||||
children: app.trans('core.user_posts_load_more_button'),
|
||||
children: app.trans('core.forum.user_posts_load_more_button'),
|
||||
className: 'Button',
|
||||
onclick: this.loadMore.bind(this)
|
||||
})}
|
||||
|
@ -25,9 +25,9 @@ export default class ReplyComposer extends ComposerBody {
|
||||
static initProps(props) {
|
||||
super.initProps(props);
|
||||
|
||||
props.placeholder = props.placeholder || extractText(app.trans('core.composer_reply_body_placeholder'));
|
||||
props.submitLabel = props.submitLabel || app.trans('core.composer_reply_submit_button');
|
||||
props.confirmExit = props.confirmExit || extractText(app.trans('core.composer_reply_discard_confirmation'));
|
||||
props.placeholder = props.placeholder || extractText(app.trans('core.forum.composer_reply_body_placeholder'));
|
||||
props.submitLabel = props.submitLabel || app.trans('core.forum.composer_reply_submit_button');
|
||||
props.confirmExit = props.confirmExit || extractText(app.trans('core.forum.composer_reply_discard_confirmation'));
|
||||
}
|
||||
|
||||
headerItems() {
|
||||
@ -76,7 +76,7 @@ export default class ReplyComposer extends ComposerBody {
|
||||
let alert;
|
||||
const viewButton = Button.component({
|
||||
className: 'Button Button--link',
|
||||
children: app.trans('core.composer_reply_view_button'),
|
||||
children: app.trans('core.forum.composer_reply_view_button'),
|
||||
onclick: () => {
|
||||
m.route(app.route.post(post));
|
||||
app.alerts.dismiss(alert);
|
||||
@ -85,7 +85,7 @@ export default class ReplyComposer extends ComposerBody {
|
||||
app.alerts.show(
|
||||
alert = new Alert({
|
||||
type: 'success',
|
||||
message: app.trans('core.composer_reply_posted_message'),
|
||||
message: app.trans('core.forum.composer_reply_posted_message'),
|
||||
controls: [viewButton]
|
||||
})
|
||||
);
|
||||
|
@ -44,7 +44,7 @@ export default class ReplyPlaceholder extends Component {
|
||||
<article className="Post ReplyPlaceholder" onclick={reply} onmousedown={triggerClick}>
|
||||
<header className="Post-header">
|
||||
{avatar(app.session.user, {className: 'PostUser-avatar'})}{' '}
|
||||
{app.trans('core.post_stream_reply_placeholder')}
|
||||
{app.trans('core.forum.post_stream_reply_placeholder')}
|
||||
</header>
|
||||
</article>
|
||||
);
|
||||
|
@ -84,7 +84,7 @@ export default class Search extends Component {
|
||||
})}>
|
||||
<div className="Search-input">
|
||||
<input className="FormControl"
|
||||
placeholder={extractText(app.trans('core.header_search_placeholder'))}
|
||||
placeholder={extractText(app.trans('core.forum.header_search_placeholder'))}
|
||||
value={this.value()}
|
||||
oninput={m.withAttr('value', this.value)}
|
||||
onfocus={() => this.hasFocus = true}
|
||||
|
@ -47,7 +47,7 @@ export default class SessionDropdown extends Dropdown {
|
||||
items.add('profile',
|
||||
LinkButton.component({
|
||||
icon: 'user',
|
||||
children: app.trans('core.header_profile_button'),
|
||||
children: app.trans('core.forum.header_profile_button'),
|
||||
href: app.route.user(user)
|
||||
}),
|
||||
100
|
||||
@ -56,7 +56,7 @@ export default class SessionDropdown extends Dropdown {
|
||||
items.add('settings',
|
||||
LinkButton.component({
|
||||
icon: 'cog',
|
||||
children: app.trans('core.header_settings_button'),
|
||||
children: app.trans('core.forum.header_settings_button'),
|
||||
href: app.route('settings')
|
||||
}),
|
||||
50
|
||||
@ -66,7 +66,7 @@ export default class SessionDropdown extends Dropdown {
|
||||
items.add('administration',
|
||||
LinkButton.component({
|
||||
icon: 'wrench',
|
||||
children: app.trans('core.header_admin_button'),
|
||||
children: app.trans('core.forum.header_admin_button'),
|
||||
href: app.forum.attribute('baseUrl') + '/admin',
|
||||
target: '_blank',
|
||||
config: () => {}
|
||||
@ -80,7 +80,7 @@ export default class SessionDropdown extends Dropdown {
|
||||
items.add('logOut',
|
||||
Button.component({
|
||||
icon: 'sign-out',
|
||||
children: app.trans('core.header_log_out_button'),
|
||||
children: app.trans('core.forum.header_log_out_button'),
|
||||
onclick: app.session.logout.bind(app.session)
|
||||
}),
|
||||
-100
|
||||
|
@ -17,7 +17,7 @@ export default class SettingsPage extends UserPage {
|
||||
super(...args);
|
||||
|
||||
this.show(app.session.user);
|
||||
app.setTitle(app.trans('core.settings_title'));
|
||||
app.setTitle(app.trans('core.forum.settings_title'));
|
||||
}
|
||||
|
||||
content() {
|
||||
@ -38,7 +38,7 @@ export default class SettingsPage extends UserPage {
|
||||
|
||||
items.add('account',
|
||||
FieldSet.component({
|
||||
label: app.trans('core.settings_account_heading'),
|
||||
label: app.trans('core.forum.settings_account_heading'),
|
||||
className: 'Settings-account',
|
||||
children: this.accountItems().toArray()
|
||||
})
|
||||
@ -46,7 +46,7 @@ export default class SettingsPage extends UserPage {
|
||||
|
||||
items.add('notifications',
|
||||
FieldSet.component({
|
||||
label: app.trans('core.settings_notifications_heading'),
|
||||
label: app.trans('core.forum.settings_notifications_heading'),
|
||||
className: 'Settings-notifications',
|
||||
children: [NotificationGrid.component({user: this.user})]
|
||||
})
|
||||
@ -54,7 +54,7 @@ export default class SettingsPage extends UserPage {
|
||||
|
||||
items.add('privacy',
|
||||
FieldSet.component({
|
||||
label: app.trans('core.settings_privacy_heading'),
|
||||
label: app.trans('core.forum.settings_privacy_heading'),
|
||||
className: 'Settings-privacy',
|
||||
children: this.privacyItems().toArray()
|
||||
})
|
||||
@ -73,7 +73,7 @@ export default class SettingsPage extends UserPage {
|
||||
|
||||
items.add('changePassword',
|
||||
Button.component({
|
||||
children: app.trans('core.settings_change_password_button'),
|
||||
children: app.trans('core.forum.settings_change_password_button'),
|
||||
className: 'Button',
|
||||
onclick: () => app.modal.show(new ChangePasswordModal())
|
||||
})
|
||||
@ -81,7 +81,7 @@ export default class SettingsPage extends UserPage {
|
||||
|
||||
items.add('changeEmail',
|
||||
Button.component({
|
||||
children: app.trans('core.settings_change_email_button'),
|
||||
children: app.trans('core.forum.settings_change_email_button'),
|
||||
className: 'Button',
|
||||
onclick: () => app.modal.show(new ChangeEmailModal())
|
||||
})
|
||||
@ -118,7 +118,7 @@ export default class SettingsPage extends UserPage {
|
||||
|
||||
items.add('discloseOnline',
|
||||
Switch.component({
|
||||
children: app.trans('core.settings_privacy_disclose_online_label'),
|
||||
children: app.trans('core.forum.settings_privacy_disclose_online_label'),
|
||||
state: this.user.preferences().discloseOnline,
|
||||
onchange: (value, component) => {
|
||||
this.user.pushAttributes({lastSeenTime: null});
|
||||
|
@ -53,7 +53,7 @@ export default class SignUpModal extends Modal {
|
||||
}
|
||||
|
||||
title() {
|
||||
return app.trans('core.sign_up_title');
|
||||
return app.trans('core.forum.sign_up_title');
|
||||
}
|
||||
|
||||
content() {
|
||||
@ -73,14 +73,14 @@ export default class SignUpModal extends Modal {
|
||||
|
||||
<div className="Form Form--centered">
|
||||
<div className="Form-group">
|
||||
<input className="FormControl" name="username" placeholder={extractText(app.trans('core.sign_up_username_placeholder'))}
|
||||
<input className="FormControl" name="username" placeholder={extractText(app.trans('core.forum.sign_up_username_placeholder'))}
|
||||
value={this.username()}
|
||||
onchange={m.withAttr('value', this.username)}
|
||||
disabled={this.loading} />
|
||||
</div>
|
||||
|
||||
<div className="Form-group">
|
||||
<input className="FormControl" name="email" type="email" placeholder={extractText(app.trans('core.sign_up_email_placeholder'))}
|
||||
<input className="FormControl" name="email" type="email" placeholder={extractText(app.trans('core.forum.sign_up_email_placeholder'))}
|
||||
value={this.email()}
|
||||
onchange={m.withAttr('value', this.email)}
|
||||
disabled={this.loading || (this.props.token && this.props.email)} />
|
||||
@ -88,7 +88,7 @@ export default class SignUpModal extends Modal {
|
||||
|
||||
{this.props.token ? '' : (
|
||||
<div className="Form-group">
|
||||
<input className="FormControl" name="password" type="password" placeholder={extractText(app.trans('core.sign_up_password_placeholder'))}
|
||||
<input className="FormControl" name="password" type="password" placeholder={extractText(app.trans('core.forum.sign_up_password_placeholder'))}
|
||||
value={this.password()}
|
||||
onchange={m.withAttr('value', this.password)}
|
||||
disabled={this.loading} />
|
||||
@ -100,7 +100,7 @@ export default class SignUpModal extends Modal {
|
||||
className="Button Button--primary Button--block"
|
||||
type="submit"
|
||||
loading={this.loading}>
|
||||
{app.trans('core.sign_up_submit_button')}
|
||||
{app.trans('core.forum.sign_up_submit_button')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@ -119,13 +119,13 @@ export default class SignUpModal extends Modal {
|
||||
<div className="darkenBackground">
|
||||
<div className="container">
|
||||
{avatar(user)}
|
||||
<h3>{app.trans('core.sign_up_welcome_text', {user})}</h3>
|
||||
<h3>{app.trans('core.forum.sign_up_welcome_text', {user})}</h3>
|
||||
|
||||
<p>{app.trans('core.sign_up_confirmation_message', {email: <strong>{user.email()}</strong>})}</p>
|
||||
<p>{app.trans('core.forum.sign_up_confirmation_message', {email: <strong>{user.email()}</strong>})}</p>
|
||||
|
||||
<p>
|
||||
<Button className="Button Button--primary" onclick={this.hide.bind(this)}>
|
||||
{app.trans('core.sign_up_dismiss_button')}
|
||||
{app.trans('core.forum.sign_up_dismiss_button')}
|
||||
</Button>
|
||||
</p>
|
||||
</div>
|
||||
@ -140,8 +140,8 @@ export default class SignUpModal extends Modal {
|
||||
footer() {
|
||||
return [
|
||||
<p className="SignUpModal-logIn">
|
||||
{app.trans('core.sign_up_already_have_account_text')}
|
||||
<a onclick={this.logIn.bind(this)}>{app.trans('core.sign_up_log_in_link')}</a>
|
||||
{app.trans('core.forum.sign_up_already_have_account_text')}
|
||||
<a onclick={this.logIn.bind(this)}>{app.trans('core.forum.sign_up_log_in_link')}</a>
|
||||
</p>
|
||||
];
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ export default class TerminalPost extends Component {
|
||||
return (
|
||||
<span>
|
||||
{lastPost ? icon('reply') : ''}{' '}
|
||||
{app.trans('core.discussion_list_' + (lastPost ? 'replied' : 'started') + '_text', {
|
||||
{app.trans('core.forum.discussion_list_' + (lastPost ? 'replied' : 'started') + '_text', {
|
||||
user,
|
||||
ago: humanTime(time)
|
||||
})}
|
||||
|
@ -31,7 +31,7 @@ export default class UserBio extends Component {
|
||||
let content;
|
||||
|
||||
if (this.editing) {
|
||||
content = <textarea className="FormControl" placeholder={extractText(app.trans('core.user_bio_placeholder'))} rows="3" value={user.bio()}/>;
|
||||
content = <textarea className="FormControl" placeholder={extractText(app.trans('core.forum.user_bio_placeholder'))} rows="3" value={user.bio()}/>;
|
||||
} else {
|
||||
let subContent;
|
||||
|
||||
@ -43,7 +43,7 @@ export default class UserBio extends Component {
|
||||
if (bioHtml) {
|
||||
subContent = m.trust(bioHtml);
|
||||
} else if (this.props.editable) {
|
||||
subContent = <p className="UserBio-placeholder">{app.trans('core.user_bio_placeholder')}</p>;
|
||||
subContent = <p className="UserBio-placeholder">{app.trans('core.forum.user_bio_placeholder')}</p>;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ export default class UserCard extends Component {
|
||||
className: 'UserCard-controls App-primaryControl',
|
||||
menuClassName: 'Dropdown-menu--right',
|
||||
buttonClassName: this.props.controlsButtonClassName,
|
||||
label: app.trans('core.user_controls_button'),
|
||||
label: app.trans('core.forum.user_controls_button'),
|
||||
icon: 'ellipsis-v'
|
||||
}) : ''}
|
||||
|
||||
@ -95,13 +95,13 @@ export default class UserCard extends Component {
|
||||
items.add('lastSeen', (
|
||||
<span className={'UserCard-lastSeen' + (online ? ' online' : '')}>
|
||||
{online
|
||||
? [icon('circle'), ' ', app.trans('core.user_online_text')]
|
||||
? [icon('circle'), ' ', app.trans('core.forum.user_online_text')]
|
||||
: [icon('clock-o'), ' ', humanTime(lastSeenTime)]}
|
||||
</span>
|
||||
));
|
||||
}
|
||||
|
||||
items.add('joined', app.trans('core.user_joined_date_text', {ago: humanTime(user.joinTime())}));
|
||||
items.add('joined', app.trans('core.forum.user_joined_date_text', {ago: humanTime(user.joinTime())}));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ export default class UserPage extends Page {
|
||||
items.add('posts',
|
||||
LinkButton.component({
|
||||
href: app.route('user.posts', {username: user.username()}),
|
||||
children: [app.trans('core.user_posts_link'), <span className="Button-badge">{user.commentsCount()}</span>],
|
||||
children: [app.trans('core.forum.user_posts_link'), <span className="Button-badge">{user.commentsCount()}</span>],
|
||||
icon: 'comment-o'
|
||||
})
|
||||
);
|
||||
@ -139,7 +139,7 @@ export default class UserPage extends Page {
|
||||
items.add('discussions',
|
||||
LinkButton.component({
|
||||
href: app.route('user.discussions', {username: user.username()}),
|
||||
children: [app.trans('core.user_discussions_link'), <span className="Button-badge">{user.discussionsCount()}</span>],
|
||||
children: [app.trans('core.forum.user_discussions_link'), <span className="Button-badge">{user.discussionsCount()}</span>],
|
||||
icon: 'reorder'
|
||||
})
|
||||
);
|
||||
@ -149,7 +149,7 @@ export default class UserPage extends Page {
|
||||
items.add('settings',
|
||||
LinkButton.component({
|
||||
href: app.route('settings'),
|
||||
children: app.trans('core.user_settings_link'),
|
||||
children: app.trans('core.forum.user_settings_link'),
|
||||
icon: 'cog'
|
||||
})
|
||||
);
|
||||
|
@ -22,7 +22,7 @@ export default class UsersSearchResults {
|
||||
if (!results.length) return '';
|
||||
|
||||
return [
|
||||
<li className="Dropdown-header">{app.trans('core.search_users_heading')}</li>,
|
||||
<li className="Dropdown-header">{app.trans('core.forum.search_users_heading')}</li>,
|
||||
results.map(user => (
|
||||
<li className="UserSearchResult" data-index={'users' + user.id()}>
|
||||
<a href={app.route.user(user)} config={m.route}>
|
||||
|
@ -55,14 +55,14 @@ export default {
|
||||
!app.session.user || discussion.canReply()
|
||||
? Button.component({
|
||||
icon: 'reply',
|
||||
children: app.trans(app.session.user ? 'core.discussion_controls_reply_button' : 'core.discussion_controls_log_in_to_reply_button'),
|
||||
children: app.trans(app.session.user ? 'core.forum.discussion_controls_reply_button' : 'core.forum.discussion_controls_log_in_to_reply_button'),
|
||||
onclick: this.replyAction.bind(discussion, true, false)
|
||||
})
|
||||
: Button.component({
|
||||
icon: 'reply',
|
||||
children: app.trans('core.discussion_controls_cannot_reply_button'),
|
||||
children: app.trans('core.forum.discussion_controls_cannot_reply_button'),
|
||||
className: 'disabled',
|
||||
title: app.trans('core.discussion_controls_cannot_reply_text')
|
||||
title: app.trans('core.forum.discussion_controls_cannot_reply_text')
|
||||
})
|
||||
);
|
||||
}
|
||||
@ -85,7 +85,7 @@ export default {
|
||||
if (discussion.canRename()) {
|
||||
items.add('rename', Button.component({
|
||||
icon: 'pencil',
|
||||
children: app.trans('core.discussion_controls_rename_button'),
|
||||
children: app.trans('core.forum.discussion_controls_rename_button'),
|
||||
onclick: this.renameAction.bind(discussion)
|
||||
}));
|
||||
}
|
||||
@ -109,21 +109,21 @@ export default {
|
||||
if (discussion.canHide()) {
|
||||
items.add('hide', Button.component({
|
||||
icon: 'trash-o',
|
||||
children: app.trans('core.discussion_controls_delete_button'),
|
||||
children: app.trans('core.forum.discussion_controls_delete_button'),
|
||||
onclick: this.hideAction.bind(discussion)
|
||||
}));
|
||||
}
|
||||
} else if (discussion.canDelete()) {
|
||||
items.add('restore', Button.component({
|
||||
icon: 'reply',
|
||||
children: app.trans('core.discussion_controls_restore_button'),
|
||||
children: app.trans('core.forum.discussion_controls_restore_button'),
|
||||
onclick: this.restoreAction.bind(discussion),
|
||||
disabled: discussion.commentsCount() === 0
|
||||
}));
|
||||
|
||||
items.add('delete', Button.component({
|
||||
icon: 'times',
|
||||
children: app.trans('core.discussion_controls_delete_forever_button'),
|
||||
children: app.trans('core.forum.discussion_controls_delete_forever_button'),
|
||||
onclick: this.deleteAction.bind(discussion)
|
||||
}));
|
||||
}
|
||||
@ -216,7 +216,7 @@ export default {
|
||||
* @return {Promise}
|
||||
*/
|
||||
deleteAction() {
|
||||
if (confirm(extractText(app.trans('core.discussion_controls_delete_confirmation')))) {
|
||||
if (confirm(extractText(app.trans('core.forum.discussion_controls_delete_confirmation')))) {
|
||||
// If there is a discussion list in the cache, remove this discussion.
|
||||
if (app.cache.discussionList) {
|
||||
app.cache.discussionList.removeDiscussion(this);
|
||||
@ -239,7 +239,7 @@ export default {
|
||||
*/
|
||||
renameAction() {
|
||||
const currentTitle = this.title();
|
||||
const title = prompt(extractText(app.trans('core.discussion_controls_rename_text')), currentTitle);
|
||||
const title = prompt(extractText(app.trans('core.forum.discussion_controls_rename_text')), currentTitle);
|
||||
|
||||
// If the title is different to what it was before, then save it. After the
|
||||
// save has completed, update the post stream as there will be a new post
|
||||
|
@ -60,7 +60,7 @@ export default {
|
||||
if (!post.isHidden()) {
|
||||
items.add('edit', Button.component({
|
||||
icon: 'pencil',
|
||||
children: app.trans('core.post_controls_edit_button'),
|
||||
children: app.trans('core.forum.post_controls_edit_button'),
|
||||
onclick: this.editAction.bind(post)
|
||||
}));
|
||||
}
|
||||
@ -85,7 +85,7 @@ export default {
|
||||
if (post.canEdit()) {
|
||||
items.add('hide', Button.component({
|
||||
icon: 'trash-o',
|
||||
children: app.trans('core.post_controls_delete_button'),
|
||||
children: app.trans('core.forum.post_controls_delete_button'),
|
||||
onclick: this.hideAction.bind(post)
|
||||
}));
|
||||
}
|
||||
@ -93,14 +93,14 @@ export default {
|
||||
if (post.canEdit()) {
|
||||
items.add('restore', Button.component({
|
||||
icon: 'reply',
|
||||
children: app.trans('core.post_controls_restore_button'),
|
||||
children: app.trans('core.forum.post_controls_restore_button'),
|
||||
onclick: this.restoreAction.bind(post)
|
||||
}));
|
||||
}
|
||||
if (post.canDelete() && post.number() !== 1) {
|
||||
items.add('delete', Button.component({
|
||||
icon: 'times',
|
||||
children: app.trans('core.post_controls_delete_forever_button'),
|
||||
children: app.trans('core.forum.post_controls_delete_forever_button'),
|
||||
onclick: this.deleteAction.bind(post)
|
||||
}));
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ export default {
|
||||
if (user.canEdit()) {
|
||||
items.add('edit', Button.component({
|
||||
icon: 'pencil',
|
||||
children: app.trans('core.user_controls_edit_button'),
|
||||
children: app.trans('core.forum.user_controls_edit_button'),
|
||||
onclick: this.editAction.bind(user)
|
||||
}));
|
||||
}
|
||||
@ -83,7 +83,7 @@ export default {
|
||||
if (user.id() !== '1' && user.canDelete()) {
|
||||
items.add('delete', Button.component({
|
||||
icon: 'times',
|
||||
children: app.trans('core.user_controls_delete_button'),
|
||||
children: app.trans('core.forum.user_controls_delete_button'),
|
||||
onclick: this.deleteAction.bind(user)
|
||||
}));
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @return {Object}
|
||||
*/
|
||||
export default function username(user) {
|
||||
const name = (user && user.username()) || app.trans('core.deleted_username');
|
||||
const name = (user && user.username()) || app.trans('core.forum.user_deleted_text');
|
||||
|
||||
return <span className="username">{name}</span>;
|
||||
}
|
||||
|
17
scripts/compile.sh
Executable file
17
scripts/compile.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script compiles Flarum's core assets so that they can be used in-browser.
|
||||
# It should be run from the root directory of the core.
|
||||
|
||||
base=$PWD
|
||||
|
||||
cd "${base}/js"
|
||||
bower install
|
||||
|
||||
cd "${base}/js/forum"
|
||||
npm install
|
||||
gulp --production
|
||||
|
||||
cd "${base}/js/admin"
|
||||
npm install
|
||||
gulp --production
|
@ -11,12 +11,14 @@
|
||||
namespace Flarum\Admin\Actions;
|
||||
|
||||
use Flarum\Support\ClientAction as BaseClientAction;
|
||||
use Flarum\Support\ClientView;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Flarum\Core\Groups\Permission;
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Core\Settings\SettingsRepository;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use Flarum\Events\UnserializeConfig;
|
||||
use Flarum\Events\BuildAdminClientView;
|
||||
|
||||
class ClientAction extends BaseClientAction
|
||||
{
|
||||
@ -28,9 +30,7 @@ class ClientAction extends BaseClientAction
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $translationKeys = [
|
||||
'core.log_out'
|
||||
];
|
||||
protected $translationKeys = ['core.admin'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -42,6 +42,14 @@ class ClientAction extends BaseClientAction
|
||||
$this->layout = __DIR__.'/../../../views/admin.blade.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function fireEvent(ClientView $view, array &$keys)
|
||||
{
|
||||
event(new BuildAdminClientView($this, $view, $keys));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@
|
||||
namespace Flarum\Admin;
|
||||
|
||||
use Flarum\Http\RouteCollection;
|
||||
use Flarum\Http\UrlGenerator;
|
||||
use Flarum\Admin\UrlGenerator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\RedirectResponse;
|
||||
@ -26,7 +26,7 @@ class AdminServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton(
|
||||
'Flarum\Http\UrlGeneratorInterface',
|
||||
UrlGenerator::class,
|
||||
function () {
|
||||
return new UrlGenerator($this->app->make('flarum.admin.routes'));
|
||||
}
|
||||
@ -57,7 +57,7 @@ class AdminServiceProvider extends ServiceProvider
|
||||
|
||||
$routes->get(
|
||||
'/',
|
||||
'flarum.admin.index',
|
||||
'index',
|
||||
$this->action('Flarum\Admin\Actions\ClientAction')
|
||||
);
|
||||
}
|
||||
|
18
src/Admin/UrlGenerator.php
Normal file
18
src/Admin/UrlGenerator.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Admin;
|
||||
|
||||
use Flarum\Http\UrlGenerator as BaseUrlGenerator;
|
||||
|
||||
class UrlGenerator extends BaseUrlGenerator
|
||||
{
|
||||
protected $prefix = 'admin';
|
||||
}
|
@ -14,7 +14,7 @@ use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Discussions\Search\DiscussionSearcher;
|
||||
use Flarum\Api\Actions\SerializeCollectionAction;
|
||||
use Flarum\Api\JsonApiRequest;
|
||||
use Flarum\Http\UrlGeneratorInterface;
|
||||
use Flarum\Api\UrlGenerator;
|
||||
use Tobscure\JsonApi\Document;
|
||||
|
||||
class IndexAction extends SerializeCollectionAction
|
||||
@ -25,7 +25,7 @@ class IndexAction extends SerializeCollectionAction
|
||||
protected $searcher;
|
||||
|
||||
/**
|
||||
* @var UrlGeneratorInterface
|
||||
* @var UrlGenerator
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
@ -74,9 +74,9 @@ class IndexAction extends SerializeCollectionAction
|
||||
|
||||
/**
|
||||
* @param DiscussionSearcher $searcher
|
||||
* @param UrlGeneratorInterface $url
|
||||
* @param UrlGenerator $url
|
||||
*/
|
||||
public function __construct(DiscussionSearcher $searcher, UrlGeneratorInterface $url)
|
||||
public function __construct(DiscussionSearcher $searcher, UrlGenerator $url)
|
||||
{
|
||||
$this->searcher = $searcher;
|
||||
$this->url = $url;
|
||||
@ -106,7 +106,7 @@ class IndexAction extends SerializeCollectionAction
|
||||
$this->addPaginationLinks(
|
||||
$document,
|
||||
$request,
|
||||
$request->http ? $this->url->toRoute('flarum.api.discussions.index') : '',
|
||||
$request->http ? $this->url->toRoute('discussions.index') : '',
|
||||
$results->areMoreResults()
|
||||
);
|
||||
|
||||
|
@ -14,7 +14,7 @@ use Flarum\Core\Search\SearchCriteria;
|
||||
use Flarum\Core\Users\Search\UserSearcher;
|
||||
use Flarum\Api\Actions\SerializeCollectionAction;
|
||||
use Flarum\Api\JsonApiRequest;
|
||||
use Flarum\Http\UrlGeneratorInterface;
|
||||
use Flarum\Api\UrlGenerator;
|
||||
use Tobscure\JsonApi\Document;
|
||||
|
||||
class IndexAction extends SerializeCollectionAction
|
||||
@ -25,7 +25,7 @@ class IndexAction extends SerializeCollectionAction
|
||||
protected $searcher;
|
||||
|
||||
/**
|
||||
* @var UrlGeneratorInterface
|
||||
* @var UrlGenerator
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
@ -68,9 +68,9 @@ class IndexAction extends SerializeCollectionAction
|
||||
|
||||
/**
|
||||
* @param UserSearcher $searcher
|
||||
* @param UrlGeneratorInterface $url
|
||||
* @param UrlGenerator $url
|
||||
*/
|
||||
public function __construct(UserSearcher $searcher, UrlGeneratorInterface $url)
|
||||
public function __construct(UserSearcher $searcher, UrlGenerator $url)
|
||||
{
|
||||
$this->searcher = $searcher;
|
||||
$this->url = $url;
|
||||
@ -97,7 +97,7 @@ class IndexAction extends SerializeCollectionAction
|
||||
$this->addPaginationLinks(
|
||||
$document,
|
||||
$request,
|
||||
$this->url->toRoute('flarum.api.users.index'),
|
||||
$this->url->toRoute('users.index'),
|
||||
$results->areMoreResults()
|
||||
);
|
||||
|
||||
|
@ -17,7 +17,7 @@ use Flarum\Events\RegisterApiRoutes;
|
||||
use Flarum\Events\RegisterActivityTypes;
|
||||
use Flarum\Events\RegisterNotificationTypes;
|
||||
use Flarum\Http\RouteCollection;
|
||||
use Flarum\Http\UrlGenerator;
|
||||
use Flarum\Api\UrlGenerator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -35,7 +35,7 @@ class ApiServiceProvider extends ServiceProvider
|
||||
});
|
||||
|
||||
$this->app->singleton(
|
||||
'Flarum\Http\UrlGeneratorInterface',
|
||||
UrlGenerator::class,
|
||||
function () {
|
||||
return new UrlGenerator($this->app->make('flarum.api.routes'));
|
||||
}
|
||||
@ -78,28 +78,28 @@ class ApiServiceProvider extends ServiceProvider
|
||||
// Get forum information
|
||||
$routes->get(
|
||||
'/forum',
|
||||
'flarum.api.forum.show',
|
||||
'forum.show',
|
||||
$this->action('Flarum\Api\Actions\Forum\ShowAction')
|
||||
);
|
||||
|
||||
// Save forum information
|
||||
$routes->patch(
|
||||
'/forum',
|
||||
'flarum.api.forum.update',
|
||||
'forum.update',
|
||||
$this->action('Flarum\Api\Actions\Forum\UpdateAction')
|
||||
);
|
||||
|
||||
// Retrieve authentication token
|
||||
$routes->post(
|
||||
'/token',
|
||||
'flarum.api.token',
|
||||
'token',
|
||||
$this->action('Flarum\Api\Actions\TokenAction')
|
||||
);
|
||||
|
||||
// Send forgot password email
|
||||
$routes->post(
|
||||
'/forgot',
|
||||
'flarum.api.forgot',
|
||||
'forgot',
|
||||
$this->action('Flarum\Api\Actions\ForgotAction')
|
||||
);
|
||||
|
||||
@ -112,49 +112,49 @@ class ApiServiceProvider extends ServiceProvider
|
||||
// List users
|
||||
$routes->get(
|
||||
'/users',
|
||||
'flarum.api.users.index',
|
||||
'users.index',
|
||||
$this->action('Flarum\Api\Actions\Users\IndexAction')
|
||||
);
|
||||
|
||||
// Register a user
|
||||
$routes->post(
|
||||
'/users',
|
||||
'flarum.api.users.create',
|
||||
'users.create',
|
||||
$this->action('Flarum\Api\Actions\Users\CreateAction')
|
||||
);
|
||||
|
||||
// Get a single user
|
||||
$routes->get(
|
||||
'/users/{id}',
|
||||
'flarum.api.users.show',
|
||||
'users.show',
|
||||
$this->action('Flarum\Api\Actions\Users\ShowAction')
|
||||
);
|
||||
|
||||
// Edit a user
|
||||
$routes->patch(
|
||||
'/users/{id}',
|
||||
'flarum.api.users.update',
|
||||
'users.update',
|
||||
$this->action('Flarum\Api\Actions\Users\UpdateAction')
|
||||
);
|
||||
|
||||
// Delete a user
|
||||
$routes->delete(
|
||||
'/users/{id}',
|
||||
'flarum.api.users.delete',
|
||||
'users.delete',
|
||||
$this->action('Flarum\Api\Actions\Users\DeleteAction')
|
||||
);
|
||||
|
||||
// Upload avatar
|
||||
$routes->post(
|
||||
'/users/{id}/avatar',
|
||||
'flarum.api.users.avatar.upload',
|
||||
'users.avatar.upload',
|
||||
$this->action('Flarum\Api\Actions\Users\UploadAvatarAction')
|
||||
);
|
||||
|
||||
// Remove avatar
|
||||
$routes->delete(
|
||||
'/users/{id}/avatar',
|
||||
'flarum.api.users.avatar.delete',
|
||||
'users.avatar.delete',
|
||||
$this->action('Flarum\Api\Actions\Users\DeleteAvatarAction')
|
||||
);
|
||||
|
||||
@ -167,28 +167,28 @@ class ApiServiceProvider extends ServiceProvider
|
||||
// List activity
|
||||
$routes->get(
|
||||
'/activity',
|
||||
'flarum.api.activity.index',
|
||||
'activity.index',
|
||||
$this->action('Flarum\Api\Actions\Activity\IndexAction')
|
||||
);
|
||||
|
||||
// List notifications for the current user
|
||||
$routes->get(
|
||||
'/notifications',
|
||||
'flarum.api.notifications.index',
|
||||
'notifications.index',
|
||||
$this->action('Flarum\Api\Actions\Notifications\IndexAction')
|
||||
);
|
||||
|
||||
// Mark all notifications as read
|
||||
$routes->post(
|
||||
'/notifications/read',
|
||||
'flarum.api.notifications.readAll',
|
||||
'notifications.readAll',
|
||||
$this->action('Flarum\Api\Actions\Notifications\ReadAllAction')
|
||||
);
|
||||
|
||||
// Mark a single notification as read
|
||||
$routes->patch(
|
||||
'/notifications/{id}',
|
||||
'flarum.api.notifications.update',
|
||||
'notifications.update',
|
||||
$this->action('Flarum\Api\Actions\Notifications\UpdateAction')
|
||||
);
|
||||
|
||||
@ -201,35 +201,35 @@ class ApiServiceProvider extends ServiceProvider
|
||||
// List discussions
|
||||
$routes->get(
|
||||
'/discussions',
|
||||
'flarum.api.discussions.index',
|
||||
'discussions.index',
|
||||
$this->action('Flarum\Api\Actions\Discussions\IndexAction')
|
||||
);
|
||||
|
||||
// Create a discussion
|
||||
$routes->post(
|
||||
'/discussions',
|
||||
'flarum.api.discussions.create',
|
||||
'discussions.create',
|
||||
$this->action('Flarum\Api\Actions\Discussions\CreateAction')
|
||||
);
|
||||
|
||||
// Show a single discussion
|
||||
$routes->get(
|
||||
'/discussions/{id}',
|
||||
'flarum.api.discussions.show',
|
||||
'discussions.show',
|
||||
$this->action('Flarum\Api\Actions\Discussions\ShowAction')
|
||||
);
|
||||
|
||||
// Edit a discussion
|
||||
$routes->patch(
|
||||
'/discussions/{id}',
|
||||
'flarum.api.discussions.update',
|
||||
'discussions.update',
|
||||
$this->action('Flarum\Api\Actions\Discussions\UpdateAction')
|
||||
);
|
||||
|
||||
// Delete a discussion
|
||||
$routes->delete(
|
||||
'/discussions/{id}',
|
||||
'flarum.api.discussions.delete',
|
||||
'discussions.delete',
|
||||
$this->action('Flarum\Api\Actions\Discussions\DeleteAction')
|
||||
);
|
||||
|
||||
@ -242,35 +242,35 @@ class ApiServiceProvider extends ServiceProvider
|
||||
// List posts, usually for a discussion
|
||||
$routes->get(
|
||||
'/posts',
|
||||
'flarum.api.posts.index',
|
||||
'posts.index',
|
||||
$this->action('Flarum\Api\Actions\Posts\IndexAction')
|
||||
);
|
||||
|
||||
// Create a post
|
||||
$routes->post(
|
||||
'/posts',
|
||||
'flarum.api.posts.create',
|
||||
'posts.create',
|
||||
$this->action('Flarum\Api\Actions\Posts\CreateAction')
|
||||
);
|
||||
|
||||
// Show a single or multiple posts by ID
|
||||
$routes->get(
|
||||
'/posts/{id}',
|
||||
'flarum.api.posts.show',
|
||||
'posts.show',
|
||||
$this->action('Flarum\Api\Actions\Posts\ShowAction')
|
||||
);
|
||||
|
||||
// Edit a post
|
||||
$routes->patch(
|
||||
'/posts/{id}',
|
||||
'flarum.api.posts.update',
|
||||
'posts.update',
|
||||
$this->action('Flarum\Api\Actions\Posts\UpdateAction')
|
||||
);
|
||||
|
||||
// Delete a post
|
||||
$routes->delete(
|
||||
'/posts/{id}',
|
||||
'flarum.api.posts.delete',
|
||||
'posts.delete',
|
||||
$this->action('Flarum\Api\Actions\Posts\DeleteAction')
|
||||
);
|
||||
|
||||
@ -283,28 +283,28 @@ class ApiServiceProvider extends ServiceProvider
|
||||
// List groups
|
||||
$routes->get(
|
||||
'/groups',
|
||||
'flarum.api.groups.index',
|
||||
'groups.index',
|
||||
$this->action('Flarum\Api\Actions\Groups\IndexAction')
|
||||
);
|
||||
|
||||
// Create a group
|
||||
$routes->post(
|
||||
'/groups',
|
||||
'flarum.api.groups.create',
|
||||
'groups.create',
|
||||
$this->action('Flarum\Api\Actions\Groups\CreateAction')
|
||||
);
|
||||
|
||||
// Edit a group
|
||||
$routes->patch(
|
||||
'/groups/{id}',
|
||||
'flarum.api.groups.update',
|
||||
'groups.update',
|
||||
$this->action('Flarum\Api\Actions\Groups\UpdateAction')
|
||||
);
|
||||
|
||||
// Delete a group
|
||||
$routes->delete(
|
||||
'/groups/{id}',
|
||||
'flarum.api.groups.delete',
|
||||
'groups.delete',
|
||||
$this->action('Flarum\Api\Actions\Groups\DeleteAction')
|
||||
);
|
||||
|
||||
@ -317,28 +317,28 @@ class ApiServiceProvider extends ServiceProvider
|
||||
// Toggle an extension
|
||||
$routes->patch(
|
||||
'/extensions/{name}',
|
||||
'flarum.api.extensions.update',
|
||||
'extensions.update',
|
||||
$this->action('Flarum\Api\Actions\Extensions\UpdateAction')
|
||||
);
|
||||
|
||||
// Uninstall an extension
|
||||
$routes->delete(
|
||||
'/extensions/{name}',
|
||||
'flarum.api.extensions.delete',
|
||||
'extensions.delete',
|
||||
$this->action('Flarum\Api\Actions\Extensions\DeleteAction')
|
||||
);
|
||||
|
||||
// Update config settings
|
||||
$routes->post(
|
||||
'/config',
|
||||
'flarum.api.config',
|
||||
'config',
|
||||
$this->action('Flarum\Api\Actions\ConfigAction')
|
||||
);
|
||||
|
||||
// Update a permission
|
||||
$routes->post(
|
||||
'/permission',
|
||||
'flarum.api.permission',
|
||||
'permission',
|
||||
$this->action('Flarum\Api\Actions\PermissionAction')
|
||||
);
|
||||
|
||||
|
18
src/Api/UrlGenerator.php
Normal file
18
src/Api/UrlGenerator.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Api;
|
||||
|
||||
use Flarum\Http\UrlGenerator as BaseUrlGenerator;
|
||||
|
||||
class UrlGenerator extends BaseUrlGenerator
|
||||
{
|
||||
protected $prefix = 'api';
|
||||
}
|
@ -17,7 +17,7 @@ use Illuminate\Contracts\Mail\Mailer;
|
||||
use Illuminate\Mail\Message;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Flarum\Core;
|
||||
use Flarum\Http\UrlGeneratorInterface;
|
||||
use Flarum\Forum\UrlGenerator;
|
||||
|
||||
class RequestPasswordResetHandler
|
||||
{
|
||||
@ -37,7 +37,7 @@ class RequestPasswordResetHandler
|
||||
protected $mailer;
|
||||
|
||||
/**
|
||||
* @var UrlGeneratorInterface
|
||||
* @var UrlGenerator
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
@ -45,9 +45,9 @@ class RequestPasswordResetHandler
|
||||
* @param UserRepository $users
|
||||
* @param SettingsRepository $settings
|
||||
* @param Mailer $mailer
|
||||
* @param UrlGeneratorInterface $url
|
||||
* @param UrlGenerator $url
|
||||
*/
|
||||
public function __construct(UserRepository $users, SettingsRepository $settings, Mailer $mailer, UrlGeneratorInterface $url)
|
||||
public function __construct(UserRepository $users, SettingsRepository $settings, Mailer $mailer, UrlGenerator $url)
|
||||
{
|
||||
$this->users = $users;
|
||||
$this->settings = $settings;
|
||||
|
@ -328,7 +328,7 @@ class User extends Model
|
||||
*/
|
||||
public function getAvatarUrlAttribute()
|
||||
{
|
||||
$urlGenerator = app('Flarum\Http\UrlGeneratorInterface');
|
||||
$urlGenerator = app('Flarum\Forum\UrlGenerator');
|
||||
|
||||
return $this->avatar_path ? $urlGenerator->toAsset('avatars/'.$this->avatar_path) : null;
|
||||
}
|
||||
|
34
src/Events/BuildAdminClientView.php
Normal file
34
src/Events/BuildAdminClientView.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Events;
|
||||
|
||||
use Flarum\Support\ClientView;
|
||||
use Flarum\Admin\Actions\ClientAction;
|
||||
|
||||
class BuildAdminClientView extends BuildClientView
|
||||
{
|
||||
/**
|
||||
* @var ClientAction
|
||||
*/
|
||||
public $action;
|
||||
|
||||
/**
|
||||
* @param ClientAction $action
|
||||
* @param ClientView $view
|
||||
* @param array $keys
|
||||
*/
|
||||
public function __construct(ClientAction $action, ClientView $view, array &$keys)
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->view = $view;
|
||||
$this->keys = &$keys;
|
||||
}
|
||||
}
|
@ -12,10 +12,8 @@ namespace Flarum\Events;
|
||||
|
||||
use Flarum\Support\ClientAction;
|
||||
use Flarum\Support\ClientView;
|
||||
use Flarum\Forum\Actions\ClientAction as ForumClientAction;
|
||||
use Flarum\Admin\Actions\ClientAction as AdminClientAction;
|
||||
|
||||
class BuildClientView
|
||||
abstract class BuildClientView
|
||||
{
|
||||
/**
|
||||
* @var ClientAction
|
||||
@ -32,61 +30,20 @@ class BuildClientView
|
||||
*/
|
||||
public $keys;
|
||||
|
||||
/**
|
||||
* @param ClientAction $action
|
||||
* @param ClientView $view
|
||||
* @param array $keys
|
||||
*/
|
||||
public function __construct($action, $view, &$keys)
|
||||
public function assets($files)
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->view = $view;
|
||||
$this->keys = &$keys;
|
||||
$this->view->getAssets()->addFiles((array) $files);
|
||||
}
|
||||
|
||||
public function forumAssets($files)
|
||||
public function bootstrapper($bootstrapper)
|
||||
{
|
||||
if ($this->action instanceof ForumClientAction) {
|
||||
$this->view->getAssets()->addFiles((array) $files);
|
||||
}
|
||||
$this->view->addBootstrapper($bootstrapper);
|
||||
}
|
||||
|
||||
public function forumBootstrapper($bootstrapper)
|
||||
public function translations(array $keys)
|
||||
{
|
||||
if ($this->action instanceof ForumClientAction) {
|
||||
$this->view->addBootstrapper($bootstrapper);
|
||||
}
|
||||
}
|
||||
|
||||
public function forumTranslations(array $keys)
|
||||
{
|
||||
if ($this->action instanceof ForumClientAction) {
|
||||
foreach ($keys as $key) {
|
||||
$this->keys[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function adminAssets($files)
|
||||
{
|
||||
if ($this->action instanceof AdminClientAction) {
|
||||
$this->view->getAssets()->addFiles((array) $files);
|
||||
}
|
||||
}
|
||||
|
||||
public function adminBootstrapper($bootstrapper)
|
||||
{
|
||||
if ($this->action instanceof AdminClientAction) {
|
||||
$this->view->addBootstrapper($bootstrapper);
|
||||
}
|
||||
}
|
||||
|
||||
public function adminTranslations(array $keys)
|
||||
{
|
||||
if ($this->action instanceof AdminClientAction) {
|
||||
foreach ($keys as $key) {
|
||||
$this->keys[] = $key;
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$this->keys[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
src/Events/BuildForumClientView.php
Normal file
34
src/Events/BuildForumClientView.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Events;
|
||||
|
||||
use Flarum\Support\ClientView;
|
||||
use Flarum\Forum\Actions\ClientAction;
|
||||
|
||||
class BuildForumClientView extends BuildClientView
|
||||
{
|
||||
/**
|
||||
* @var ClientAction
|
||||
*/
|
||||
public $action;
|
||||
|
||||
/**
|
||||
* @param ClientAction $action
|
||||
* @param ClientView $view
|
||||
* @param array $keys
|
||||
*/
|
||||
public function __construct(ClientAction $action, ClientView $view, array &$keys)
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->view = $view;
|
||||
$this->keys = &$keys;
|
||||
}
|
||||
}
|
@ -11,9 +11,11 @@
|
||||
namespace Flarum\Forum\Actions;
|
||||
|
||||
use Flarum\Support\ClientAction as BaseClientAction;
|
||||
use Flarum\Support\ClientView;
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Core\Settings\SettingsRepository;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use Flarum\Events\BuildForumClientView;
|
||||
|
||||
class ClientAction extends BaseClientAction
|
||||
{
|
||||
@ -25,9 +27,7 @@ class ClientAction extends BaseClientAction
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $translationKeys = [
|
||||
'core'
|
||||
];
|
||||
protected $translationKeys = ['core.forum'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -39,6 +39,14 @@ class ClientAction extends BaseClientAction
|
||||
$this->layout = __DIR__.'/../../../views/forum.blade.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function fireEvent(ClientView $view, array &$keys)
|
||||
{
|
||||
event(new BuildForumClientView($this, $view, $keys));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -50,8 +50,8 @@ class DiscussionAction extends ClientAction
|
||||
$queryString[] = $k . '=' . $v;
|
||||
}
|
||||
|
||||
return app('Flarum\Http\UrlGeneratorInterface')
|
||||
->toRoute('flarum.forum.discussion', ['id' => $document->data->id]) .
|
||||
return app('Flarum\Forum\UrlGenerator')
|
||||
->toRoute('discussion', ['id' => $document->data->id]) .
|
||||
($queryString ? '?' . implode('&', $queryString) : '');
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace Flarum\Forum;
|
||||
use Flarum\Core\Users\Guest;
|
||||
use Flarum\Events\RegisterForumRoutes;
|
||||
use Flarum\Http\RouteCollection;
|
||||
use Flarum\Http\UrlGenerator;
|
||||
use Flarum\Forum\UrlGenerator;
|
||||
use Flarum\Support\ServiceProvider;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
@ -31,7 +31,7 @@ class ForumServiceProvider extends ServiceProvider
|
||||
});
|
||||
|
||||
$this->app->singleton(
|
||||
'Flarum\Http\UrlGeneratorInterface',
|
||||
UrlGenerator::class,
|
||||
function () {
|
||||
return new UrlGenerator($this->app->make('flarum.forum.routes'));
|
||||
}
|
||||
@ -62,67 +62,67 @@ class ForumServiceProvider extends ServiceProvider
|
||||
|
||||
$routes->get(
|
||||
'/all',
|
||||
'flarum.forum.index',
|
||||
'index',
|
||||
$defaultAction = $this->action('Flarum\Forum\Actions\IndexAction')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/d/{id:\d+(?:-[^/]*)?}[/{near:[^/]*}]',
|
||||
'flarum.forum.discussion',
|
||||
'discussion',
|
||||
$this->action('Flarum\Forum\Actions\DiscussionAction')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/u/{username}[/{filter:[^/]*}]',
|
||||
'flarum.forum.user',
|
||||
'user',
|
||||
$this->action('Flarum\Forum\Actions\ClientAction')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/settings',
|
||||
'flarum.forum.settings',
|
||||
'settings',
|
||||
$this->action('Flarum\Forum\Actions\ClientAction')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/notifications',
|
||||
'flarum.forum.notifications',
|
||||
'notifications',
|
||||
$this->action('Flarum\Forum\Actions\ClientAction')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/logout',
|
||||
'flarum.forum.logout',
|
||||
'logout',
|
||||
$this->action('Flarum\Forum\Actions\LogoutAction')
|
||||
);
|
||||
|
||||
$routes->post(
|
||||
'/login',
|
||||
'flarum.forum.login',
|
||||
'login',
|
||||
$this->action('Flarum\Forum\Actions\LoginAction')
|
||||
);
|
||||
|
||||
$routes->post(
|
||||
'/register',
|
||||
'flarum.forum.register',
|
||||
'register',
|
||||
$this->action('Flarum\Forum\Actions\RegisterAction')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/confirm/{token}',
|
||||
'flarum.forum.confirmEmail',
|
||||
'confirmEmail',
|
||||
$this->action('Flarum\Forum\Actions\ConfirmEmailAction')
|
||||
);
|
||||
|
||||
$routes->get(
|
||||
'/reset/{token}',
|
||||
'flarum.forum.resetPassword',
|
||||
'resetPassword',
|
||||
$this->action('Flarum\Forum\Actions\ResetPasswordAction')
|
||||
);
|
||||
|
||||
$routes->post(
|
||||
'/reset',
|
||||
'flarum.forum.savePassword',
|
||||
'savePassword',
|
||||
$this->action('Flarum\Forum\Actions\SavePasswordAction')
|
||||
);
|
||||
|
||||
@ -137,7 +137,7 @@ class ForumServiceProvider extends ServiceProvider
|
||||
|
||||
$routes->get(
|
||||
'/',
|
||||
'flarum.forum.default',
|
||||
'default',
|
||||
$defaultAction
|
||||
);
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
@ -9,11 +8,10 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Http;
|
||||
namespace Flarum\Forum;
|
||||
|
||||
interface UrlGeneratorInterface
|
||||
use Flarum\Http\UrlGenerator as BaseUrlGenerator;
|
||||
|
||||
class UrlGenerator extends BaseUrlGenerator
|
||||
{
|
||||
public function toRoute($name, $parameters = []);
|
||||
|
||||
public function toAsset($path);
|
||||
}
|
@ -88,9 +88,13 @@ class RouteCollection
|
||||
|
||||
public function getPath($name, array $parameters = [])
|
||||
{
|
||||
$parts = $this->reverse[$name][0];
|
||||
array_walk($parts, [$this, 'fixPathPart'], $parameters);
|
||||
if (isset($this->reverse[$name])) {
|
||||
$parts = $this->reverse[$name][0];
|
||||
array_walk($parts, [$this, 'fixPathPart'], $parameters);
|
||||
|
||||
return '/' . ltrim(implode('', $parts), '/');
|
||||
return '/' . ltrim(implode('', $parts), '/');
|
||||
}
|
||||
|
||||
throw new \RuntimeException("Route $name not found");
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,11 @@ namespace Flarum\Http;
|
||||
|
||||
use Flarum\Core;
|
||||
|
||||
class UrlGenerator implements UrlGeneratorInterface
|
||||
class UrlGenerator
|
||||
{
|
||||
protected $routes;
|
||||
|
||||
protected $prefix;
|
||||
|
||||
public function __construct(RouteCollection $routes)
|
||||
{
|
||||
@ -28,11 +29,11 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||
$path = $this->routes->getPath($name, $parameters);
|
||||
$path = ltrim($path, '/');
|
||||
|
||||
return Core::url() . "/$path";
|
||||
return Core::url($this->prefix) . "/$path";
|
||||
}
|
||||
|
||||
public function toAsset($path)
|
||||
{
|
||||
return Core::url() . "/assets/$path";
|
||||
return Core::url($this->prefix) . "/assets/$path";
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ use Flarum\Assets\LessCompiler;
|
||||
use Flarum\Core;
|
||||
use Flarum\Core\Settings\SettingsRepository;
|
||||
use Flarum\Core\Users\User;
|
||||
use Flarum\Events\BuildClientView;
|
||||
use Flarum\Locale\JsCompiler as LocaleJsCompiler;
|
||||
use Flarum\Locale\LocaleManager;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
@ -122,7 +121,7 @@ abstract class ClientAction extends HtmlAction
|
||||
// compile only the ones we need.
|
||||
$keys = $this->translationKeys;
|
||||
|
||||
event(new BuildClientView($this, $view, $keys));
|
||||
$this->fireEvent($view, $keys);
|
||||
|
||||
if ($localeCompiler) {
|
||||
$translations = $this->locales->getTranslations($locale);
|
||||
@ -135,6 +134,13 @@ abstract class ClientAction extends HtmlAction
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClientView $view
|
||||
* @param array &$keys
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function fireEvent(ClientView $view, array &$keys);
|
||||
|
||||
/**
|
||||
* Flush the client's assets so that they will be regenerated from scratch
|
||||
* on the next render.
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$url = app('Flarum\Http\UrlGeneratorInterface');
|
||||
$url = app('Flarum\Forum\UrlGenerator');
|
||||
?>
|
||||
<div class="container">
|
||||
<h2>All Discussions</h2>
|
||||
@ -7,7 +7,7 @@ $url = app('Flarum\Http\UrlGeneratorInterface');
|
||||
<ul>
|
||||
@foreach ($document->data as $discussion)
|
||||
<li>
|
||||
<a href="{{ $url->toRoute('flarum.forum.discussion', [
|
||||
<a href="{{ $url->toRoute('discussion', [
|
||||
'id' => $discussion->id . '-' . $discussion->attributes->title
|
||||
]) }}">
|
||||
{{ $discussion->attributes->title }}
|
||||
@ -16,5 +16,5 @@ $url = app('Flarum\Http\UrlGeneratorInterface');
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<a href="{{ $url->toRoute('flarum.forum.index') }}?page={{ $page + 1 }}">Next Page »</a>
|
||||
<a href="{{ $url->toRoute('index') }}?page={{ $page + 1 }}">Next Page »</a>
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<body>
|
||||
<h1>Reset Your Password</h1>
|
||||
|
||||
<form class="form-horizontal" role="form" method="POST" action="{{ app('Flarum\Http\UrlGeneratorInterface')->toRoute('flarum.forum.savePassword') }}">
|
||||
<form class="form-horizontal" role="form" method="POST" action="{{ app('Flarum\Forum\UrlGenerator')->toRoute('savePassword') }}">
|
||||
<input type="hidden" name="token" value="{{ $token }}">
|
||||
|
||||
<div class="form-group">
|
||||
|
Reference in New Issue
Block a user