aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2014-02-20 12:15:55 +0000
committerHakim Cassimally <hakim@mysociety.org>2014-03-05 09:48:05 +0000
commit715f69d0c3a6232167a1f378944c8ad4886387f5 (patch)
treece7faa7c56ae8a003e3d162b11c7725f6bf1700f
parent13f4bc9ccde5b73858785c96a63451842273fda6 (diff)
Cobrand 'hidden_categories' method
This deals with the issue of hiding a two_tier category for the Hart cobrand, without removing it for the whole of Hampshire, e.g. see https://github.com/mysociety/FixMyStreet-Commercial/issues/477 but is written as a generic extension to setup_categories_and_bodies as it may be generally useful.
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm9
-rw-r--r--perllib/FixMyStreet/Cobrand/Hart.pm6
2 files changed, 15 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 7fe92bd70..fcab4e49a 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -666,6 +666,15 @@ sub setup_categories_and_bodies : Private {
}
}
+ if ($c->cobrand->can('hidden_categories')) {
+ my %hidden_categories = map { $_ => 1 }
+ $c->cobrand->hidden_categories;
+
+ @category_options = grep {
+ !$hidden_categories{$_}
+ } @category_options;
+ }
+
# put results onto stash for display
$c->stash->{bodies} = \%bodies;
$c->stash->{all_body_names} = [ map { $_->name } values %bodies ];
diff --git a/perllib/FixMyStreet/Cobrand/Hart.pm b/perllib/FixMyStreet/Cobrand/Hart.pm
index eddd48774..cab834b69 100644
--- a/perllib/FixMyStreet/Cobrand/Hart.pm
+++ b/perllib/FixMyStreet/Cobrand/Hart.pm
@@ -44,6 +44,12 @@ sub example_places {
return ( 'GU51 4JX', 'Primrose Drive' );
}
+sub hidden_categories {
+ return (
+ 'Graffiti on bridges/subways',
+ );
+}
+
sub send_questionnaires {
return 0;
}