aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-02-22 18:13:40 +0000
committerEdmund von der Burg <evdb@mysociety.org>2011-02-22 18:13:40 +0000
commit0f515f88ef3ca7c5711c41f8066afb689e3f5b58 (patch)
treef639b23ca9080418d230f38beb129929134baefc /perllib/FixMyStreet
parentb0ea7a45ef55e01a911121f3e2785a01bb619505 (diff)
Added templated 404 page as default
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Root.pm41
1 files changed, 19 insertions, 22 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Root.pm b/perllib/FixMyStreet/App/Controller/Root.pm
index 41bca4b7f..fc3932975 100644
--- a/perllib/FixMyStreet/App/Controller/Root.pm
+++ b/perllib/FixMyStreet/App/Controller/Root.pm
@@ -4,11 +4,7 @@ use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller' }
-#
-# Sets the actions in this controller to be registered with no prefix
-# so they function identically to actions created in MyApp.pm
-#
-__PACKAGE__->config(namespace => '');
+__PACKAGE__->config( namespace => '' );
=head1 NAME
@@ -26,7 +22,7 @@ The root page (/)
=cut
-sub index :Path :Args(0) {
+sub index : Path : Args(0) {
my ( $self, $c ) = @_;
# Hello World
@@ -35,38 +31,39 @@ sub index :Path :Args(0) {
=head2 default
-Standard 404 error page
+Forward to the standard 404 error page
=cut
-sub default :Path {
+sub default : Path {
my ( $self, $c ) = @_;
-
- $c->response->body( "Fallen through to FixMyStreet::App default handler" );
-
- # $c->response->body( 'Page not found' );
- # $c->response->status(404);
+ $c->detach('/page_not_found');
}
-=head2 end
+=head2 page_not_found
-Attempt to render a view, if needed.
+ $c->detach('/page_not_found');
-=cut
+Display a 404 page.
-sub end : ActionClass('RenderView') {}
+=cut
-=head1 AUTHOR
+sub page_not_found : Private {
+ my ( $self, $c ) = @_;
-Edmund von der Burg,,,
+ $c->stash->{template} = 'errors/page_not_found.html';
+ $c->response->status(404);
+}
-=head1 LICENSE
+=head2 end
-This library is free software. You can redistribute it and/or modify
-it under the same terms as Perl itself.
+Attempt to render a view, if needed.
=cut
+sub end : ActionClass('RenderView') {
+}
+
__PACKAGE__->meta->make_immutable;
1;