From 21877e063f8ab9c5914adbc88c8210d2393671ae Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 22 Nov 2016 15:38:07 +0000 Subject: Add shortlist buttons to report lists. This includes adding/removing reports from a user's shortlist, and manual reordering of a shortlist with up/down buttons. The backend code can cope with an item moving to any point in the list. --- perllib/FixMyStreet/App/Controller/Around.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller/Around.pm') diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index b4f94bb35..96854b17b 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -291,6 +291,8 @@ sub ajax : Path('/ajax') { # assume this is not cacheable - may need to be more fine-grained later $c->res->header( 'Cache_Control' => 'max-age=0' ); + $c->stash->{page} = 'around'; # Needed by _item.html + # how far back should we go? my $all_pins = $c->get_param('all_pins') ? 1 : undef; my $interval = $all_pins ? undef : $c->cobrand->on_map_default_max_pin_age; -- cgit v1.2.3 From 112ab20142f7f79d4ffff557b95c53406ad79bd9 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 13 Apr 2017 14:29:56 +0100 Subject: Fix issue with categories with regex characters. As the templates were using `grep`, they failed to match on a category such as "Footpaths (right of way)". Changing the stash variables to be hashes instead of lists makes checking for a key simpler. Fixes #1688. --- perllib/FixMyStreet/App/Controller/Around.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller/Around.pm') diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 96854b17b..1fe35d0a3 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -182,7 +182,7 @@ sub display_location : Private { my ( $on_map_all, $on_map, $nearby, $distance ) = FixMyStreet::Map::map_features( $c, latitude => $latitude, longitude => $longitude, - interval => $interval, categories => $c->stash->{filter_category}, + interval => $interval, categories => [ keys %{$c->stash->{filter_category}} ], states => $c->stash->{filter_problem_states}, order => $c->stash->{sort_order}, ); @@ -264,8 +264,8 @@ sub check_and_stash_category : Private { my %categories_mapped = map { $_ => 1 } @categories; my $categories = [ $c->get_param_list('filter_category', 1) ]; - my @valid_categories = grep { $_ && $categories_mapped{$_} } @$categories; - $c->stash->{filter_category} = \@valid_categories; + my %valid_categories = map { $_ => 1 } grep { $_ && $categories_mapped{$_} } @$categories; + $c->stash->{filter_category} = \%valid_categories; } =head2 /ajax -- cgit v1.2.3