Allow teachers to access internal users and manage them in their study groups

This commit is contained in:
Sebastian Serth
2022-09-22 17:55:10 +02:00
committed by Sebastian Serth
parent e3018c1847
commit 0e7c38657f
11 changed files with 45 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
h1 = InternalUser.model_name.human(count: 2)
= render(layout: 'shared/form_filters') do |f|
= render(layout: 'shared/form_filters') if current_user.admin? do |f|
.col-auto
= f.label(:consumer_id_eq, t('activerecord.attributes.internal_user.consumer'), class: 'visually-hidden form-label')
= f.collection_select(:consumer_id_eq, Consumer.with_internal_users, :id, :name, class: 'form-control', include_blank: true, prompt: t('activerecord.attributes.internal_user.consumer'))
@@ -15,14 +15,16 @@ h1 = InternalUser.model_name.human(count: 2)
tr
th = t('activerecord.attributes.internal_user.name')
th = t('activerecord.attributes.internal_user.consumer')
th = t('activerecord.attributes.internal_user.platform_admin')
- if current_user.admin?
th = t('activerecord.attributes.internal_user.platform_admin')
th colspan=3 = t('shared.actions')
tbody
- @users.each do |user|
tr
td = link_to_if(policy(user).show?, user.name, user)
td = user.consumer ? link_to_if(policy(user.consumer).show?, user.consumer, user.consumer) : empty
td = symbol_for(user.platform_admin?)
- if current_user.admin?
td = symbol_for(user.platform_admin?)
td = link_to(t('shared.show'), user) if policy(user).show?
td = link_to(t('shared.edit'), edit_internal_user_path(user)) if policy(user).edit?
td = link_to(t('shared.destroy'), user, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(user).destroy?