diff options
-rw-r--r-- | t/app/controller/index.t | 5 | ||||
-rw-r--r-- | templates/web/base/around/_error_multiple.html | 5 | ||||
-rwxr-xr-x | templates/web/base/around/display_location.html | 4 | ||||
-rw-r--r-- | templates/web/base/around/postcode_form.html | 3 | ||||
-rw-r--r-- | templates/web/base/reports/_list-filters.html | 3 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 2 |
6 files changed, 16 insertions, 6 deletions
diff --git a/t/app/controller/index.t b/t/app/controller/index.t index 691eb0007..3f3aed48e 100644 --- a/t/app/controller/index.t +++ b/t/app/controller/index.t @@ -92,9 +92,10 @@ subtest "prefilters /around if user has categories" => sub { }; subtest "prefilters /around if filter_category given in URL" => sub { - $mech->get_ok('/?filter_category=MyUniqueTestCategory'); - # NB can't use visible_form_values because categories field is hidden + $mech->get_ok('/?filter_category=MyUniqueTestCategory&filter_group=MyUniqueTestGroup'); + # NB can't use visible_form_values because fields are hidden $mech->content_contains("MyUniqueTestCategory"); + $mech->content_contains("MyUniqueTestGroup"); }; END { diff --git a/templates/web/base/around/_error_multiple.html b/templates/web/base/around/_error_multiple.html index 3b9f71849..337ce7c77 100644 --- a/templates/web/base/around/_error_multiple.html +++ b/templates/web/base/around/_error_multiple.html @@ -10,7 +10,10 @@ [% IF match.icon %] <img src="[% match.icon %]" alt=""> [% END %] - <a href="/around?lat=[% match.latitude | uri %]&lon=[% match.longitude | uri %][% IF c.get_param('category') %]&category=[% c.get_param('category') | uri %][% END %][% IF c.get_param('filter_category') %]&filter_category=[% c.get_param('filter_category') | uri %][% END %]">[% match.address | html %]</a> + <a href="/around?lat=[% match.latitude | uri %]&lon=[% match.longitude | uri ~%] + [%~ IF c.get_param('category') %]&category=[% c.get_param('category') | uri %][% END ~%] + [%~ IF c.get_param('filter_category') %]&filter_category=[% c.get_param('filter_category') | uri %][% END ~%] + [%~ IF c.get_param('filter_group') %]&filter_group=[% c.get_param('filter_group') | uri %][% END %]">[% match.address | html %]</a> </li> [% END %] </ul> diff --git a/templates/web/base/around/display_location.html b/templates/web/base/around/display_location.html index 6c71ad631..2d36161be 100755 --- a/templates/web/base/around/display_location.html +++ b/templates/web/base/around/display_location.html @@ -51,6 +51,10 @@ <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% latitude | html %]"> <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% longitude | html %]"> + + [% IF c.get_param('filter_group') %] + <input type="hidden" name="filter_group" id="filter_group" value="[% c.get_param('filter_group') | html %]"> + [% END %] [% END %] [% map_html %] diff --git a/templates/web/base/around/postcode_form.html b/templates/web/base/around/postcode_form.html index e6ffc7184..da744e1d0 100644 --- a/templates/web/base/around/postcode_form.html +++ b/templates/web/base/around/postcode_form.html @@ -20,8 +20,9 @@ <input type="hidden" name="partial" value="[% partial_token.token %]"> [% END %] - [% IF c.get_param('filter_category') %] + [% IF c.get_param('filter_category') OR c.get_param('filter_group') %] <input type="hidden" name="filter_category" value="[% c.get_param('filter_category') | html %]"> + <input type="hidden" name="filter_group" value="[% c.get_param('filter_group') | html %]"> [% ELSIF c.user_exists AND c.user.categories.size %] <input type="hidden" name="filter_category" value="[% c.user.categories_string | html %]"> [% END %] diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index b898817fc..6acb5936c 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -47,9 +47,10 @@ [% select_category = BLOCK %] [% IF filter_categories.size %] + [% SET filter_group = c.get_param('filter_group') %] <select class="form-control js-multiple" name="filter_category" id="filter_categories" multiple data-all="[% loc('Everything') %]"> [% FOR cat IN filter_categories %] - <option value="[% cat.category | html %]"[% ' selected' IF filter_category.${cat.category} %]> + <option value="[% cat.category | html %]"[% ' selected' IF filter_category.${cat.category} OR ( filter_group AND ( cat.get_extra_metadata('group') == filter_group OR cat.category == filter_group ) ) %]> [% cat.category_display | html %] [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%] </option> diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index ac2d1e2da..704a665ff 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -1242,7 +1242,7 @@ fixmystreet.fetch_reporting_data = function() { return; } $('#side-form').show(); - var old_category_group = $('#category_group').val(), + var old_category_group = $('#category_group').val() || $('#filter_group').val(), old_category = $("#form_category").val(), filter_category = $("#filter_categories").val(); |