diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 35 | ||||
-rw-r--r-- | templates/web/default/report/display.html | 3 |
2 files changed, 36 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index bbfa2c4e2..e63aaaf7a 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -96,6 +96,7 @@ sub display : Path('') : Args(1) { # ), $q); # my $fixed = ($input{fixed}) ? ' checked' : ''; + $c->forward( 'format_problem_for_display' ); # my %vars = ( # banner => $banner, # map_start => FixMyStreet::Map::display_map($q, @@ -226,6 +227,40 @@ sub load_problem_or_display_error : Private { return 1; } + +sub format_problem_for_display : Private { + my ( $self, $c ) = @_; + + my $problem = $c->stash->{problem}; + + ( my $detail = $problem->detail ) =~ s/\r//g; + my @detail = split /\n{2,}/, $detail; + $c->stash->{detail} = \@detail; + + $c->forward('generate_map_tags'); + return 1; +} + +sub generate_map_tags : Private { + my ( $self, $c ) = @_; + + my $map_links = ''; + my $problem = $c->stash->{problem}; + + $c->stash->{map_start_html} = FixMyStreet::Map::display_map( + $c->fake_q, + latitude => $problem->latitude, + longitude => $problem->longitude, + type => 0, + pins => $problem->used_map + ? [ [ $problem->latitude, $problem->longitude, 'blue' ] ] + : [], + post => $map_links + ); + $c->stash->{map_end_html} = FixMyStreet::Map::display_map_end(0), + + return 1; +} __PACKAGE__->meta->make_immutable; 1; diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html index 76871c0bc..8ff398449 100644 --- a/templates/web/default/report/display.html +++ b/templates/web/default/report/display.html @@ -4,7 +4,6 @@ INCLUDE 'header.html', title => problem_title %] -{{ $map_start }} [% map_start_html %] [% IF banner %] <p id="[% banner.id %]"> @@ -111,6 +110,6 @@ </form> </div> -{{ $map_end }} +[% map_end_html %] [% INCLUDE 'footer.html' %] |