aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/Bodies.pm2
-rw-r--r--templates/web/base/admin/bodies/body.html31
-rw-r--r--templates/web/base/admin/council_contacts.txt2
-rw-r--r--templates/web/zurich/admin/bodies/body.html2
-rw-r--r--web/cobrands/sass/_admin.scss5
6 files changed, 35 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 057506c4a..5e69a106f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@
- Add user admin log page.
- Allow report as another user with only name.
- Allow staff users to sign other people up for alerts.
+ - Group categories on body page. #2850
- New features:
- Categories can be listed under more than one group #2475
- OpenID Connect login support. #2523
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
index 18bcbbc5f..4bfca21ae 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
@@ -127,6 +127,8 @@ sub edit : Chained('body') : PathPart('') : Args(0) {
# to display email addresses as text
$c->stash->{template} = 'admin/bodies/body.html';
$c->forward('/admin/fetch_contacts');
+ $c->stash->{contacts} = [ $c->stash->{contacts}->all ];
+ $c->forward('/report/stash_category_groups', [ $c->stash->{contacts}, 0 ]);
return 1;
}
diff --git a/templates/web/base/admin/bodies/body.html b/templates/web/base/admin/bodies/body.html
index 4ce97d935..0db50e97b 100644
--- a/templates/web/base/admin/bodies/body.html
+++ b/templates/web/base/admin/bodies/body.html
@@ -70,15 +70,16 @@
<table cellspacing="0" cellpadding="2" border="1" id="admin_contacts">
<tr>
- <th>[% loc('Category') %]</th>
- <th>[% loc('State') %]</th>
- <th>[% loc('Last editor') %]</th>
- <th>[% loc('Note') %]</th>
+ <th scope="col">[% loc('Category') %]</th>
+ <th scope="col">[% loc('State') %]</th>
+ <th scope="col">[% loc('Last editor') %]</th>
+ <th scope="col">[% loc('Note') %]</th>
[% IF any_not_confirmed %]
- <th>[% loc('Confirm') %]</th>
+ <th scope="col">[% loc('Confirm') %]</th>
[% END %]
</tr>
- [% WHILE ( cat = contacts.next ) %]
+
+ [% BLOCK category_row %]
<tr [% IF cat.state == 'deleted' %]class="is-deleted"[% END %]>
<td class="contact-category"><a href="[% c.uri_for_action( '/admin/bodies/edit', [ body_id ], cat.category ) %]">[% cat.category_display | html %]</a>
<br>[% cat.email | html %]</td>
@@ -102,6 +103,24 @@
[% END %]
</tr>
[% END %]
+
+ [%~ IF category_groups.size ~%]
+ [%~ FOREACH group IN category_groups ~%]
+ [% IF group.name %]
+ <tr>
+ <th class="group" colspan="[% any_not_confirmed ? 5 : 4 %]" scope="colgroup">[% group.name %]</th>
+ </tr>
+ [% END %]
+ [%~ FOREACH cat IN group.categories ~%]
+ [% INCLUDE category_row %]
+ [%~ END ~%]
+ [%~ END =%]
+ [%~ ELSE ~%]
+ [%~ FOREACH cat IN contacts ~%]
+ [% INCLUDE category_row %]
+ [%~ END =%]
+ [%~ END ~%]
+
</table>
[% IF any_not_confirmed %]
diff --git a/templates/web/base/admin/council_contacts.txt b/templates/web/base/admin/council_contacts.txt
index f11615789..2622f3fc2 100644
--- a/templates/web/base/admin/council_contacts.txt
+++ b/templates/web/base/admin/council_contacts.txt
@@ -1,4 +1,4 @@
-[% WHILE ( contact = contacts.next ) -%]
+[% FOR contact IN contacts -%]
[%- NEXT IF contact.state != 'confirmed' %]
[% contact.category_display %] [% contact.email %]
[%- END %]
diff --git a/templates/web/zurich/admin/bodies/body.html b/templates/web/zurich/admin/bodies/body.html
index 5a1a2aea4..1c1e9a427 100644
--- a/templates/web/zurich/admin/bodies/body.html
+++ b/templates/web/zurich/admin/bodies/body.html
@@ -18,7 +18,7 @@
<th>[% loc('When edited') %]</th>
<th>Kürzel</th>
</tr>
- [% WHILE ( cat = contacts.next ) %]
+ [% FOR cat IN contacts %]
<tr[% IF cat.state == 'deleted' %] class="is-deleted"[% END %]>
<td><a href="[% c.uri_for_action( 'admin/bodies/edit', [ body_id ], cat.category ) %]">[% cat.category_display %]</a></td>
<td>[% cat.email | html %]</td>
diff --git a/web/cobrands/sass/_admin.scss b/web/cobrands/sass/_admin.scss
index 3b47ea9aa..b1f914ca8 100644
--- a/web/cobrands/sass/_admin.scss
+++ b/web/cobrands/sass/_admin.scss
@@ -34,6 +34,11 @@ $button_bg_col: #a1a1a1; // also search bar (tables)
color: white;
}
}
+ th.group {
+ color: inherit;
+ background-color: inherit;
+ text-align: left;
+ }
td.record-id {
text-align: center;
font-weight: bold;