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

@ -1,12 +1,12 @@
= form_for(@programming_group) do |f|
= render('shared/form_errors', object: @programming_group)
h3 = t('activerecord.attributes.programming_group.member')
h3 = ProgrammingGroup.human_attribute_name('member')
.table-responsive
table.table class=(@members.present? ? 'sortable' : '')
thead
tr
th = t('activerecord.attributes.exercise.selection')
th = Exercise.human_attribute_name('selection')
th = t('navigation.sections.contributors')
= collection_check_boxes :programming_group, :programming_group_membership_ids, @members, :id, :id do |b|
tr

View File

@ -1,27 +1,27 @@
- if params[:exercise_id].nil?
h1 = ProgrammingGroup.model_name.human(count: 2)
h1 = ProgrammingGroup.model_name.human(count: :other)
= render(layout: 'shared/form_filters') do |f|
.col-auto
= f.label(:exercise_id_eq, t('activerecord.attributes.programming_group.exercise'), class: 'visually-hidden form-label')
= f.collection_select(:exercise_id_eq, Exercise.with_programming_groups, :id, :title, class: 'form-control', prompt: t('activerecord.attributes.programming_group.exercise'))
= f.label(:exercise_id_eq, ProgrammingGroup.human_attribute_name('exercise'), class: 'visually-hidden form-label')
= f.collection_select(:exercise_id_eq, Exercise.with_programming_groups, :id, :title, class: 'form-control', prompt: ProgrammingGroup.human_attribute_name('exercise'))
.col-auto
= f.label(:programming_group_memberships_user_of_ExternalUser_type_id_eq, t('activerecord.attributes.programming_group.external_user_id'), class: 'visually-hidden form-label')
= f.search_field(:programming_group_memberships_user_of_ExternalUser_type_id_eq, class: 'form-control', placeholder: t('activerecord.attributes.programming_group.external_user_id'))
= f.label(:programming_group_memberships_user_of_ExternalUser_type_id_eq, ProgrammingGroup.human_attribute_name('external_user_id'), class: 'visually-hidden form-label')
= f.search_field(:programming_group_memberships_user_of_ExternalUser_type_id_eq, class: 'form-control', placeholder: ProgrammingGroup.human_attribute_name('external_user_id'))
.col-auto
= f.label(:programming_group_memberships_user_of_InternalUser_type_id_eq, t('activerecord.attributes.programming_group.internal_user_id'), class: 'visually-hidden form-label')
= f.search_field(:programming_group_memberships_user_of_InternalUser_type_id_eq, class: 'form-control', placeholder: t('activerecord.attributes.programming_group.internal_user_id'))
= f.label(:programming_group_memberships_user_of_InternalUser_type_id_eq, ProgrammingGroup.human_attribute_name('internal_user_id'), class: 'visually-hidden form-label')
= f.search_field(:programming_group_memberships_user_of_InternalUser_type_id_eq, class: 'form-control', placeholder: ProgrammingGroup.human_attribute_name('internal_user_id'))
- else
h1 = "#{ProgrammingGroup.model_name.human(count: 2)} for Exercise '#{@exercise.title}'"
h1 = "#{ProgrammingGroup.model_name.human(count: :other)} for Exercise '#{@exercise.title}'"
.table-responsive
table.table.mt-4 class=(@programming_groups.present? ? 'sortable' : '')
thead
tr
th.sortable_nosort = sort_link(@search, :id, t('activerecord.attributes.programming_group.name'))
th.sortable_nosort = sort_link(@search, :id, ProgrammingGroup.human_attribute_name('name'))
- if params[:exercise_id].blank?
th.sorttable_nosort = sort_link(@search, :exercise_id, t('activerecord.attributes.programming_group.exercise'))
th = t('activerecord.attributes.programming_group.member')
th = t('activerecord.attributes.programming_group.member_count')
th.sorttable_nosort = sort_link(@search, :exercise_id, ProgrammingGroup.human_attribute_name('exercise'))
th = ProgrammingGroup.human_attribute_name('member')
th = ProgrammingGroup.human_attribute_name('member_count')
th.sorttable_nosort = sort_link(@search, :created_at, t('shared.created_at'))
th colspan=3 = t('shared.actions')
tbody

View File

@ -8,7 +8,7 @@ h1
= row(label: 'programming_group.member_count', value: @programming_group.users.size)
= row(label: 'shared.created_at', value: l(@programming_group.created_at, format: :short))
h2.mt-4 = t('activerecord.attributes.study_group.members')
h2.mt-4 = ProgrammingGroup.human_attribute_name('member')
.table-responsive
table.table class=(@programming_group.users.present? ? 'sortable' : '')
thead