Permalink
Browse files

return details of updates to the report in ajax call

  • Loading branch information...
1 parent 560070b commit be574e3929fa514480f4a051e6a41c0979391b46 @struan struan committed Feb 12, 2013
View
5 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;
View
8 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;
View
20 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;

0 comments on commit be574e3

Please sign in to comment.