aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-01-24 17:12:13 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-05-09 12:57:58 +0100
commit9da59471cd094567b214db643f2ffc471f823dca (patch)
treedd133b4a89affaa41fbd10f195a9aa8b68925f92
parent2012321cda35654d33708e60404d33742b48ead1 (diff)
Cobrand hook for showing all states in filter.
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm6
-rw-r--r--templates/web/base/reports/_list-filters.html5
3 files changed, 7 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9486b76f8..a06e4ebf6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -57,6 +57,7 @@
- Add validation to cobrand-specific custom reporting fields.
- Drop support for IE7, improve IE8 support. #2114
- Add ability to have category extra help text.
+ - Cobrand hook for showing all states in filter.
* v2.3.1 (12th February 2018)
- Front end improvements:
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index f4da58d20..fb7c4e4f3 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -706,9 +706,9 @@ sub stash_report_filter_status : Private {
$filter_status{unshortlisted} = 1;
}
- if ($c->user and ($c->user->is_superuser or (
- $c->stash->{body} and $c->user->belongs_to_body($c->stash->{body}->id)
- ))) {
+ my $body_user = $c->user_exists && $c->stash->{body} && $c->user->belongs_to_body($c->stash->{body}->id);
+ my $staff_user = $c->user_exists && ($c->user->is_superuser || $body_user);
+ if ($staff_user || $c->cobrand->call_hook('filter_show_all_states')) {
$c->stash->{filter_states} = $c->cobrand->state_groups_inspect;
foreach my $state (FixMyStreet::DB::Result::Problem->visible_states()) {
if ($status{$state}) {
diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html
index 5260aa773..928d54452 100644
--- a/templates/web/base/reports/_list-filters.html
+++ b/templates/web/base/reports/_list-filters.html
@@ -1,7 +1,8 @@
+[% SET show_all_states = c.cobrand.filter_show_all_states OR (c.user_exists AND (c.user.is_superuser OR c.user.belongs_to_body(body.id))) %]
[% select_status = BLOCK %]
<select class="form-control js-multiple" name="status" id="statuses" multiple
data-all="[% loc('All') %]"
- [% IF c.user_exists AND c.user.is_superuser OR c.user.belongs_to_body(body.id) %]
+ [% IF show_all_states %]
[% options = []; FOR group IN filter_states; FOR state IN group.1; NEXT IF state == 'hidden'; options.push(state); END; END %]
data-all-options='["[% options.join('", "') %]"]'
[%~ ELSE ~%]
@@ -17,7 +18,7 @@
<option value="shortlisted"[% ' selected' IF filter_status.shortlisted %]>[% loc('Shortlisted') %]</option>
<option value="unshortlisted"[% ' selected' IF filter_status.unshortlisted %]>[% loc('Unshortlisted') %]</option>
[% END %]
- [% IF c.user_exists AND c.user.is_superuser OR c.user.belongs_to_body(body.id) %]
+ [% IF show_all_states %]
[% FOR group IN filter_states %]
[% FOR state IN group.1 %]
[% NEXT IF state == 'hidden' %]