Skip to content

Commit

Permalink
[Zurich] use report_page_data cobrand hook
Browse files Browse the repository at this point in the history
remove hard coded report page behaviour
  • Loading branch information
struan committed Sep 12, 2018
1 parent 07afa1a commit 57c79ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
23 changes: 0 additions & 23 deletions perllib/FixMyStreet/App/Controller/Reports.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,6 @@ Show the summary page of all reports.
sub index : Path : Args(0) {
my ( $self, $c ) = @_;

# Zurich goes straight to map page, with all reports
if ( $c->cobrand->moniker eq 'zurich' ) {
$c->stash->{page} = 'reports';
$c->forward( 'stash_report_filter_status' );
$c->forward( 'load_and_group_problems' );
$c->stash->{body} = { id => 0 }; # So template can fetch the list

if ($c->get_param('ajax')) {
$c->detach('ajax', [ 'reports/_problem-list.html' ]);
}

my $pins = $c->stash->{pins};
FixMyStreet::Map::display_map(
$c,
latitude => @$pins ? $pins->[0]{latitude} : 0,
longitude => @$pins ? $pins->[0]{longitude} : 0,
area => 274456,
pins => $pins,
any_zoom => 1,
);
return 1;
}

if ( $c->cobrand->call_hook('report_page_data') ) {
return 1;
}
Expand Down
25 changes: 25 additions & 0 deletions perllib/FixMyStreet/Cobrand/Zurich.pm
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,31 @@ sub get_or_check_overdue {
return $self->overdue($problem);
}

sub report_page_data {
my $self = shift;
my $c = $self->{c};

$c->stash->{page} = 'reports';
$c->forward( 'stash_report_filter_status' );
$c->forward( 'load_and_group_problems' );
$c->stash->{body} = { id => 0 }; # So template can fetch the list

if ($c->get_param('ajax')) {
$c->detach('ajax', [ 'reports/_problem-list.html' ]);
}

my $pins = $c->stash->{pins};
FixMyStreet::Map::display_map(
$c,
latitude => @$pins ? $pins->[0]{latitude} : 0,
longitude => @$pins ? $pins->[0]{longitude} : 0,
area => 274456,
pins => $pins,
any_zoom => 1,
);
return 1;
}

=head1 C<set_problem_state>
If the state has changed, sets the state and calls C::Admin's C<log_edit> action.
Expand Down

0 comments on commit 57c79ad

Please sign in to comment.