aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App')
-rw-r--r--perllib/FixMyStreet/App/Controller/About.pm31
-rw-r--r--perllib/FixMyStreet/App/Controller/Root.pm80
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm45
3 files changed, 156 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/About.pm b/perllib/FixMyStreet/App/Controller/About.pm
new file mode 100644
index 000000000..42a0ed18e
--- /dev/null
+++ b/perllib/FixMyStreet/App/Controller/About.pm
@@ -0,0 +1,31 @@
+package FixMyStreet::App::Controller::About;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller'; }
+
+=head1 NAME
+
+FixMyStreet::App::Controller::About - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+=head2 index
+
+=cut
+
+sub index : Path : Args(0) {
+ my ( $self, $c ) = @_;
+
+ # don't need to do anything here - should just pass through.
+}
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/perllib/FixMyStreet/App/Controller/Root.pm b/perllib/FixMyStreet/App/Controller/Root.pm
new file mode 100644
index 000000000..42ac856c6
--- /dev/null
+++ b/perllib/FixMyStreet/App/Controller/Root.pm
@@ -0,0 +1,80 @@
+package FixMyStreet::App::Controller::Root;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller' }
+
+__PACKAGE__->config( namespace => '' );
+
+=head1 NAME
+
+FixMyStreet::App::Controller::Root - Root Controller for FixMyStreet::App
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=head2 auto
+
+Set up general things for this instance
+
+=cut
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+
+ # decide which cobrand this request should use
+ $c->setup_cobrand();
+
+ return 1;
+}
+
+=head2 index
+
+=cut
+
+sub index : Path : Args(0) {
+ my ( $self, $c ) = @_;
+ $c->res->body('index');
+}
+
+=head2 default
+
+Forward to the standard 404 error page
+
+=cut
+
+sub default : Path {
+ my ( $self, $c ) = @_;
+ $c->detach('/page_not_found');
+}
+
+=head2 page_not_found
+
+ $c->detach('/page_not_found');
+
+Display a 404 page.
+
+=cut
+
+sub page_not_found : Private {
+ my ( $self, $c ) = @_;
+
+ $c->stash->{template} = 'errors/page_not_found.html';
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {
+}
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
new file mode 100644
index 000000000..306e4c5a7
--- /dev/null
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -0,0 +1,45 @@
+package FixMyStreet::App::View::Web;
+use base 'Catalyst::View::TT';
+
+use strict;
+use warnings;
+
+use mySociety::Locale;
+use FixMyStreet;
+
+__PACKAGE__->config(
+ TEMPLATE_EXTENSION => '.html',
+ INCLUDE_PATH => [ #
+ FixMyStreet->path_to( 'templates', 'web', 'default' ),
+ ],
+ render_die => 1,
+ expose_methods => ['loc'],
+);
+
+=head1 NAME
+
+FixMyStreet::App::View::Web - TT View for FixMyStreet::App
+
+=head1 DESCRIPTION
+
+TT View for FixMyStreet::App.
+
+=cut
+
+=head2 loc
+
+ [% loc('Some text to localize') %]
+
+Passes the text to the localisation engine for translations.
+
+FIXME - currently just passes through.
+
+=cut
+
+sub loc {
+ my ( $self, $c, @args ) = @_;
+ return _(@args);
+}
+
+1;
+