Files
codeocean/app/views/internal_users/index.html.slim
2024-05-21 19:42:26 +02:00

35 lines
1.9 KiB
Plaintext

h1 = InternalUser.model_name.human(count: :other)
- if current_user.admin?
= render(layout: 'shared/form_filters') do |f|
.col-auto
= f.label(:consumer_id_eq, InternalUser.human_attribute_name('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: InternalUser.human_attribute_name('consumer'))
.col-sm
= f.label(:email_cont, InternalUser.human_attribute_name('email'), class: 'visually-hidden form-label')
= f.search_field(:email_cont, class: 'form-control', placeholder: InternalUser.human_attribute_name('email'))
.col-auto
= f.select :platform_admin_true, [[t('shared.admin_filter.only'), 1], [t('shared.admin_filter.none'), 0]], {include_blank: t('shared.admin_filter.all'), selected: params[:q] ? params[:q][:platform_admin_true] : ''}
.table-responsive
table.table.mt-4
thead
tr
th = InternalUser.human_attribute_name('name')
th = InternalUser.human_attribute_name('consumer')
- if current_user.admin?
th = InternalUser.human_attribute_name('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(user.consumer.present? && policy(user.consumer).show?, user.consumer, user.consumer) : empty
- 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?
= render('shared/pagination', collection: @users)
p = render('shared/new_button', model: InternalUser)