aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-02-12 17:43:20 +0000
committerStruan Donald <struan@exo.org.uk>2013-02-12 17:43:20 +0000
commitbe574e3929fa514480f4a051e6a41c0979391b46 (patch)
tree4be742d8434cd7bb4a63c4a79b3166d0c8834c72
parent560070b5a4eb210aeb08f78c553b6caa6144fbc9 (diff)
return details of updates to the report in ajax call
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm5
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm8
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm20
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;