diff options
author | Dave Arter <davea@mysociety.org> | 2016-11-24 13:56:00 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-12-13 16:18:32 +0000 |
commit | 05ba5147de9dc7b68f3c9048771fcabf80f20eca (patch) | |
tree | 98c109042400302d942eaae61abecad4dba67511 /perllib/FixMyStreet/App/Controller/Report.pm | |
parent | b377665d0d839825afa65e7393cfedb13ae85e80 (diff) |
Display nearby candidate reports when marking as duplicate
- Use Problem->pin_data for single report page
- Promote markers_highlight to fixmystreet.maps API
We want to highlight map pins on the duplicate report selection UI, so let's use
what's already there instead of writing something new.
- Make sure duplicate report pins aren’t draggable
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index f9eaf583c..154f0ac94 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -231,13 +231,8 @@ sub generate_map_tags : Private { latitude => $problem->latitude, longitude => $problem->longitude, pins => $problem->used_map - ? [ { - latitude => $problem->latitude, - longitude => $problem->longitude, - colour => $c->cobrand->pin_colour($problem, 'report'), - type => 'big', - } ] - : [], + ? [ $problem->pin_data($c, 'report', type => 'big') ] + : [], ); return 1; @@ -431,14 +426,21 @@ sub nearby_json : Private { my $nearby = $c->model('DB::Nearby')->nearby( $c, $dist, [ $p->id ], 5, $p->latitude, $p->longitude, undef, [ $p->category ], undef ); - # my @reports = map { $_->problem : $_; } @$nearby; + my @pins = map { + my $p = $_->problem; + my $colour = $c->cobrand->pin_colour( $p, 'around' ); + [ $p->latitude, $p->longitude, + $colour, + $p->id, $p->title_safe, 'small', JSON->false + ] + } @$nearby; my $on_map_list_html = $c->render_fragment( 'around/on_map_list_items.html', { on_map => [], around_map => $nearby } ); - my $json = {}; + my $json = { pins => \@pins }; $json->{current} = $on_map_list_html if $on_map_list_html; my $body = encode_json($json); $c->res->content_type('application/json; charset=utf-8'); |