Adjust filter for platform_admin user search and update views
This commit is contained in:

committed by
Sebastian Serth

parent
02c65af034
commit
998a12e6bc
@ -15,8 +15,7 @@ h1 = ExternalUser.model_name.human(count: 2)
|
||||
= f.search_field(:external_id_cont, class: 'form-control', placeholder: t('activerecord.attributes.external_user.external_id'))
|
||||
.row
|
||||
.col-auto
|
||||
= f.label(:role_eq, t('activerecord.attributes.external_user.role'), class: 'visually-hidden form-label')
|
||||
= f.select(:role_eq, User::ROLES.map { |role| [t("users.roles.#{role}"), role] }, { include_blank: true }, class: 'form-control', prompt: t('activerecord.attributes.external_user.role'))
|
||||
= 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] : '' }
|
||||
.col-auto.mt-3.mt-lg-0
|
||||
= f.label(:consumer_id_eq, t('activerecord.attributes.external_user.consumer'), class: 'visually-hidden form-label')
|
||||
= f.collection_select(:consumer_id_eq, Consumer.with_external_users, :id, :name, class: 'form-control', include_blank: true, prompt: t('activerecord.attributes.external_user.consumer') )
|
||||
|
@ -6,7 +6,7 @@ h1 = @user.displayname
|
||||
code
|
||||
= @user.external_id
|
||||
= row(label: 'external_user.consumer', value: link_to_if(policy(@user.consumer).show?, @user.consumer, @user.consumer))
|
||||
= row(label: 'external_user.role', value: t("users.roles.#{@user.role}"))
|
||||
= row(label: 'external_user.platform_admin', value: @user.platform_admin?)
|
||||
|
||||
h4.mt-4 = link_to(t('.exercise_statistics'), statistics_external_user_path(@user)) if policy(@user).statistics?
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
.mb-3
|
||||
= f.label(:name, class: 'form-label')
|
||||
= f.text_field(:name, class: 'form-control', required: true)
|
||||
.mb-3
|
||||
= f.label(:role, class: 'form-label')
|
||||
= f.select(:role, User::ROLES.map { |role| [t("users.roles.#{role}"), role] }, {selected: @user.role || 'teacher'}, class: 'form-control')
|
||||
.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')
|
||||
.actions = render('shared/submit_button', f: f, object: @user)
|
||||
|
@ -8,23 +8,21 @@ h1 = InternalUser.model_name.human(count: 2)
|
||||
= f.label(:email_cont, t('activerecord.attributes.internal_user.email'), class: 'visually-hidden form-label')
|
||||
= f.search_field(:email_cont, class: 'form-control', placeholder: t('activerecord.attributes.internal_user.email'))
|
||||
.col-auto
|
||||
= f.label(:role_eq, t('activerecord.attributes.internal_user.role'), class: 'visually-hidden form-label')
|
||||
= f.select(:role_eq, User::ROLES.map { |role| [t("users.roles.#{role}"), role] }, {}, class: 'form-control', prompt: t('activerecord.attributes.internal_user.role'))
|
||||
|
||||
= 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 = t('activerecord.attributes.internal_user.name')
|
||||
th = t('activerecord.attributes.internal_user.consumer')
|
||||
th = t('activerecord.attributes.internal_user.role')
|
||||
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 = t("users.roles.#{user.role}")
|
||||
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?
|
||||
|
@ -5,7 +5,7 @@ h1
|
||||
= row(label: 'internal_user.email', value: @user.email)
|
||||
= row(label: 'internal_user.name', value: @user.name)
|
||||
= row(label: 'internal_user.consumer', value: @user.consumer ? link_to_if(policy(@user.consumer).show?, @user.consumer, @user.consumer) : nil)
|
||||
= row(label: 'internal_user.role', value: t("users.roles.#{@user.role}"))
|
||||
= row(label: 'internal_user.platform_admin', value: @user.platform_admin?)
|
||||
= row(label: 'internal_user.activated', value: @user.activated?)
|
||||
|
||||
= row(label: 'codeharbor_link.profile_label', value: @user.codeharbor_link.nil? ? link_to(t('codeharbor_link.new'), new_codeharbor_link_path, class: 'btn btn-secondary') : link_to(t('codeharbor_link.edit'), edit_codeharbor_link_path(@user.codeharbor_link), class: 'btn btn-secondary'))
|
||||
|
Reference in New Issue
Block a user