aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm27
1 files changed, 19 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 9826a8945..ade04fc7c 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -40,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');
@@ -82,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.