diff options
-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> |