diff options
| author | Matthew Somerville <matthew@mysociety.org> | 2020-02-25 14:56:19 +0000 | 
|---|---|---|
| committer | Matthew Somerville <matthew@mysociety.org> | 2020-02-26 13:52:14 +0000 | 
| commit | 75cf754c0b13b4547d249423c20f3fe9903deb12 (patch) | |
| tree | 678682232633e1efff3ddd3e180331ae97801b5d | |
| parent | a3575d43f6717ee745a9689d55103ce9c87587ed (diff) | |
Fix filter_group picking if category group a list.
| -rw-r--r-- | t/app/controller/around.t | 3 | ||||
| -rw-r--r-- | templates/web/base/reports/_list-filters.html | 2 | 
2 files changed, 4 insertions, 1 deletions
| diff --git a/t/app/controller/around.t b/t/app/controller/around.t index bd2bf2cee..cd992270f 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -261,6 +261,9 @@ subtest 'check category, status and extra filtering works on /around' => sub {          $mech->get_ok( '/around?filter_category=Pothole&bbox=' . $bbox );          $mech->content_contains('<option value="Pothole" selected>');          $mech->content_contains('<optgroup label="Environment">'); + +        $mech->get_ok( '/around?filter_group=Environment&bbox=' . $bbox ); +        $mech->content_contains('<option value="Flytipping" selected>');      };      $json = $mech->get_ok_json( '/around?ajax=1&filter_category=Pothole&bbox=' . $bbox ); diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index 3125f63b1..f5d1faa65 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -2,7 +2,7 @@  [% BLOCK category_options %]      [% FOR cat IN categories %] -        <option value="[% cat.category %]"[% ' selected' IF filter_category.${cat.category} OR ( filter_group AND ( cat.get_extra_metadata('group') == filter_group OR cat.category == filter_group ) ) %]> +        <option value="[% cat.category %]"[% ' selected' IF filter_category.${cat.category} OR ( filter_group AND ( cat.get_extra_metadata('group').grep(filter_group).size OR cat.category == filter_group ) ) %]>              [% cat.category_display %]              [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%]          </option> | 
