diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-08-18 10:43:52 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-08-18 10:43:52 +0100 |
commit | 056f3eb6d82112a990fc27d12aad6c444ed92b54 (patch) | |
tree | f669ab25b237f2fce407763a769f983feae3fa7b | |
parent | 261be473683fde3df6aa3e50bbb17a3359840b62 (diff) | |
parent | 32dadd9c34796a414baf2f8640e03d5ac6a8c0a1 (diff) |
Merge branch 'bromley-admin-templates-fix'
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 4 | ||||
-rw-r--r-- | t/cobrand/bromley.t | 1 | ||||
-rw-r--r-- | templates/web/bromley/admin/category-checkboxes.html | 22 |
3 files changed, 17 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 90e5895d5..4b4363ee3 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -326,6 +326,8 @@ sub add_admin_subcategories { my $c = $self->{c}; my $user = $c->stash->{user}; + return unless $user; # e.g. admin templates, not user + my @subcategories = @{$user->get_extra_metadata('subcategories') || []}; my %active_contacts = map { $_ => 1 } @subcategories; @@ -337,7 +339,7 @@ sub add_admin_subcategories { foreach (@{$subcats{$_->{id}}}) { push @new_contacts, { id => $_->{key}, - category => (" " x 4) . $_->{name}, + category => (" " x 4) . $_->{name}, # nbsp active => $active_contacts{$_->{key}}, }; } diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t index 71180cd3e..6a7a60811 100644 --- a/t/cobrand/bromley.t +++ b/t/cobrand/bromley.t @@ -220,6 +220,7 @@ subtest 'check special subcategories in admin' => sub { ALLOWED_COBRANDS => 'bromley', MAPIT_URL => 'http://mapit.uk/', }, sub { + $mech->get_ok('/admin/templates/' . $body->id . '/new'); $mech->get_ok('/admin/users/' . $user->id); $mech->submit_form_ok({ with_fields => { 'contacts['.$contact->id.']' => 1, 'contacts[BLUE]' => 1 } }); }; diff --git a/templates/web/bromley/admin/category-checkboxes.html b/templates/web/bromley/admin/category-checkboxes.html index 756f2d1ff..68e8e0c26 100644 --- a/templates/web/bromley/admin/category-checkboxes.html +++ b/templates/web/bromley/admin/category-checkboxes.html @@ -1,12 +1,4 @@ -<fieldset> - <legend> - [% IF hint %] - <div class="admin-hint"> - <p>[% hint %]</p> - </div> - [% END %] - [% loc('Categories:') %] - </legend> +[% BLOCK checkboxes %] <ul class="no-bullets no-margin"> <li> [% loc('Select:') %] @@ -22,4 +14,16 @@ </li> [% END %] </ul> +[% END %] +<fieldset> + <legend> + [% IF hint %] + <div class="admin-hint"> + <p>[% hint %]</p> + </div> + [% END %] + [% loc('Categories:') %] + </legend> + + [% INCLUDE checkboxes %] </fieldset> |