Replace manual activerecord translations with helpers

This commit is contained in:
Sebastian Serth
2024-04-14 14:00:51 +02:00
committed by Sebastian Serth
parent e551c8a699
commit f8330b39fb
72 changed files with 265 additions and 264 deletions

View File

@@ -12,7 +12,7 @@
.form-check
label.form-check-label
= f.check_box(:platform_admin, class: 'form-check-input')
= f.label(:platform_admin, t('activerecord.attributes.internal_user.platform_admin'), class: 'form-label')
= f.label(:platform_admin, class: 'form-label mb-0')
h2.mt-4 = t('internal_users.form.study_groups')
ul.list-unstyled.card-group
@@ -26,9 +26,9 @@
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')
th = StudyGroup.human_attribute_name('selection')
th = StudyGroup.human_attribute_name('name')
th = StudyGroupMembership.human_attribute_name('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][]'

View File

@@ -2,6 +2,6 @@ h1 = t('.headline')
= form_tag do
.mb-3
= label_tag(:email, t('activerecord.attributes.internal_user.email'))
= label_tag(:email, InternalUser.human_attribute_name('email'))
= email_field_tag(:email, params[:email], autofocus: true, class: 'form-control', required: true)
.actions = submit_tag(t('.submit'), class: 'btn btn-primary')

View File

@@ -1,23 +1,23 @@
h1 = InternalUser.model_name.human(count: 2)
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, 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'))
= 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, 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'))
= 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 = t('activerecord.attributes.internal_user.name')
th = t('activerecord.attributes.internal_user.consumer')
th = InternalUser.human_attribute_name('name')
th = InternalUser.human_attribute_name('consumer')
- if current_user.admin?
th = t('activerecord.attributes.internal_user.platform_admin')
th = InternalUser.human_attribute_name('platform_admin')
th colspan=3 = t('shared.actions')
tbody
- @users.each do |user|