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

@@ -19,15 +19,15 @@
.form-check.mb-3
label.form-check-label
= f.check_box(:public, class: 'form-check-input')
= t('activerecord.attributes.exercise.public')
= f.label(:public, class: 'form-label mb-0')
h3 Exercises
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.exercise.selection')
th = sort_link(@search, :title, t('activerecord.attributes.submission.exercise'))
th = Exercise.human_attribute_name('selection')
th = sort_link(@search, :title, Submission.human_attribute_name('exercise'))
th = sort_link(@search, :created_at, t('shared.created_at'))
= collection_check_boxes :proxy_exercise, :exercise_ids, @exercises, :id, :title do |b|
tr

View File

@@ -1,3 +1,3 @@
h1 = "#{t('activerecord.models.proxy_exercise.one', model: ProxyExercise.model_name.human)}: #{@proxy_exercise.title}"
h1 = "#{ProxyExercise.model_name.human}: #{@proxy_exercise.title}"
= render('form')

View File

@@ -1,18 +1,18 @@
h1 = ProxyExercise.model_name.human(count: 2)
h1 = ProxyExercise.model_name.human(count: :other)
= render(layout: 'shared/form_filters') do |f|
.col-auto
= f.label(:title_cont, t('activerecord.attributes.proxy_exercise.title'), class: 'visually-hidden form-label')
= f.search_field(:title_cont, class: 'form-control', placeholder: t('activerecord.attributes.proxy_exercise.title'))
= f.label(:title_cont, ProxyExercise.human_attribute_name('title'), class: 'visually-hidden form-label')
= f.search_field(:title_cont, class: 'form-control', placeholder: ProxyExercise.human_attribute_name('title'))
.table-responsive
table.table.mt-4
thead
tr
th.p-1 = sort_link(@search, :title, t('activerecord.attributes.proxy_exercise.title'))
th.p-1 = t('activerecord.attributes.exercise.token')
th.p-1 = t('activerecord.attributes.exercise.public')
th.p-1 = t('activerecord.attributes.proxy_exercise.files_count')
th.p-1 = sort_link(@search, :title, ProxyExercise.human_attribute_name('title'))
th.p-1 = Exercise.human_attribute_name('token')
th.p-1 = Exercise.human_attribute_name('public')
th.p-1 = ProxyExercise.human_attribute_name('files_count')
th.p-1 colspan=2 = t('shared.actions')
tbody
- @proxy_exercises.each do |proxy_exercise|

View File

@@ -16,7 +16,7 @@ h2.mt-4 Exercises
table.table
thead
tr
th = sort_link(@search, :title, t('activerecord.attributes.submission.exercise'))
th = sort_link(@search, :title, Submission.human_attribute_name('exercise'))
th = sort_link(@search, :created_at, t('shared.created_at'))
- @proxy_exercise.exercises.each do |exercise|
tr