Skip to content

Commit

Permalink
Use checkbox list instead of select for admin users.
Browse files Browse the repository at this point in the history
This way it is harder to unselect the admin users, to avoid
accidentally unselected them if ctrl isn't being held down.
  • Loading branch information
somiaj committed Nov 9, 2024
1 parent 3e1aa50 commit 1dc6f5a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions templates/ContentGenerator/CourseAdmin/add_course_form.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@
<%= maketext(
'Select admin course users to add to the new course (as the stated permission) below.') =%>
</div>
<div class="col-lg-4 col-md-5 col-sm-6">
<%= select_field 'add-admin-users' => [ map {
my $val = $db->getPermissionLevel($_)->permission;
my $level = maketext((grep { $ce->{userRoles}{$_} eq $val } keys %{ $ce->{userRoles} })[0]);
[ "$_ ($level)" => $_, $val == 20 ? (selected => undef) : () ] } $db->listUsers ],
size => 5, multiple => undef, class =>'form-select mb-1' =%>
<div class="col-lg-4 col-md-5 col-sm-6 overflow-scroll border rounded px-2" style="height: 100px;">
% for my $user ($db->listUsers) {
% my $val = $db->getPermissionLevel($user)->permission;
% my $level = maketext((grep { $ce->{userRoles}{$_} eq $val } keys %{ $ce->{userRoles} })[0]);
<div class="form-check">
<label class="form-check-label">
<%= check_box 'add-admin-users' => $user, class => 'form-check-input',
$val == 20 ? (checked => undef) : () =%>
<%= "$user ($level)" %>
</label>
</div>
% }
</div>
</div>
<div class="mb-2">
Expand Down

0 comments on commit 1dc6f5a

Please sign in to comment.