aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Develop.pm6
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm48
2 files changed, 23 insertions, 31 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Develop.pm b/perllib/FixMyStreet/App/Controller/Develop.pm
index 1cc8f8906..ae7122fa1 100755
--- a/perllib/FixMyStreet/App/Controller/Develop.pm
+++ b/perllib/FixMyStreet/App/Controller/Develop.pm
@@ -38,7 +38,7 @@ Shows a list of links to preview HTML emails.
sub index : Path('/_dev') : Args(0) {
my ( $self, $c ) = @_;
- $c->stash->{problem} = $c->model('DB::Problem')->first;
+ $c->stash->{problem} = $c->model('DB::Problem')->search(undef, { rows => 1 } )->first;
}
=item email_list
@@ -63,8 +63,8 @@ sub email_list : Path('/_dev/email') : Args(0) {
'confirm_report_sent' => 1,
'problem-moderated' => 1, 'questionnaire' => 1, 'submit' => 1);
- my $update = $c->model('DB::Comment')->first;
- my $problem = $c->model('DB::Problem')->first;
+ my $update = $c->model('DB::Comment')->search(undef, { rows => 1 } )->first;
+ my $problem = $c->model('DB::Problem')->search(undef, { rows => 1 } )->first;
$c->stash->{templates} = [];
foreach (sort keys %templates) {
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 3414f9a2f..ade04fc7c 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -31,26 +31,7 @@ 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,
- );
+ if ( $c->cobrand->call_hook('report_page_data') ) {
return 1;
}
@@ -59,14 +40,7 @@ sub index : Path : Args(0) {
$c->detach( 'redirect_body' );
}
- if (my $body = $c->get_param('body')) {
- $body = $c->model('DB::Body')->find( { id => $body } );
- if ($body) {
- $body = $c->cobrand->short_name($body);
- $c->res->redirect("/reports/$body");
- $c->detach;
- }
- }
+ $c->forward('display_body_stats');
my $dashboard = $c->forward('load_dashboard_data');
@@ -101,6 +75,24 @@ sub index : Path : Args(0) {
$c->response->header('Cache-Control' => 'max-age=3600');
}
+=head2 display_body_stats
+
+Show the stats for a body if body param is set.
+
+=cut
+
+sub display_body_stats : Private {
+ my ( $self, $c ) = @_;
+ if (my $body = $c->get_param('body')) {
+ $body = $c->model('DB::Body')->find( { id => $body } );
+ if ($body) {
+ $body = $c->cobrand->short_name($body);
+ $c->res->redirect("/reports/$body");
+ $c->detach;
+ }
+ }
+}
+
=head2 body
Show the summary page for a particular body.