aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm20
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm1
2 files changed, 12 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');
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index b7573d994..ec1534fe9 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -942,6 +942,7 @@ sub pin_data {
id => $self->id,
title => $opts{private} ? $self->title : $self->title_safe,
problem => $self,
+ type => $opts{type},
}
};