diff options
author | Zarino Zappia <mail@zarino.co.uk> | 2016-09-30 16:34:00 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-10-13 19:22:11 +0100 |
commit | a5ef113e2cc3105da41cf5449b505db6fa336c59 (patch) | |
tree | c60d906c0b5dd6fc974a35f8e921ae728dab080c /perllib/FixMyStreet/DB | |
parent | 3872c39f5426165c3abfe397d15dd2a63f731e26 (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/DB')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Nearby.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm index 9db1c6525..8b8951007 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm @@ -10,7 +10,7 @@ sub to_body { } sub nearby { - my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $interval, $category, $states ) = @_; + my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $interval, $categories, $states ) = @_; unless ( $states ) { $states = FixMyStreet::DB::Result::Problem->visible_states(); @@ -24,7 +24,7 @@ sub nearby { if $interval; $params->{id} = { -not_in => $ids } if $ids; - $params->{category} = $category if $category; + $params->{category} = $categories if $categories && @$categories; $rs = $c->cobrand->problems_restriction($rs); diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 9ce7da1c0..723a6e7c2 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -140,7 +140,7 @@ sub _recent { # Problems around a location sub around_map { - my ( $rs, $min_lat, $max_lat, $min_lon, $max_lon, $interval, $limit, $category, $states ) = @_; + my ( $rs, $min_lat, $max_lat, $min_lon, $max_lon, $interval, $limit, $categories, $states ) = @_; my $attr = { order_by => { -desc => 'created' }, }; @@ -158,7 +158,7 @@ sub around_map { }; $q->{'current_timestamp - lastupdate'} = { '<', \"'$interval'::interval" } if $interval; - $q->{category} = $category if $category; + $q->{category} = $categories if $categories && @$categories; my @problems = mySociety::Locale::in_gb_locale { $rs->search( $q, $attr )->all }; return \@problems; |