mirror of
https://github.com/flarum/framework.git
synced 2025-02-27 00:38:41 +08:00
Add content to error page, drop 404 page, move translations
This commit is contained in:
parent
43d00fcb79
commit
7cf0df88f3
@ -1,11 +1,38 @@
|
||||
import Link from './Link';
|
||||
import Page from './Page';
|
||||
|
||||
export default class ErrorPage extends Page {
|
||||
oninit(vnode) {
|
||||
super.oninit(vnode);
|
||||
|
||||
this.title = app.translator.trans(`core.forum.error.${this.attrs.errorCode}_title`);
|
||||
}
|
||||
|
||||
oncreate(vnode) {
|
||||
super.oncreate(vnode);
|
||||
|
||||
app.setTitle(this.title);
|
||||
}
|
||||
|
||||
view() {
|
||||
const links = {
|
||||
404: '/',
|
||||
};
|
||||
|
||||
const link = links[this.attrs.errorCode];
|
||||
|
||||
return (
|
||||
<div className="ErrorPage">
|
||||
<div className="container">
|
||||
<p>Error!</p>
|
||||
<h2>{this.title}</h2>
|
||||
<p>{app.translator.trans(`core.forum.error.${this.attrs.errorCode}_text`)}</p>
|
||||
<p>
|
||||
{link && (
|
||||
<Link href={link}>
|
||||
{app.translator.trans(`core.forum.error.${this.attrs.errorCode}_link_text`, { forum: app.forum.attribute('title') })}
|
||||
</Link>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -34,10 +34,9 @@ export default class DefaultResolver {
|
||||
|
||||
onmatch(args, requestedPath, route) {
|
||||
const errorCode = app.data.errorCode;
|
||||
const currRoute = m.route.get();
|
||||
if (errorCode) {
|
||||
delete app.data.errorCode;
|
||||
return { view: () => ErrorPage.component({ errorCode, currRoute }) };
|
||||
return { view: () => ErrorPage.component({ errorCode }) };
|
||||
}
|
||||
|
||||
return this.component;
|
||||
|
@ -303,6 +303,15 @@ core:
|
||||
username_heading: => core.ref.username
|
||||
username_label: => core.ref.username
|
||||
|
||||
error:
|
||||
401_text: You do not have permission to access this page. Try again after logging in.
|
||||
403_text: You do not have permission to access this page.
|
||||
404_text: The page you requested could not be found.
|
||||
401_title: Not Authenticated
|
||||
403_title: Permission Denied
|
||||
404_title: Not Found
|
||||
404_link_text: "Return to {forum}"
|
||||
|
||||
# These translations are used in the Forgot Password modal dialog.
|
||||
forgot_password:
|
||||
dismiss_button: => core.ref.okay
|
||||
@ -517,10 +526,6 @@ core:
|
||||
csrf_token_mismatch: You have been inactive for too long.
|
||||
csrf_token_mismatch_return_link: Go back, to try again
|
||||
invalid_confirmation_token: This confirmation link has already been used or is invalid.
|
||||
not_authenticated: You do not have permission to access this page. Try again after logging in.
|
||||
not_found: The page you requested could not be found.
|
||||
not_found_return_link: "Return to {forum}"
|
||||
permission_denied: You do not have permission to access this page.
|
||||
unknown: An error occurred while trying to load this page.
|
||||
|
||||
# Translations in this namespace are displayed by the basic HTML discussion index.
|
||||
|
@ -1,12 +0,0 @@
|
||||
@extends('flarum.forum::layouts.basic')
|
||||
|
||||
@section('content')
|
||||
<p>
|
||||
{{ $message }}
|
||||
</p>
|
||||
<p>
|
||||
<a href="{{ $url->to('forum')->base() }}">
|
||||
{{ $translator->trans('core.views.error.not_found_return_link', ['{forum}' => $settings->get('forum_title')]) }}
|
||||
</a>
|
||||
</p>
|
||||
@endsection
|
Loading…
x
Reference in New Issue
Block a user