aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xperllib/FixMyStreet/App/Controller/About.pm67
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Static.pm51
-rw-r--r--t/app/controller/about.t9
-rw-r--r--templates/web/arreglamibarrio/about/faq-es.html (renamed from templates/web/arreglamibarrio/faq/faq-es.html)0
-rwxr-xr-xtemplates/web/barnet/about/faq-en-gb.html (renamed from templates/web/barnet/faq/faq-en-gb.html)0
-rw-r--r--templates/web/base/about/about-en-gb.html (renamed from templates/web/base/static/about-en-gb.html)0
-rwxr-xr-xtemplates/web/base/about/faq-en-gb.html (renamed from templates/web/base/faq/faq-en-gb.html)0
-rwxr-xr-xtemplates/web/base/about/iphone.html (renamed from templates/web/base/static/iphone.html)0
-rwxr-xr-xtemplates/web/base/about/privacy.html (renamed from templates/web/base/static/privacy.html)0
-rwxr-xr-xtemplates/web/bromley/about/faq-en-gb.html (renamed from templates/web/bromley/faq/faq-en-gb.html)0
-rwxr-xr-xtemplates/web/eastsussex/about/faq-en-gb.html (renamed from templates/web/eastsussex/faq/faq-en-gb.html)0
-rw-r--r--templates/web/emptyhomes/about/about-cy.html (renamed from templates/web/emptyhomes/static/about-cy.html)0
-rw-r--r--templates/web/emptyhomes/about/about-en-gb.html (renamed from templates/web/emptyhomes/static/about-en-gb.html)0
-rw-r--r--templates/web/emptyhomes/about/faq-cy.html (renamed from templates/web/emptyhomes/faq/faq-cy.html)0
-rwxr-xr-xtemplates/web/emptyhomes/about/faq-en-gb.html (renamed from templates/web/emptyhomes/faq/faq-en-gb.html)0
-rw-r--r--templates/web/fiksgatami/about/faq-nb.html (renamed from templates/web/fiksgatami/faq/faq-nb.html)0
-rw-r--r--templates/web/fiksgatami/about/faq-nn.html (renamed from templates/web/fiksgatami/nn/faq/faq-nn.html)0
-rwxr-xr-xtemplates/web/fixamingata/about/council.html (renamed from templates/web/fixamingata/static/council.html)0
-rwxr-xr-xtemplates/web/fixamingata/about/faq-sv.html (renamed from templates/web/fixamingata/faq/faq-sv.html)0
-rw-r--r--templates/web/fixamingata/about/fun.html (renamed from templates/web/fixamingata/static/fun.html)0
-rwxr-xr-xtemplates/web/fixamingata/about/privacy.html (renamed from templates/web/fixamingata/static/privacy.html)0
-rw-r--r--templates/web/fixmindelo/about/faq-pt-cv.html (renamed from templates/web/fixmindelo/faq/faq-pt-cv.html)0
-rw-r--r--templates/web/fixmindelo/about/privacy.html (renamed from templates/web/fixmindelo/static/privacy.html)0
-rw-r--r--templates/web/fixmybarangay/about/faq-en-gb.html (renamed from templates/web/fixmybarangay/faq/faq-en-gb.html)0
-rw-r--r--templates/web/fixmystreet-uk-councils/about/privacy.html (renamed from templates/web/fixmystreet-uk-councils/static/privacy.html)0
-rw-r--r--templates/web/fixmystreet.com/about/council.html (renamed from templates/web/fixmystreet.com/static/council.html)0
-rwxr-xr-xtemplates/web/fixmystreet.com/about/faq-en-gb.html (renamed from templates/web/fixmystreet.com/faq/faq-en-gb.html)0
-rw-r--r--templates/web/fixmystreet.com/about/posters.html (renamed from templates/web/fixmystreet.com/static/posters.html)0
-rwxr-xr-xtemplates/web/fixmystreet.com/about/privacy.html (renamed from templates/web/fixmystreet.com/static/privacy.html)0
-rw-r--r--templates/web/fixmystreet/about/fun.html (renamed from templates/web/fixmystreet/static/fun.html)0
-rw-r--r--templates/web/greenwich/about/faq-en-gb.html (renamed from templates/web/greenwich/faq/faq-en-gb.html)0
-rwxr-xr-xtemplates/web/harrogate/about/faq-en-gb.html (renamed from templates/web/harrogate/faq/faq-en-gb.html)0
-rwxr-xr-xtemplates/web/harrogate/about/privacy.html (renamed from templates/web/harrogate/static/privacy.html)0
-rwxr-xr-xtemplates/web/hart/about/faq-en-gb.html (renamed from templates/web/hart/faq/faq-en-gb.html)0
-rwxr-xr-xtemplates/web/oxfordshire/about/faq-en-gb.html (renamed from templates/web/oxfordshire/faq/faq-en-gb.html)0
-rw-r--r--templates/web/stevenage/about/faq-en-gb.html (renamed from templates/web/stevenage/faq/faq-en-gb.html)0
-rwxr-xr-xtemplates/web/warwickshire/about/faq-en-gb.html (renamed from templates/web/warwickshire/faq/faq-en-gb.html)0
-rw-r--r--templates/web/zerotb/about/faq-en-gb.html (renamed from templates/web/zerotb/faq/faq-en-gb.html)0
-rw-r--r--templates/web/zurich/about/faq-de-ch.html (renamed from templates/web/zurich/faq/faq-de-ch.html)0
39 files changed, 85 insertions, 42 deletions
diff --git a/perllib/FixMyStreet/App/Controller/About.pm b/perllib/FixMyStreet/App/Controller/About.pm
new file mode 100755
index 000000000..78e548c5f
--- /dev/null
+++ b/perllib/FixMyStreet/App/Controller/About.pm
@@ -0,0 +1,67 @@
+package FixMyStreet::App::Controller::About;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller'; }
+
+=head1 NAME
+
+FixMyStreet::App::Controller::About - Catalyst Controller
+
+=head1 DESCRIPTION
+
+About pages Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+my %found;
+
+sub page : Path("/about") : Args(1) {
+ my ( $self, $c, $page ) = @_;
+ my $template = $c->forward('find_template');
+ $c->detach('/page_error_404_not_found', []) unless $template;
+ $c->stash->{template} = $template;
+}
+
+sub index : Path("/about") : Args(0) {
+ my ( $self, $c ) = @_;
+ $c->forward('page', [ 'about' ]);
+}
+
+# We have multiple possibilities to try, and we want to cache where we find it
+sub find_template : Private {
+ my ( $self, $c, $page ) = @_;
+
+ return $found{$page} if !FixMyStreet->config('STAGING_SITE') && exists $found{$page};
+
+ my $lang_code = $c->stash->{lang_code};
+ foreach my $dir_templates (@{$c->stash->{additional_template_paths}}, @{$c->view('Web')->paths}) {
+ foreach my $dir_static (static_dirs($page, $dir_templates)) {
+ foreach my $file ("$page-$lang_code.html", "$page.html") {
+ if (-e "$dir_templates/$dir_static/$file") {
+ $found{$page} = "$dir_static/$file";
+ return $found{$page};
+ }
+ }
+ }
+ }
+ # Cache that the page does not exist, so we don't look next time
+ $found{$page} = undef;
+ return $found{$page};
+}
+
+sub static_dirs {
+ my ($page, $dir_templates) = @_;
+ my @v = ("about");
+ # If legacy directories exist, check for templates there too;
+ # The FAQ page used to be in its own directory
+ push @v, "static" if -d "$dir_templates/static";
+ push @v, "faq" if -d "$dir_templates/faq" && $page =~ /faq/;
+ return @v;
+}
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/perllib/FixMyStreet/App/Controller/Static.pm b/perllib/FixMyStreet/App/Controller/Static.pm
index d91a07fea..5054809c7 100755
--- a/perllib/FixMyStreet/App/Controller/Static.pm
+++ b/perllib/FixMyStreet/App/Controller/Static.pm
@@ -10,56 +10,23 @@ FixMyStreet::App::Controller::Static - Catalyst Controller
=head1 DESCRIPTION
-Static pages Catalyst Controller. FAQ does some smarts to choose the correct
-template depending on language, will need extending at some point.
+Old static pages Catalyst Controller.
=head1 METHODS
=cut
-sub about : Global : Args(0) {
- my ( $self, $c ) = @_;
-
- my $lang_code = $c->stash->{lang_code};
- my $template = "static/about-$lang_code.html";
- $c->stash->{template} = $template;
-}
-
-sub privacy : Global : Args(0) {
+sub about_redirect : Private {
my ( $self, $c ) = @_;
+ $c->res->redirect( $c->uri_for_action('/about/page', [ $c->action->name ] ));
}
-sub faq : Global : Args(0) {
- my ( $self, $c ) = @_;
-
- # There should be a faq template for each language in a cobrand or default.
- # This is because putting the FAQ translations into the PO files is
- # overkill.
-
- # We rely on the list of languages for the site being restricted so that there
- # will be a faq template for that language/cobrand combo.
-
- my $lang_code = $c->stash->{lang_code};
- my $template = "faq/faq-$lang_code.html";
- $c->stash->{template} = $template;
-}
-
-sub fun : Global : Args(0) {
- my ( $self, $c ) = @_;
- # don't need to do anything here - should just pass through.
-}
-
-sub posters : Global : Args(0) {
- my ( $self, $c ) = @_;
-}
-
-sub iphone : Global : Args(0) {
- my ( $self, $c ) = @_;
-}
-
-sub council : Global : Args(0) {
- my ( $self, $c ) = @_;
-}
+sub faq : Global : Args(0) { $_[1]->forward('/about/page', ['faq']) }
+sub privacy : Global : Args(0) { $_[1]->detach('about_redirect') }
+sub fun : Global : Args(0) { $_[1]->detach('about_redirect') }
+sub posters : Global : Args(0) { $_[1]->detach('about_redirect') }
+sub iphone : Global : Args(0) { $_[1]->detach('about_redirect') }
+sub council : Global : Args(0) { $_[1]->detach('about_redirect') }
sub unresponsive : Global : Args(0) {
my ( $self, $c ) = @_;
diff --git a/t/app/controller/about.t b/t/app/controller/about.t
index fb0744d6a..750983f24 100644
--- a/t/app/controller/about.t
+++ b/t/app/controller/about.t
@@ -11,6 +11,15 @@ $mech->get_ok('/about');
$mech->content_like(qr{About us ::\s+FixMyStreet});
$mech->content_contains('html class="no-js" lang="en-gb"');
+$mech->get_ok('/privacy');
+is $mech->res->code, 200, "got 200 for final destination";
+is $mech->res->previous->code, 302, "got 302 for redirect";
+is $mech->uri->path, '/about/privacy';
+
+$mech->get('/about/page-that-does-not-exist');
+ok !$mech->res->is_success(), "want a bad response";
+is $mech->res->code, 404, "got 404";
+
FixMyStreet::override_config {
ALLOWED_COBRANDS => [ 'emptyhomes' ],
}, sub {
diff --git a/templates/web/arreglamibarrio/faq/faq-es.html b/templates/web/arreglamibarrio/about/faq-es.html
index b9ab9842e..b9ab9842e 100644
--- a/templates/web/arreglamibarrio/faq/faq-es.html
+++ b/templates/web/arreglamibarrio/about/faq-es.html
diff --git a/templates/web/barnet/faq/faq-en-gb.html b/templates/web/barnet/about/faq-en-gb.html
index bc381a509..bc381a509 100755
--- a/templates/web/barnet/faq/faq-en-gb.html
+++ b/templates/web/barnet/about/faq-en-gb.html
diff --git a/templates/web/base/static/about-en-gb.html b/templates/web/base/about/about-en-gb.html
index 9c319f051..9c319f051 100644
--- a/templates/web/base/static/about-en-gb.html
+++ b/templates/web/base/about/about-en-gb.html
diff --git a/templates/web/base/faq/faq-en-gb.html b/templates/web/base/about/faq-en-gb.html
index b60f1102a..b60f1102a 100755
--- a/templates/web/base/faq/faq-en-gb.html
+++ b/templates/web/base/about/faq-en-gb.html
diff --git a/templates/web/base/static/iphone.html b/templates/web/base/about/iphone.html
index 8f7992713..8f7992713 100755
--- a/templates/web/base/static/iphone.html
+++ b/templates/web/base/about/iphone.html
diff --git a/templates/web/base/static/privacy.html b/templates/web/base/about/privacy.html
index 11ab65311..11ab65311 100755
--- a/templates/web/base/static/privacy.html
+++ b/templates/web/base/about/privacy.html
diff --git a/templates/web/bromley/faq/faq-en-gb.html b/templates/web/bromley/about/faq-en-gb.html
index 47b8c05f7..47b8c05f7 100755
--- a/templates/web/bromley/faq/faq-en-gb.html
+++ b/templates/web/bromley/about/faq-en-gb.html
diff --git a/templates/web/eastsussex/faq/faq-en-gb.html b/templates/web/eastsussex/about/faq-en-gb.html
index 7356389cd..7356389cd 100755
--- a/templates/web/eastsussex/faq/faq-en-gb.html
+++ b/templates/web/eastsussex/about/faq-en-gb.html
diff --git a/templates/web/emptyhomes/static/about-cy.html b/templates/web/emptyhomes/about/about-cy.html
index dab6cefea..dab6cefea 100644
--- a/templates/web/emptyhomes/static/about-cy.html
+++ b/templates/web/emptyhomes/about/about-cy.html
diff --git a/templates/web/emptyhomes/static/about-en-gb.html b/templates/web/emptyhomes/about/about-en-gb.html
index e9eeea103..e9eeea103 100644
--- a/templates/web/emptyhomes/static/about-en-gb.html
+++ b/templates/web/emptyhomes/about/about-en-gb.html
diff --git a/templates/web/emptyhomes/faq/faq-cy.html b/templates/web/emptyhomes/about/faq-cy.html
index 842f0c028..842f0c028 100644
--- a/templates/web/emptyhomes/faq/faq-cy.html
+++ b/templates/web/emptyhomes/about/faq-cy.html
diff --git a/templates/web/emptyhomes/faq/faq-en-gb.html b/templates/web/emptyhomes/about/faq-en-gb.html
index 4b3e71ce2..4b3e71ce2 100755
--- a/templates/web/emptyhomes/faq/faq-en-gb.html
+++ b/templates/web/emptyhomes/about/faq-en-gb.html
diff --git a/templates/web/fiksgatami/faq/faq-nb.html b/templates/web/fiksgatami/about/faq-nb.html
index da35cb03c..da35cb03c 100644
--- a/templates/web/fiksgatami/faq/faq-nb.html
+++ b/templates/web/fiksgatami/about/faq-nb.html
diff --git a/templates/web/fiksgatami/nn/faq/faq-nn.html b/templates/web/fiksgatami/about/faq-nn.html
index 161cfbea5..161cfbea5 100644
--- a/templates/web/fiksgatami/nn/faq/faq-nn.html
+++ b/templates/web/fiksgatami/about/faq-nn.html
diff --git a/templates/web/fixamingata/static/council.html b/templates/web/fixamingata/about/council.html
index 8d968f695..8d968f695 100755
--- a/templates/web/fixamingata/static/council.html
+++ b/templates/web/fixamingata/about/council.html
diff --git a/templates/web/fixamingata/faq/faq-sv.html b/templates/web/fixamingata/about/faq-sv.html
index 05ffdaddc..05ffdaddc 100755
--- a/templates/web/fixamingata/faq/faq-sv.html
+++ b/templates/web/fixamingata/about/faq-sv.html
diff --git a/templates/web/fixamingata/static/fun.html b/templates/web/fixamingata/about/fun.html
index ff8f30e49..ff8f30e49 100644
--- a/templates/web/fixamingata/static/fun.html
+++ b/templates/web/fixamingata/about/fun.html
diff --git a/templates/web/fixamingata/static/privacy.html b/templates/web/fixamingata/about/privacy.html
index 539386be6..539386be6 100755
--- a/templates/web/fixamingata/static/privacy.html
+++ b/templates/web/fixamingata/about/privacy.html
diff --git a/templates/web/fixmindelo/faq/faq-pt-cv.html b/templates/web/fixmindelo/about/faq-pt-cv.html
index 51a24a967..51a24a967 100644
--- a/templates/web/fixmindelo/faq/faq-pt-cv.html
+++ b/templates/web/fixmindelo/about/faq-pt-cv.html
diff --git a/templates/web/fixmindelo/static/privacy.html b/templates/web/fixmindelo/about/privacy.html
index 79817af4b..79817af4b 100644
--- a/templates/web/fixmindelo/static/privacy.html
+++ b/templates/web/fixmindelo/about/privacy.html
diff --git a/templates/web/fixmybarangay/faq/faq-en-gb.html b/templates/web/fixmybarangay/about/faq-en-gb.html
index 6e8893143..6e8893143 100644
--- a/templates/web/fixmybarangay/faq/faq-en-gb.html
+++ b/templates/web/fixmybarangay/about/faq-en-gb.html
diff --git a/templates/web/fixmystreet-uk-councils/static/privacy.html b/templates/web/fixmystreet-uk-councils/about/privacy.html
index 3b077d29e..3b077d29e 100644
--- a/templates/web/fixmystreet-uk-councils/static/privacy.html
+++ b/templates/web/fixmystreet-uk-councils/about/privacy.html
diff --git a/templates/web/fixmystreet.com/static/council.html b/templates/web/fixmystreet.com/about/council.html
index 6327c8bab..6327c8bab 100644
--- a/templates/web/fixmystreet.com/static/council.html
+++ b/templates/web/fixmystreet.com/about/council.html
diff --git a/templates/web/fixmystreet.com/faq/faq-en-gb.html b/templates/web/fixmystreet.com/about/faq-en-gb.html
index c295fd430..c295fd430 100755
--- a/templates/web/fixmystreet.com/faq/faq-en-gb.html
+++ b/templates/web/fixmystreet.com/about/faq-en-gb.html
diff --git a/templates/web/fixmystreet.com/static/posters.html b/templates/web/fixmystreet.com/about/posters.html
index bcf235fa4..bcf235fa4 100644
--- a/templates/web/fixmystreet.com/static/posters.html
+++ b/templates/web/fixmystreet.com/about/posters.html
diff --git a/templates/web/fixmystreet.com/static/privacy.html b/templates/web/fixmystreet.com/about/privacy.html
index 3b077d29e..3b077d29e 100755
--- a/templates/web/fixmystreet.com/static/privacy.html
+++ b/templates/web/fixmystreet.com/about/privacy.html
diff --git a/templates/web/fixmystreet/static/fun.html b/templates/web/fixmystreet/about/fun.html
index 03d977d44..03d977d44 100644
--- a/templates/web/fixmystreet/static/fun.html
+++ b/templates/web/fixmystreet/about/fun.html
diff --git a/templates/web/greenwich/faq/faq-en-gb.html b/templates/web/greenwich/about/faq-en-gb.html
index f143581d6..f143581d6 100644
--- a/templates/web/greenwich/faq/faq-en-gb.html
+++ b/templates/web/greenwich/about/faq-en-gb.html
diff --git a/templates/web/harrogate/faq/faq-en-gb.html b/templates/web/harrogate/about/faq-en-gb.html
index e5c9e5480..e5c9e5480 100755
--- a/templates/web/harrogate/faq/faq-en-gb.html
+++ b/templates/web/harrogate/about/faq-en-gb.html
diff --git a/templates/web/harrogate/static/privacy.html b/templates/web/harrogate/about/privacy.html
index 767f80fbf..767f80fbf 100755
--- a/templates/web/harrogate/static/privacy.html
+++ b/templates/web/harrogate/about/privacy.html
diff --git a/templates/web/hart/faq/faq-en-gb.html b/templates/web/hart/about/faq-en-gb.html
index 0379b0745..0379b0745 100755
--- a/templates/web/hart/faq/faq-en-gb.html
+++ b/templates/web/hart/about/faq-en-gb.html
diff --git a/templates/web/oxfordshire/faq/faq-en-gb.html b/templates/web/oxfordshire/about/faq-en-gb.html
index b85943e0d..b85943e0d 100755
--- a/templates/web/oxfordshire/faq/faq-en-gb.html
+++ b/templates/web/oxfordshire/about/faq-en-gb.html
diff --git a/templates/web/stevenage/faq/faq-en-gb.html b/templates/web/stevenage/about/faq-en-gb.html
index 43284a463..43284a463 100644
--- a/templates/web/stevenage/faq/faq-en-gb.html
+++ b/templates/web/stevenage/about/faq-en-gb.html
diff --git a/templates/web/warwickshire/faq/faq-en-gb.html b/templates/web/warwickshire/about/faq-en-gb.html
index 98736c0a4..98736c0a4 100755
--- a/templates/web/warwickshire/faq/faq-en-gb.html
+++ b/templates/web/warwickshire/about/faq-en-gb.html
diff --git a/templates/web/zerotb/faq/faq-en-gb.html b/templates/web/zerotb/about/faq-en-gb.html
index b2607f769..b2607f769 100644
--- a/templates/web/zerotb/faq/faq-en-gb.html
+++ b/templates/web/zerotb/about/faq-en-gb.html
diff --git a/templates/web/zurich/faq/faq-de-ch.html b/templates/web/zurich/about/faq-de-ch.html
index deda32a1c..deda32a1c 100644
--- a/templates/web/zurich/faq/faq-de-ch.html
+++ b/templates/web/zurich/about/faq-de-ch.html