diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Root.pm | 10 | ||||
-rw-r--r-- | templates/web/default/errors/page_not_found.html | 27 |
2 files changed, 25 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Root.pm b/perllib/FixMyStreet/App/Controller/Root.pm index 3280d02b9..33f870986 100644 --- a/perllib/FixMyStreet/App/Controller/Root.pm +++ b/perllib/FixMyStreet/App/Controller/Root.pm @@ -73,16 +73,16 @@ sub default : Path { =head2 page_not_found - $c->detach('/page_not_found'); + $c->detach('/page_not_found', [ $error_msg ] ); -Display a 404 page. +Display a 404 page. Pass in an optional error message in an arrayref. =cut sub page_not_found : Private { - my ( $self, $c ) = @_; - - $c->stash->{template} = 'errors/page_not_found.html'; + my ( $self, $c, $error_msg ) = @_; + $c->stash->{template} = 'errors/page_not_found.html'; + $c->stash->{error_msg} = $error_msg; $c->response->status(404); } diff --git a/templates/web/default/errors/page_not_found.html b/templates/web/default/errors/page_not_found.html index 92ceb3106..77db18e89 100644 --- a/templates/web/default/errors/page_not_found.html +++ b/templates/web/default/errors/page_not_found.html @@ -1,7 +1,20 @@ -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> -<html><head> -<title>404 Not Found</title> -</head><body> -<h1>Not Found</h1> -<p>The requested URL [% c.req.uri.path %] was not found on this server.</p> -</body></html> +[% INCLUDE 'header.html', title => loc('Page Not Found') %] + +<h1>[%loc('Page Not Found') %]</h1> + +[% IF error_msg %] + <p class="error">[% error_msg | html %]</p> +[% END %] + +<p> + [% + tprintf( + loc("The requested URL '%s' was not found on this server"), + c.req.uri + ) + %] +</p> + +[% # FIXME - add more helpful suggestions to this page %] + +[% INCLUDE 'footer.html' %] |