From dc151edce28d2e5bf873f8e86473a82b9c6f178a Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Tue, 15 Nov 2016 17:08:57 +0000 Subject: Store and display selected duplicate report --- perllib/FixMyStreet/App/Controller/Report.pm | 2 +- perllib/FixMyStreet/DB/Result/Problem.pm | 11 +++++++++++ templates/web/base/report/_inspect.html | 11 ++++++++--- templates/web/base/report/_item.html | 2 +- web/cobrands/fixmystreet/fixmystreet.js | 21 +++++++++++++++++---- web/cobrands/sass/_report_list_pins.scss | 8 ++++++++ 6 files changed, 46 insertions(+), 9 deletions(-) diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 13967601b..a9d171d33 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -320,7 +320,7 @@ sub inspect : Private { my $reputation_change = 0; if ($permissions->{report_inspect}) { - foreach (qw/detailed_information traffic_information/) { + foreach (qw/detailed_information traffic_information duplicate_of/) { $problem->set_extra_metadata( $_ => $c->get_param($_) ); } diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index ab6f20050..c63e6c881 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -1032,4 +1032,15 @@ has shortlisted_user => ( }, ); +has duplicate_of => ( + is => 'ro', + lazy => 1, + default => sub { + my $self = shift; + my $duplicate_of = $self->get_extra_metadata("duplicate_of"); + return unless defined $duplicate_of; + return $self->result_source->schema->resultset('Problem')->search({ id => $duplicate_of })->first; + }, +); + 1; diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index a09d75d40..d5df3d42e 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -10,6 +10,7 @@

[% loc('Report ID:') %] [% problem.id %] +

[% SET local_coords = problem.local_coords; %] @@ -76,10 +77,14 @@ [% END %]

-