aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2018-05-11 13:10:37 +0100
committerDave Arter <davea@mysociety.org>2018-05-14 10:52:02 +0100
commitf87b9273fee851e0426ac6a86b8455d59c9e703c (patch)
tree8c53a067f398cafa5b757592af06de4bfcc9a105 /perllib
parent17431f583e5362d205f4b6c75be5d11aa17dc97b (diff)
Add UI for selecting multiple wards from /reports/ body page
Fixes mysociety/fixmystreetforcouncils#231
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index fb7c4e4f3..5dd5a5959 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -126,6 +126,17 @@ sub ward : Path : Args(2) {
my @wards = split /\|/, $ward || "";
$c->forward( 'body_check', [ $body ] );
+ # If viewing multiple wards, rewrite the url from
+ # /reports/Borsetshire?ward=North&ward=East
+ # to
+ # /reports/Borsetshire/North|East
+ my @ward_params = $c->get_param_list('ward');
+ if ( @ward_params ) {
+ $c->stash->{wards} = [ map { { name => $_ } } (@wards, @ward_params) ];
+ delete $c->req->params->{ward};
+ $c->detach("redirect_body");
+ }
+
my $body_short = $c->cobrand->short_name( $c->stash->{body} );
$c->stash->{body_url} = '/reports/' . $body_short;