aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/JS.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-03-16 12:03:44 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-03-16 12:03:44 +0000
commitce6daecdf96955aab2f1d528d3fdc2f56213f400 (patch)
treed9dcd558705fa3434586b59e2924731ca4fe0617 /perllib/FixMyStreet/App/Controller/JS.pm
parent81a861bfd36673d0bc2f09a4f56b7666bb247b3c (diff)
Put validation strings in external file (fixes #281), tidy to only have one common_header_tags file.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/JS.pm')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/JS.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/JS.pm b/perllib/FixMyStreet/App/Controller/JS.pm
new file mode 100755
index 000000000..ae2f06605
--- /dev/null
+++ b/perllib/FixMyStreet/App/Controller/JS.pm
@@ -0,0 +1,30 @@
+package FixMyStreet::App::Controller::JS;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller'; }
+
+=head1 NAME
+
+FixMyStreet::App::Controller::JS - Catalyst Controller
+
+=head1 DESCRIPTION
+
+JS Catalyst Controller. To return a language-dependent list
+of validation strings.
+
+=head1 METHODS
+
+=cut
+
+sub validation_strings : LocalRegex('^validation_strings\.(.*?)\.js$') : Args(0) {
+ my ( $self, $c ) = @_;
+ my $lang = $c->req->captures->[0];
+ $c->cobrand->set_lang_and_domain( $lang, 1 );
+ $c->res->content_type( 'application/javascript' );
+}
+
+__PACKAGE__->meta->make_immutable;
+
+1;
+