aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App.pm
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2016-09-30 16:34:00 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-10-13 19:22:11 +0100
commita5ef113e2cc3105da41cf5449b505db6fa336c59 (patch)
treec60d906c0b5dd6fc974a35f8e921ae728dab080c /perllib/FixMyStreet/App.pm
parent3872c39f5426165c3abfe397d15dd2a63f731e26 (diff)
Allow multiple selections in report list filter.
This lets people filter by multiple categories or states. It uses our jQuery multi-select plugin to turn the <select multiple>s into little overlay lists of checkboxes. HTML5 history is also supported.
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r--perllib/FixMyStreet/App.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 40a99b6d3..ab5e62233 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -447,11 +447,13 @@ a list, with an empty list if no parameter is present.
=cut
sub get_param_list {
- my ($c, $param) = @_;
+ my ($c, $param, $allow_commas) = @_;
+ die unless wantarray;
my $value = $c->req->params->{$param};
- return @$value if ref $value;
- return ($value) if defined $value;
- return ();
+ return () unless defined $value;
+ my @value = ref $value ? @$value : ($value);
+ return map { split /,/, $_ } @value if $allow_commas;
+ return @value;
}
=head2 set_param