aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/About.pm1
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm34
2 files changed, 26 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/About.pm b/perllib/FixMyStreet/App/Controller/About.pm
index 233da25d3..48a5dfffd 100755
--- a/perllib/FixMyStreet/App/Controller/About.pm
+++ b/perllib/FixMyStreet/App/Controller/About.pm
@@ -23,6 +23,7 @@ sub page : Path("/about") : Args(1) {
my $template = $c->forward('find_template');
$c->detach('/page_error_404_not_found', []) unless $template;
$c->stash->{template} = $template;
+ $c->cobrand->call_hook('about_hook');
}
sub index : Path("/about") : Args(0) {
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index e19c7628f..b0015acc5 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -71,6 +71,7 @@ sub index : Path : Args(0) {
my $dashboard = eval {
my $data = FixMyStreet->config('TEST_DASHBOARD_DATA');
+ # uncoverable branch true
unless ($data) {
my $fn = '../data/all-reports-dashboard';
if ($c->stash->{body}) {
@@ -155,6 +156,7 @@ sub ward : Path : Args(2) {
$c->res->redirect($ward);
$c->detach;
}
+ $c->cobrand->call_hook('council_dashboard_hook');
$c->go('index');
}
@@ -330,17 +332,35 @@ sub body_check : Private {
# Oslo/ kommunes sharing a name in Norway
return if $c->cobrand->reports_body_check( $c, $q_body );
+ my $body = $c->forward('body_find', [ $q_body ]);
+ if ($body) {
+ $c->stash->{body} = $body;
+ return;
+ }
+
+ # No result, bad body name.
+ $c->detach( 'redirect_index' );
+}
+
+=head2
+
+Given a string, try and find a body starting with/matching that string.
+Returns the matching body object if found.
+
+=cut
+
+sub body_find : Private {
+ my ($self, $c, $q_body) = @_;
+
# We must now have a string to check
my @bodies = $c->model('DB::Body')->search( { name => { -like => "$q_body%" } } )->all;
if (@bodies == 1) {
- $c->stash->{body} = $bodies[0];
- return;
+ return $bodies[0];
} else {
foreach (@bodies) {
if (lc($_->name) eq lc($q_body) || $_->name =~ /^\Q$q_body\E (Borough|City|District|County) Council$/i) {
- $c->stash->{body} = $_;
- return;
+ return $_;
}
}
}
@@ -353,13 +373,9 @@ sub body_check : Private {
if (@translations == 1) {
if ( my $body = $c->model('DB::Body')->find( { id => $translations[0]->object_id } ) ) {
- $c->stash->{body} = $body;
- return;
+ return $body;
}
}
-
- # No result, bad body name.
- $c->detach( 'redirect_index' );
}
=head2 ward_check