Allow assignment of study groups for internal users

This commit is contained in:
Sebastian Serth
2022-09-20 15:52:55 +02:00
committed by Sebastian Serth
parent 998a12e6bc
commit 4d2fe22daf
6 changed files with 79 additions and 2 deletions

View File

@ -12,5 +12,27 @@
.form-check
label.form-check-label
= f.check_box(:platform_admin, class: 'form-check-input')
= f.label(:platform_admin, t('activerecord.attributes.external_user.platform_admin'), class: 'form-label')
= f.label(:platform_admin, t('activerecord.attributes.internal_user.platform_admin'), class: 'form-label')
h2.mt-4 = t('internal_users.form.study_groups')
ul.list-unstyled.card-group
li.card
.card-header role="tab" id="heading"
a.file-heading data-bs-toggle="collapse" href="#study-group-collapse"
div.clearfix role="button"
span = t('internal_users.form.click_to_collapse')
.card-collapse.collapse id="study-group-collapse" role="tabpanel"
.table-responsive
table.table.overflow-hidden#study-groups-table
thead
tr
th = t('activerecord.attributes.study_group.selection')
th = t('activerecord.attributes.study_group.name')
th = t('activerecord.attributes.study_group_membership.role')
= collection_check_boxes :user, :study_group_ids, @study_group_memberships, :study_group_id, :id, {namespace: :internal_user} do |b|
tr
td = b.check_box class: 'form-check-input', name: "internal_user[study_group_ids][]"
td = b.object.study_group.name
td = select "study_group_membership_roles[#{b.object.study_group.id}]", :role, StudyGroupMembership::ROLES.map { |role| [t("activerecord.attributes.study_group_membership.role_type.#{role}"), role] }, {selected: b.object.persisted? ? b.object.role : nil, include_blank: true}, class: 'form-control form-control-sm'
.actions = render('shared/submit_button', f: f, object: @user)