diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | t/app/controller/index.t | 6 | ||||
-rw-r--r-- | templates/web/base/around/_error_multiple.html | 2 | ||||
-rw-r--r-- | templates/web/base/around/postcode_form.html | 4 | ||||
-rw-r--r-- | templates/web/oxfordshire/around/postcode_form.html | 4 |
5 files changed, 14 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 14cc5fe9c..2bf209262 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ made in a private category. #2528 - Improve map JavaScript defensiveness. - Upgrade jquery-validation plugin. #2540 + - Pass ‘filter_category’ param to front page to pre-filter map. - Admin improvements: - Add new roles system, to group permissions and apply to users. #2483 - New features: diff --git a/t/app/controller/index.t b/t/app/controller/index.t index bd268b3d7..691eb0007 100644 --- a/t/app/controller/index.t +++ b/t/app/controller/index.t @@ -91,6 +91,12 @@ subtest "prefilters /around if user has categories" => sub { $mech->content_contains("Cows,Potholes"); }; +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->content_contains("MyUniqueTestCategory"); +}; + END { done_testing(); } diff --git a/templates/web/base/around/_error_multiple.html b/templates/web/base/around/_error_multiple.html index 34164973a..3b9f71849 100644 --- a/templates/web/base/around/_error_multiple.html +++ b/templates/web/base/around/_error_multiple.html @@ -10,7 +10,7 @@ [% IF match.icon %] <img src="[% match.icon %]" alt=""> [% END %] - <a href="/around?lat=[% match.latitude | uri %]&lon=[% match.longitude | uri %][% IF c.req.params.category %]&category=[% c.req.params.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 %]">[% match.address | html %]</a> </li> [% END %] </ul> diff --git a/templates/web/base/around/postcode_form.html b/templates/web/base/around/postcode_form.html index ca82f3388..e6ffc7184 100644 --- a/templates/web/base/around/postcode_form.html +++ b/templates/web/base/around/postcode_form.html @@ -20,7 +20,9 @@ <input type="hidden" name="partial" value="[% partial_token.token %]"> [% END %] - [% IF c.user_exists AND c.user.categories.size %] + [% IF c.get_param('filter_category') %] + <input type="hidden" name="filter_category" value="[% c.get_param('filter_category') | html %]"> + [% ELSIF c.user_exists AND c.user.categories.size %] <input type="hidden" name="filter_category" value="[% c.user.categories_string | html %]"> [% END %] </form> diff --git a/templates/web/oxfordshire/around/postcode_form.html b/templates/web/oxfordshire/around/postcode_form.html index f598f1f98..c6028e7d6 100644 --- a/templates/web/oxfordshire/around/postcode_form.html +++ b/templates/web/oxfordshire/around/postcode_form.html @@ -19,7 +19,9 @@ <input type="hidden" name="partial" value="[% partial_token.token %]"> [% END %] - [% IF c.user_exists AND c.user.categories.size %] + [% IF c.get_param('filter_category') %] + <input type="hidden" name="filter_category" value="[% c.get_param('filter_category') | html %]"> + [% ELSIF c.user_exists AND c.user.categories.size %] <input type="hidden" name="filter_category" value="[% c.user.categories.join(",") | html %]"> [% END %] </form> |