aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm10
-rw-r--r--templates/web/base/report/_item_expandable.html5
-rw-r--r--web/cobrands/sass/_base.scss6
-rw-r--r--web/js/duplicates.js4
6 files changed, 31 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7696a6691..727c2b8e3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@
- Use nicer default photo upload message. #2358
- Remove pan control from mobile widths. #2865
- Use category groups whenever category lists are shown. #2702
+ - Display map inline with duplicate suggestions on mobile. #2668
- Admin improvements:
- Add new roles system, to group permissions and apply to users. #2483
- Contact form emails now include user admin links.
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 9cc810c16..7dfda1a4c 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -590,7 +590,13 @@ sub inspect : Private {
sub map :Chained('id') :Args(0) {
my ($self, $c) = @_;
- my $image = $c->stash->{problem}->static_map;
+ my %params;
+ if ( $c->get_param('inline_duplicate') ) {
+ $params{full_size} = 1;
+ $params{zoom} = 5;
+ }
+
+ my $image = $c->stash->{problem}->static_map(%params);
$c->res->content_type($image->{content_type});
$c->res->body($image->{data});
}
@@ -639,7 +645,7 @@ sub _nearby_json :Private {
my $list_html = $c->render_fragment(
'report/nearby.html',
- { reports => $nearby }
+ { reports => $nearby, inline_maps => $c->get_param("inline_maps") ? 1 : 0 }
);
my $json = { pins => \@pins };
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index d9bb8e125..f10f1f7ec 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -1045,7 +1045,7 @@ sub pin_data {
};
sub static_map {
- my ($self) = @_;
+ my ($self, %params) = @_;
return unless $IM;
@@ -1053,7 +1053,11 @@ sub static_map {
unless $FixMyStreet::Map::map_class->isa("FixMyStreet::Map::OSM");
my $map_data = $FixMyStreet::Map::map_class->generate_map_data(
- { cobrand => $self->get_cobrand_logged },
+ {
+ cobrand => $self->get_cobrand_logged,
+ distance => 1, # prevents the call to Gaze which isn't necessary
+ $params{zoom} ? ( zoom => $params{zoom} ) : (),
+ },
latitude => $self->latitude,
longitude => $self->longitude,
pins => $self->used_map
@@ -1110,7 +1114,7 @@ sub static_map {
$image->Extent( geometry => '512x384', gravity => 'NorthWest');
$image->Extent( geometry => '512x320', gravity => 'SouthWest');
- $image->Scale( geometry => "310x200>" );
+ $image->Scale( geometry => "310x200>" ) unless $params{full_size};
my @blobs = $image->ImageToBlob(magick => 'jpeg');
undef $image;
diff --git a/templates/web/base/report/_item_expandable.html b/templates/web/base/report/_item_expandable.html
index ed3ce751c..fad935407 100644
--- a/templates/web/base/report/_item_expandable.html
+++ b/templates/web/base/report/_item_expandable.html
@@ -44,6 +44,11 @@
[% INCLUDE 'report/_main_sent_info.html' %]
[% INCLUDE 'report/photo.html' object=problem %]
[% full_detail %]
+ [% IF inline_maps %]
+ <div class="duplicate-map">
+ <img src="/report/[% problem.id %]/map?inline_duplicate=1" alt="" />
+ </div>
+ [% END %]
</div>
<div class="item-list__item--expandable__actions">
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index a9e0da128..bdd292e06 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -1489,6 +1489,12 @@ input.final-submit {
}
}
+.item-list__item .duplicate-map {
+ padding: 1em;
+ clear: both;
+ text-align: center;
+}
+
.problem-header .update-img,
.item-list .update-img {
float: $right;
diff --git a/web/js/duplicates.js b/web/js/duplicates.js
index ede22dc18..22f800694 100644
--- a/web/js/duplicates.js
+++ b/web/js/duplicates.js
@@ -42,6 +42,10 @@
url_params.pin_size = 'normal';
}
+ if ($('html').hasClass('mobile')) {
+ url_params.inline_maps = 1;
+ }
+
if (category && params && params.check_duplicates_dismissal ) {
dismissed = category === dismissed_category;
dismissed_category = category;