diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 20 |
3 files changed, 32 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 6b222be4c..57b2d781e 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -173,7 +173,10 @@ sub format_problem_for_display : Private { if ( $c->stash->{ajax} ) { $c->res->content_type('application/json; charset=utf-8'); my $content = JSON->new->utf8(1)->encode( - $c->cobrand->problem_as_hashref( $problem, $c ) + { + report => $c->cobrand->problem_as_hashref( $problem, $c ), + updates => $c->cobrand->updates_as_hashref( $problem, $c ), + } ); $c->res->body( $content ); return 1; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 2292a6cf3..374578713 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -826,5 +826,13 @@ sub problem_as_hashref { return $problem->as_hashref( $ctx ); } +sub updates_as_hashref { + my $self = shift; + my $problem = shift; + my $ctx = shift; + + return {}; +} + 1; diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 7cc8abb2f..2a97807de 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -81,6 +81,26 @@ sub problem_as_hashref { return $hashref; } +sub updates_as_hashref { + my $self = shift; + my $problem = shift; + my $ctx = shift; + + my $hashref = {}; + + if ( $problem->state eq 'fixed - council' || $problem->state eq 'closed' ) { + $hashref->{update_pp} = $self->prettify_dt( $problem->lastupdate_local ); + + if ( $problem->state eq 'fixed - council' ) { + $hashref->{details} = FixMyStreet::App::View::Web->add_links( $ctx, $problem->extra->{public_response} ); + } elsif ( $problem->state eq 'closed' ) { + $hashref->{details} = sprintf( _('Assigned to %s'), $problem->body($ctx)->name ); + } + } + + return $hashref; +} + sub remove_redundant_areas { my $self = shift; my $all_areas = shift; |