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

@ -40,7 +40,7 @@ class SubmissionsController < ApplicationController
end
# zip exercise description
zio.put_next_entry("#{t('activerecord.models.exercise.one')}.txt")
zio.put_next_entry("#{Exercise.model_name.human}.txt")
zio.write("#{@submission.exercise.title}\r\n======================\r\n")
zio.write(@submission.exercise.description)

View File

@ -30,19 +30,19 @@ module StatisticsHelper
[
{
key: 'internal_users',
name: t('activerecord.models.internal_user.other'),
name: InternalUser.model_name.human(count: :other),
data: InternalUser.count,
url: internal_users_path,
},
{
key: 'external_users',
name: t('activerecord.models.external_user.other'),
name: ExternalUser.model_name.human(count: :other),
data: ExternalUser.count,
url: external_users_path,
},
{
key: 'programming_groups',
name: t('activerecord.models.programming_group.other'),
name: ProgrammingGroup.model_name.human(count: :other),
data: ProgrammingGroup.count,
url: programming_groups_path,
},
@ -59,7 +59,7 @@ module StatisticsHelper
[
{
key: 'exercises',
name: t('activerecord.models.exercise.other'),
name: Exercise.model_name.human(count: :other),
data: Exercise.count,
url: exercises_path,
},
@ -91,13 +91,13 @@ module StatisticsHelper
},
{
key: 'execution_environments',
name: t('activerecord.models.execution_environment.other'),
name: ExecutionEnvironment.model_name.human(count: :other),
data: ExecutionEnvironment.count,
url: execution_environments_path,
},
{
key: 'exercise_collections',
name: t('activerecord.models.exercise_collection.other'),
name: ExerciseCollection.model_name.human(count: :other),
data: ExerciseCollection.count,
url: exercise_collections_path,
},
@ -108,7 +108,7 @@ module StatisticsHelper
rfc_activity_data + [
{
key: 'comments',
name: t('activerecord.models.comment.other'),
name: Comment.model_name.human(count: :other),
data: Comment.count,
},
]
@ -138,7 +138,7 @@ module StatisticsHelper
[
{
key: 'rfcs',
name: t('activerecord.models.request_for_comment.other'),
name: RequestForComment.model_name.human(count: :other),
data: RequestForComment.in_range(from, to).count,
url: request_for_comments_path,
},
@ -185,7 +185,7 @@ module StatisticsHelper
[
{
key: 'rfcs',
name: t('activerecord.models.request_for_comment.other'),
name: RequestForComment.model_name.human(count: :other),
data: RequestForComment.in_range(from, to)
.select(RequestForComment.sanitize_sql(['date_trunc(?, created_at) AS "key", count(id) AS "value"', interval]))
.group('key').order('key'),

View File

@ -76,9 +76,7 @@ class ExecutionEnvironment < ApplicationRecord
def valid_test_setup?
if test_command? ^ testing_framework?
errors.add(:test_command,
I18n.t('activerecord.errors.messages.together',
attribute: I18n.t('activerecord.attributes.execution_environment.testing_framework')))
errors.add(:test_command, :together, attribute: ExecutionEnvironment.human_attribute_name('testing_framework'))
end
end

View File

@ -566,8 +566,7 @@ class Exercise < ApplicationRecord
def valid_main_file?
if files.count(&:main_file?) > 1
errors.add(:files,
I18n.t('activerecord.errors.models.exercise.at_most_one_main_file'))
errors.add(:files, :at_most_one_main_file)
end
end
private :valid_main_file?
@ -577,15 +576,13 @@ class Exercise < ApplicationRecord
valid = true
if late_submission_deadline.present? && submission_deadline.blank?
errors.add(:late_submission_deadline,
I18n.t('activerecord.errors.models.exercise.late_submission_deadline_not_alone'))
errors.add(:late_submission_deadline, :not_alone)
valid = false
end
if submission_deadline.present? && late_submission_deadline.present? &&
late_submission_deadline < submission_deadline
errors.add(:late_submission_deadline,
I18n.t('activerecord.errors.models.exercise.late_submission_deadline_not_before_submission_deadline'))
errors.add(:late_submission_deadline, :not_before_submission_deadline)
valid = false
end

View File

@ -30,7 +30,7 @@ working_time: time_to_f(item.exercise.average_working_time)}
end
def to_s
"#{I18n.t('activerecord.models.exercise_collection.one')}: #{name} (#{id})"
"#{ExerciseCollection.model_name.human}: #{name} (#{id})"
end
def self.ransackable_attributes(_auth_object = nil)

View File

@ -16,9 +16,7 @@ class ExerciseTip < ApplicationRecord
unless ExerciseTip.exists?(
exercise:, id: parent_exercise_tip
)
errors.add :parent_exercise_tip,
I18n.t('activerecord.errors.messages.together',
attribute: I18n.t('activerecord.attributes.exercise_tip.tip'))
errors.add :parent_exercise_tip, :together, attribute: ExerciseTip.human_attribute_name('tip')
end
end
end

View File

@ -13,16 +13,15 @@ class Tip < ApplicationRecord
unless [
description?, example?
].include?(true)
errors.add :description,
I18n.t('activerecord.errors.messages.at_least', attribute: I18n.t('activerecord.attributes.tip.example'))
errors.add :description, :at_least, attribute: Tip.human_attribute_name('example')
end
end
def to_s
if title?
"#{I18n.t('activerecord.models.tip.one')}: #{title} (#{id})"
"#{Tip.model_name.human}: #{title} (#{id})"
else
"#{I18n.t('activerecord.models.tip.one')} #{id}"
"#{Tip.model_name.human} #{id}"
end
end

View File

@ -30,8 +30,8 @@ h2 Docker
table.table
thead
tr
th = t('activerecord.models.execution_environment.one')
th = t('activerecord.attributes.execution_environment.pool_size')
th = ExecutionEnvironment.model_name.human
th = ExecutionEnvironment.human_attribute_name('pool_size')
th = t('admin.dashboard.show.idleRunners')
th = t('admin.dashboard.show.usedRunners')
tbody

View File

@ -6,16 +6,16 @@
- if params["#{parent_route_key}_id"].present?
- parent_object = object.try(parent_route_key) || parent_model.find_by(id: params["#{parent_route_key}_id"])
- parent_element = link_to_if(current_user && policy(parent_object).show?, parent_object, {controller: parent_model.model_name.route_key, action: :show, id: parent_object.id})
- parent_root_element = link_to_if(current_user && policy(parent_model).index?, parent_model.model_name.human(count: 2), {controller: parent_model.model_name.route_key, action: :index})
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), send(:"#{parent_route_key}_#{model.model_name.route_key}_path", parent_object))
- parent_root_element = link_to_if(current_user && policy(parent_model).index?, parent_model.model_name.human(count: :other), {controller: parent_model.model_name.route_key, action: :index})
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), send(:"#{parent_route_key}_#{model.model_name.route_key}_path", parent_object))
- if object
- current_element = link_to_if(current_user && policy(object).show?, object, send(:"#{parent_route_key}_#{model.model_name.singular}_path", parent_object, object))
- else
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), {controller: model.model_name.route_key, action: :index})
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), {controller: model.model_name.route_key, action: :index})
- if object
- current_element = link_to_if(current_user && policy(object).show?, object, {controller: model.model_name.route_key, action: :show, id: object.id})
- else
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), {controller: model.model_name.route_key, action: :index})
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), {controller: model.model_name.route_key, action: :index})
- if object
- current_element = link_to_if(current_user && policy(object).show?, object, {controller: model.model_name.route_key, action: :show, id: object.id})
- if I18n.exists?("shared.#{params[:action]}")
@ -45,7 +45,7 @@
= current_element
- title = "#{object} - #{title}"
- else
- title = "#{model.model_name.human(count: 2)} - #{title}"
- title = "#{model.model_name.human(count: :other)} - #{title}"
li.breadcrumb-item.active.small
= active_action
- content_for :title, title

View File

@ -10,7 +10,7 @@
li = link_to(t('breadcrumbs.rails_admin.show'), rails_admin.dashboard_path, class: 'dropdown-item', 'data-turbolinks': 'false') if policy(%i[admin dashboard]).show?
li = link_to(t('breadcrumbs.statistics.show'), statistics_path, class: 'dropdown-item') if policy(:statistics).show?
li.dropdown-divider role='separator'
= render('navigation_submenu', title: t('activerecord.models.exercise.other'),
= render('navigation_submenu', title: Exercise.model_name.human(count: :other),
models: [Exercise, ExerciseCollection, ProxyExercise, Tag, Tip, Submission], link: exercises_path, cached: true)
= render('navigation_submenu', title: t('navigation.sections.contributors'), models: [InternalUser, ExternalUser, ProgrammingGroup],
cached: true)

View File

@ -1,2 +1,2 @@
- if policy(model).index?
li = link_to(model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"), class: 'dropdown-item')
li = link_to(model.model_name.human(count: :other), send(:"#{model.model_name.collection}_path"), class: 'dropdown-item')

View File

@ -1,10 +1,10 @@
h1 = t('activerecord.models.community_solution.other')
h1 = CommunitySolution.model_name.human(count: :other)
.table-responsive
table.table.mt-4
thead
tr
th = t('activerecord.attributes.exercise.title')
th = Exercise.human_attribute_name('title')
th colspan=1 = t('shared.actions')
tbody

View File

@ -1,10 +1,10 @@
h1 = Consumer.model_name.human(count: 2)
h1 = Consumer.model_name.human(count: :other)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.consumer.name')
th = Consumer.human_attribute_name('name')
th colspan=3 = t('shared.actions')
tbody
- @consumers.each do |consumer|

View File

@ -13,5 +13,5 @@
.form-check.mb-3
label.form-check-label
= f.check_box(:important, class: 'form-check-input')
= t('activerecord.attributes.error_template_attribute.important')
= ErrorTemplateAttribute.human_attribute_name('important')
.actions = render('shared/submit_button', f:, object: @error_template_attribute)

View File

@ -1,13 +1,13 @@
h1 = ErrorTemplateAttribute.model_name.human(count: 2)
h1 = ErrorTemplateAttribute.model_name.human(count: :other)
.table-responsive
table.table class=(@error_template_attributes.present? ? 'sortable' : '')
thead
tr
th
th = t('activerecord.attributes.error_template_attribute.key')
th = t('activerecord.attributes.error_template_attribute.description')
th = t('activerecord.attributes.error_template_attribute.regex')
th = ErrorTemplateAttribute.human_attribute_name('key')
th = ErrorTemplateAttribute.human_attribute_name('description')
th = ErrorTemplateAttribute.human_attribute_name('regex')
th colspan=3 = t('shared.actions')
tbody
- @error_template_attributes.each do |error_template_attribute|

View File

@ -1,12 +1,12 @@
h1 = ErrorTemplate.model_name.human(count: 2)
h1 = ErrorTemplate.model_name.human(count: :other)
.table-responsive
table.table class=(@error_templates.present? ? 'sortable' : '')
thead
tr
th = t('activerecord.attributes.error_template.name')
th = t('activerecord.attributes.error_template.description')
th = t('activerecord.attributes.exercise.execution_environment')
th = ErrorTemplate.human_attribute_name('name')
th = ErrorTemplate.human_attribute_name('description')
th = Exercise.human_attribute_name('execution_environment')
th colspan=3 = t('shared.actions')
tbody
- @error_templates.each do |error_template|

View File

@ -10,16 +10,16 @@ h1
= row(label: "error_template.#{attribute}", value: @error_template.send(attribute))
h2.mt-4
= t 'error_templates.attributes'
= t('error_templates.attributes')
.table-responsive
table.table class=(@error_template.error_template_attributes.present? ? 'sortable' : '')
thead
tr
th
th = t('activerecord.attributes.error_template_attribute.key')
th = t('activerecord.attributes.error_template_attribute.description')
th = t('activerecord.attributes.error_template_attribute.regex')
th = ErrorTemplateAttribute.human_attribute_name('key')
th = ErrorTemplateAttribute.human_attribute_name('description')
th = ErrorTemplateAttribute.human_attribute_name('regex')
th colspan=3 = t('shared.actions')
tbody
- @error_template.error_template_attributes.order('important DESC', :key).each do |attribute|

View File

@ -34,11 +34,11 @@
.form-check.mb-3
label.form-check-label
= f.check_box(:network_enabled, class: 'form-check-input')
= t('activerecord.attributes.execution_environment.network_enabled')
= f.label(:network_enabled, class: 'form-label mb-0')
.form-check.mb-3
label.form-check-label
= f.check_box(:privileged_execution, class: 'form-check-input')
= t('activerecord.attributes.execution_environment.privileged_execution')
= f.label(:privileged_execution, class: 'form-label mb-0')
.mb-3
= f.label(:permitted_execution_time, class: 'form-label')
= f.number_field(:permitted_execution_time, class: 'form-control', min: 1)

View File

@ -1,4 +1,4 @@
h1.d-inline-block = ExecutionEnvironment.model_name.human(count: 2)
h1.d-inline-block = ExecutionEnvironment.model_name.human(count: :other)
- if Runner.management_active? && policy(ExecutionEnvironment).sync_all_to_runner_management?
= button_to({action: :sync_all_to_runner_management}, {form_class: 'float-end mb-2', class: 'btn btn-success'})
@ -9,14 +9,14 @@ h1.d-inline-block = ExecutionEnvironment.model_name.human(count: 2)
table.table
thead
tr
th = t('activerecord.attributes.execution_environment.name')
th = t('activerecord.attributes.execution_environment.user')
th = t('activerecord.attributes.execution_environment.pool_size')
th = t('activerecord.attributes.execution_environment.memory_limit')
th = t('activerecord.attributes.execution_environment.cpu_limit')
th = t('activerecord.attributes.execution_environment.network_enabled')
th = t('activerecord.attributes.execution_environment.privileged_execution')
th = t('activerecord.attributes.execution_environment.permitted_execution_time')
th = ExecutionEnvironment.human_attribute_name('name')
th = ExecutionEnvironment.human_attribute_name('user')
th = ExecutionEnvironment.human_attribute_name('pool_size')
th = ExecutionEnvironment.human_attribute_name('memory_limit')
th = ExecutionEnvironment.human_attribute_name('cpu_limit')
th = ExecutionEnvironment.human_attribute_name('network_enabled')
th = ExecutionEnvironment.human_attribute_name('privileged_execution')
th = ExecutionEnvironment.human_attribute_name('permitted_execution_time')
th colspan=5 = t('shared.actions')
tbody
- @execution_environments.each do |execution_environment|

View File

@ -2,7 +2,7 @@
form#exercise-selection
.mb-3
span.badge = t('activerecord.attributes.exercise_collections.exercises')
span.badge = ExerciseCollection.human_attribute_name('exercises')
.mb-2
= collection_select({}, :exercise_ids, exercises, :id, :title, {}, {id: 'add-exercise-list', class: 'form-control', multiple: true})

View File

@ -1,14 +1,14 @@
= form_for(@exercise_collection, multipart: true) do |f|
= render('shared/form_errors', object: @exercise_collection)
.mb-3
= f.label(t('activerecord.attributes.exercise_collections.name'), class: 'form-label')
= f.label(:name, class: 'form-label')
= f.text_field(:name, class: 'form-control', required: true)
.form-check.mb-3
label.form-check-label
= f.check_box(:use_anomaly_detection, class: 'form-check-input')
= t('activerecord.attributes.exercise_collections.use_anomaly_detection')
= f.label(:use_anomaly_detection, class: 'form-label mb-0')
.mb-3
= f.label(t('activerecord.attributes.exercise_collections.user'), class: 'form-label')
= f.label(:user, class: 'form-label')
= f.collection_select(:user_id, InternalUser.order(:name), :id, :name, {}, {class: 'form-control'})
.table-responsive#exercise-list
@ -16,7 +16,7 @@
thead
tr
th
th = t('activerecord.attributes.exercise_collection_item.exercise')
th = ExerciseCollectionItem.human_attribute_name('exercise')
th colspan=2 = t('shared.actions')
tbody#sortable
- @exercise_collection.items.order(:position).each do |item|

View File

@ -1,13 +1,13 @@
h1 = ExerciseCollection.model_name.human(count: 2)
h1 = ExerciseCollection.model_name.human(count: :other)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.exercise_collections.id')
th = t('activerecord.attributes.exercise_collections.name')
th = t('activerecord.attributes.exercise_collections.updated_at')
th = t('activerecord.attributes.exercise_collections.exercises')
th = ExerciseCollection.human_attribute_name('id')
th = ExerciseCollection.human_attribute_name('name')
th = ExerciseCollection.human_attribute_name('updated_at')
th = ExerciseCollection.human_attribute_name('exercises')
th colspan=4 = t('shared.actions')
tbody
- @exercise_collections.each do |collection|

View File

@ -2,20 +2,20 @@ h1
= @exercise_collection
= render('shared/edit_button', object: @exercise_collection)
= row(label: 'exercise_collections.name', value: @exercise_collection.name)
= row(label: 'exercise_collections.user', value: link_to_if(policy(@exercise_collection.user).show?, @exercise_collection.user.displayname, @exercise_collection.user)) unless @exercise_collection.user.nil?
= row(label: 'exercise_collections.use_anomaly_detection', value: @exercise_collection.use_anomaly_detection)
= row(label: 'exercise_collections.updated_at', value: @exercise_collection.updated_at)
= row(label: 'exercise_collection.name', value: @exercise_collection.name)
= row(label: 'exercise_collection.user', value: link_to_if(policy(@exercise_collection.user).show?, @exercise_collection.user.displayname, @exercise_collection.user)) unless @exercise_collection.user.nil?
= row(label: 'exercise_collection.use_anomaly_detection', value: @exercise_collection.use_anomaly_detection)
= row(label: 'exercise_collection.updated_at', value: @exercise_collection.updated_at)
h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises')
h4.mt-4 = ExerciseCollection.human_attribute_name('exercises')
.table-responsive#exercise-list
table.table
thead
tr
th = '#'
th = t('activerecord.attributes.exercise.title')
th = t('activerecord.attributes.exercise.execution_environment')
th = t('activerecord.attributes.exercise.user')
th = Exercise.human_attribute_name('title')
th = Exercise.human_attribute_name('execution_environment')
th = Exercise.human_attribute_name('user')
th = t('shared.actions')
tbody
- @exercise_collection.items.sort_by(&:position).each do |exercise_collection_item|

View File

@ -1,11 +1,11 @@
h1 = @exercise_collection
= row(label: 'exercise_collections.name', value: @exercise_collection.name)
= row(label: 'exercise_collections.updated_at', value: @exercise_collection.updated_at)
= row(label: 'exercise_collections.exercises', value: @exercise_collection.exercises.count)
= row(label: 'exercise_collections.users_and_programming_groups', value: Submission.from(@exercise_collection.exercises.joins(:submissions).group(:contributor_id, :contributor_type).select(:contributor_id, :contributor_type)).count)
= row(label: 'exercise_collections.solutions', value: Submission.from(@exercise_collection.exercises.joins(:submissions).group(:contributor_id, :contributor_type, :id).select(:contributor_id, :contributor_type)).count)
= row(label: 'exercise_collections.submissions', value: @exercise_collection.exercises.joins(:submissions).count)
= row(label: 'exercise_collection.name', value: @exercise_collection.name)
= row(label: 'exercise_collection.updated_at', value: @exercise_collection.updated_at)
= row(label: 'exercise_collection.exercises', value: @exercise_collection.exercises.count)
= row(label: 'exercise_collection.users_and_programming_groups', value: Submission.from(@exercise_collection.exercises.joins(:submissions).group(:contributor_id, :contributor_type).select(:contributor_id, :contributor_type)).count)
= row(label: 'exercise_collection.solutions', value: Submission.from(@exercise_collection.exercises.joins(:submissions).group(:contributor_id, :contributor_type, :id).select(:contributor_id, :contributor_type)).count)
= row(label: 'exercise_collection.submissions', value: @exercise_collection.exercises.joins(:submissions).count)
/ further metrics:
/ number of contributors that attempted at least one exercise @exercise_collection.exercises.joins(:submissions).group("submissions.contributor_id", "submissions.contributor_type").count.count
/ number of solutions: @exercise_collection.exercises.joins(:submissions).group("submissions.contributor_id", "submissions.contributor_type").group("id").count.count
@ -26,17 +26,17 @@ h1 = @exercise_collection
div(class="box #{klass}")
.box-label = label
h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises')
h4.mt-4 = ExerciseCollection.human_attribute_name('exercises')
.table-responsive#exercise-list
table.table class=(@exercise_collection.items.present? ? 'sortable' : '')
thead
tr
th = '#'
th = t('activerecord.attributes.exercise.title')
th = t('activerecord.attributes.exercise.number_of_users_and_programming_groups')
th = t('activerecord.attributes.exercise.distinct_final_submissions')
th = t('activerecord.attributes.exercise.finishing_rate')
th = t('activerecord.attributes.exercise.average_score_percentage')
th = Exercise.human_attribute_name('title')
th = Exercise.human_attribute_name('number_of_users_and_programming_groups')
th = Exercise.human_attribute_name('distinct_final_submissions')
th = Exercise.human_attribute_name('finishing_rate')
th = Exercise.human_attribute_name('average_score_percentage')
th = t('shared.actions')
tbody
- @exercise_collection.items.sort_by(&:position).each do |exercise_collection_item|

View File

@ -2,7 +2,7 @@
form#tip-selection
.mb-3
span.badge = t('activerecord.attributes.exercise_tip.tip')
span.badge = ExerciseTip.human_attribute_name('tip')
.mb-2
= collection_select({}, :tip_ids, tips, :id, :to_s, {}, {id: 'add-tip-list', class: 'form-control', multiple: true})

View File

@ -23,7 +23,7 @@
=<> t('shared.out_of')
span.number
| 0
= row(label: 'activerecord.attributes.submission.score') do
= row(label: 'submission.score') do
span.number
| 0
=<> t('shared.out_of')
@ -43,7 +43,7 @@
=<> t('shared.out_of')
span.number
| 0
= row(label: 'activerecord.attributes.submission.score') do
= row(label: 'submission.score') do
span.number
| 0
=<> t('shared.out_of')
@ -53,7 +53,7 @@
= row(label: 'exercises.implement.messages')
#score data-maximum-score=@exercise.maximum_score data-score=@exercise.final_submission(current_contributor).try(:score)
h4
span == "#{t('activerecord.attributes.submission.score')}:&nbsp;"
span == "#{Submission.human_attribute_name('score')}:&nbsp;"
span.score
.progress
.progress-bar role='progressbar'

View File

@ -41,25 +41,25 @@
.form-check
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')
.form-check
label.form-check-label
= f.check_box(:unpublished, class: 'form-check-input')
= t('activerecord.attributes.exercise.unpublished')
= f.label(:unpublished, class: 'form-label mb-0')
.form-check
label.form-check-label
= f.check_box(:hide_file_tree, class: 'form-check-input')
= t('activerecord.attributes.exercise.hide_file_tree')
= f.label(:hide_file_tree, class: 'form-label mb-0')
.form-check
label.form-check-label
= f.check_box(:allow_file_creation, class: 'form-check-input')
= t('activerecord.attributes.exercise.allow_file_creation')
= f.label(:allow_file_creation, class: 'form-label mb-0')
.form-check.mb-3
label.form-check-label
= f.check_box(:allow_auto_completion, class: 'form-check-input')
= t('activerecord.attributes.exercise.allow_auto_completion')
= f.label(:allow_auto_completion, class: 'form-label mb-0')
.mb-3
= f.label(t('activerecord.attributes.exercise.difficulty'), class: 'form-label')
= f.label(:expected_difficulty, class: 'form-label')
= f.number_field :expected_difficulty, in: 1..10, step: 1, class: 'form-control'
h2 = t('exercises.form.tags')
@ -74,9 +74,9 @@
table.table#tags-table
thead
tr
th = t('activerecord.attributes.exercise.selection')
th = t('activerecord.attributes.tag.name')
th = t('activerecord.attributes.tag.difficulty')
th = Exercise.human_attribute_name('selection')
th = Tag.human_attribute_name('name')
th = Tag.human_attribute_name('difficulty')
= collection_check_boxes :exercise, :tag_ids, @exercise_tags, :tag_id, :id do |b|
tr
td = b.check_box class: 'form-check-input'
@ -96,7 +96,7 @@
= render(partial: 'tips/sortable_tip', collection: @tips, as: :exercise_tip)
button.btn.btn-outline-primary.my-2.w-100 type='button' data-bs-toggle='modal' data-bs-target='#add-tips-modal' = t('.add_tips')
h2 = t('activerecord.attributes.exercise.files')
h2 = Exercise.human_attribute_name('files')
ul#files.list-unstyled
= f.fields_for :files do |files_form|
= render('file_form', f: files_form)

View File

@ -8,5 +8,5 @@ p = ''
.d-grid.gap-2
button#askForCommentsButton.btn.btn-primary(type='button' data-cause='requestComments' data-message-success=t('exercises.editor.request_for_comments_sent'))
i.fa-solid.fa-circle-notch.fa-spin.d-none
= t('exercises.implement.comment.request')
button#closeAskForCommentsButton.btn.btn-warning(type='button') = t('activerecord.attributes.request_for_comments.close')
=t('exercises.implement.comment.request')
button#closeAskForCommentsButton.btn.btn-warning(type='button') = RequestForComment.human_attribute_name('close')

View File

@ -1,13 +1,13 @@
h1 = link_to_if(policy(@exercise).show?, @exercise, exercise_path(@exercise))
.feedback-page
.header = t('activerecord.attributes.exercise.description')
.header = Exercise.human_attribute_name('description')
.value = render_markdown(@exercise.description)
span.header.col-sm-3.ps-0 = "#{t('activerecord.attributes.exercise.maximum_score')}:"
span.header.col-sm-3.ps-0 = "#{Exercise.human_attribute_name('maximum_score')}:"
span.col-sm-9 =< @exercise.maximum_score
.header.mt-3 = t('activerecord.models.user_exercise_feedback.other')
.header.mt-3 = UserExerciseFeedback.model_name.human(count: :other)
- if @feedbacks.blank?
.no-feedback = t('user_exercise_feedback.no_feedback')

View File

@ -1,28 +1,28 @@
h1 = Exercise.model_name.human(count: 2)
h1 = Exercise.model_name.human(count: :other)
= render(layout: 'shared/form_filters') do |f|
.col-auto
= f.label(:execution_environment_id_eq, t('activerecord.attributes.exercise.execution_environment'), class: 'visually-hidden form-label')
= f.collection_select(:execution_environment_id_eq, @execution_environments.with_exercises, :id, :name, class: 'form-control', prompt: t('activerecord.attributes.exercise.execution_environment'))
= f.label(:execution_environment_id_eq, Exercise.human_attribute_name('execution_environment'), class: 'visually-hidden form-label')
= f.collection_select(:execution_environment_id_eq, @execution_environments.with_exercises, :id, :name, class: 'form-control', prompt: Exercise.human_attribute_name('execution_environment'))
.col-auto
= f.label(:title_or_internal_title_cont, t('activerecord.attributes.exercise.title'), class: 'visually-hidden form-label')
= f.search_field(:title_or_internal_title_cont, class: 'form-control', placeholder: t('activerecord.attributes.exercise.title'))
= f.label(:title_or_internal_title_cont, Exercise.human_attribute_name('title'), class: 'visually-hidden form-label')
= f.search_field(:title_or_internal_title_cont, class: 'form-control', placeholder: Exercise.human_attribute_name('title'))
.table-responsive
table.table.mt-2
thead
tr
th.p-1 = sort_link(@search, :title, t('activerecord.attributes.exercise.title'))
th.p-1 = sort_link(@search, :execution_environment_id, t('activerecord.attributes.exercise.execution_environment'))
th.p-1 = sort_link(@search, :title, Exercise.human_attribute_name('title'))
th.p-1 = sort_link(@search, :execution_environment_id, Exercise.human_attribute_name('execution_environment'))
th.p-1 = t('.test_files')
th.p-1 = t('activerecord.attributes.exercise.maximum_score')
th.p-1 = t('activerecord.attributes.exercise.tags')
th.p-1 = t('activerecord.attributes.exercise.difficulty')
th.p-1 = Exercise.human_attribute_name('maximum_score')
th.p-1 = Exercise.human_attribute_name('tags')
th.p-1 = Exercise.human_attribute_name('expected_difficulty')
th.p-1
= t('activerecord.attributes.exercise.public')
= Exercise.human_attribute_name('public')
- if policy(Exercise).batch_update?
br
span.batch = link_to(t('shared.batch_update'), '#', 'data-text': t('shared.update', model: t('activerecord.models.exercise.other')))
span.batch = link_to(t('shared.batch_update'), '#', 'data-text': t('shared.update', model: Exercise.model_name.human(count: :other)))
th.p-1 colspan=6 = t('shared.actions')
tbody
- @exercises.each do |exercise|
@ -48,9 +48,9 @@ h1 = Exercise.model_name.human(count: 2)
button.btn.btn-outline-primary.btn-sm.dropdown-toggle data-bs-toggle='dropdown' type='button' = t('shared.actions_button')
ul.dropdown-menu.float-end role='menu'
li = link_to(t('shared.show'), exercise, 'data-turbolinks': 'false', class: 'dropdown-item') if policy(exercise).show?
li = link_to(t('activerecord.models.user_exercise_feedback.other'), feedback_exercise_path(exercise), class: 'dropdown-item') if policy(exercise).feedback?
li = link_to(t('activerecord.models.request_for_comment.other'), exercise_request_for_comments_path(exercise), class: 'dropdown-item') if policy(exercise).rfcs_for_exercise?
li = link_to(t('activerecord.models.programming_group.other'), exercise_programming_groups_path(exercise), class: 'dropdown-item') if policy(exercise).programming_groups_for_exercise?
li = link_to(UserExerciseFeedback.model_name.human(count: :other), feedback_exercise_path(exercise), class: 'dropdown-item') if policy(exercise).feedback?
li = link_to(RequestForComment.model_name.human(count: :other), exercise_request_for_comments_path(exercise), class: 'dropdown-item') if policy(exercise).rfcs_for_exercise?
li = link_to(ProgrammingGroup.model_name.human(count: :other), exercise_programming_groups_path(exercise), class: 'dropdown-item') if policy(exercise).programming_groups_for_exercise?
li = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(exercise).destroy?
li = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post, class: 'dropdown-item') if policy(exercise).clone?
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id': exercise.id}) if policy(exercise).export_external_confirm?

View File

@ -17,9 +17,9 @@ h1.d-inline-block
ul.dropdown-menu.dropdown-menu-end role='menu'
li = link_to(t('exercises.index.implement'), implement_exercise_path(@exercise), 'data-turbolinks': 'false', class: 'dropdown-item') if policy(@exercise).implement?
li = link_to(t('shared.statistics'), statistics_exercise_path(@exercise), 'data-turbolinks': 'false', class: 'dropdown-item') if policy(@exercise).statistics?
li = link_to(t('activerecord.models.user_exercise_feedback.other'), feedback_exercise_path(@exercise), class: 'dropdown-item') if policy(@exercise).feedback?
li = link_to(t('activerecord.models.request_for_comment.other'), exercise_request_for_comments_path(@exercise), class: 'dropdown-item') if policy(@exercise).rfcs_for_exercise?
li = link_to(t('activerecord.models.programming_group.other'), exercise_programming_groups_path(@exercise), class: 'dropdown-item') if policy(@exercise).programming_groups_for_exercise?
li = link_to(UserExerciseFeedback.model_name.human(count: :other), feedback_exercise_path(@exercise), class: 'dropdown-item') if policy(@exercise).feedback?
li = link_to(RequestForComment.model_name.human(count: :other), exercise_request_for_comments_path(@exercise), class: 'dropdown-item') if policy(@exercise).rfcs_for_exercise?
li = link_to(ProgrammingGroup.model_name.human(count: :other), exercise_programming_groups_path(@exercise), class: 'dropdown-item') if policy(@exercise).programming_groups_for_exercise?
li = link_to(t('shared.destroy'), @exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(@exercise).destroy?
li = link_to(t('exercises.index.clone'), clone_exercise_path(@exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post, class: 'dropdown-item') if policy(@exercise).clone?
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id': @exercise.id}) if policy(@exercise).export_external_confirm?
@ -38,7 +38,7 @@ h1.d-inline-block
= row(label: 'exercise.hide_file_tree', value: @exercise.hide_file_tree?)
= row(label: 'exercise.allow_file_creation', value: @exercise.allow_file_creation?)
= row(label: 'exercise.allow_auto_completion', value: @exercise.allow_auto_completion?)
= row(label: 'exercise.difficulty', value: @exercise.expected_difficulty)
= row(label: 'exercise.expected_difficulty', value: @exercise.expected_difficulty)
= row(label: 'exercise.uuid', value: @exercise.uuid)
= row(label: 'exercise.tags', value: @exercise.exercise_tags.map {|et| "#{et.tag.name} (#{et.factor})" }.sort.join(', '))
= row(label: 'exercise.embedding_parameters', class: 'mb-4') do
@ -48,7 +48,7 @@ h1.d-inline-block
.mt-2
= render(partial: 'tips_content')
h2.mt-4 = t('activerecord.attributes.exercise.files')
h2.mt-4 = Exercise.human_attribute_name('files')
ul.list-unstyled#files
- @exercise.files.each do |file|

View File

@ -30,8 +30,8 @@ h4.mt-4
i.me-0.fa-regular.fa-lightbulb aria-hidden='true' title = t('request_for_comments.solved')
th.text-center
i.me-0.fa-solid.fa-comment aria-hidden='true' title = t('request_for_comments.comments') align='center'
th.col-12 = t('activerecord.attributes.request_for_comments.question')
th = t('activerecord.attributes.request_for_comments.username')
th.text-nowrap = t('activerecord.attributes.request_for_comments.requested_at')
th.col-12 = RequestForComment.human_attribute_name('question')
th = RequestForComment.human_attribute_name('username')
th.text-nowrap = RequestForComment.human_attribute_name('requested_at')
tbody#posted_rfcs
= render(partial: 'request_for_comments/list_entry', collection: @request_for_comments, as: :request_for_comment)

View File

@ -1,38 +1,38 @@
h1 = ExternalUser.model_name.human(count: 2)
h1 = ExternalUser.model_name.human(count: :other)
= render(layout: 'shared/form_filters') do |f|
- if current_user.admin?
.col-md-9.col
.row.align-items-center
.col
= f.label(:name_cont, t('activerecord.attributes.external_user.name'), class: 'visually-hidden form-label')
= f.search_field(:name_cont, class: 'form-control', placeholder: t('activerecord.attributes.external_user.name'))
= f.label(:name_cont, ExternalUser.human_attribute_name('name'), class: 'visually-hidden form-label')
= f.search_field(:name_cont, class: 'form-control', placeholder: ExternalUser.human_attribute_name('name'))
.col.mt-0.mt-sm-3.mt-md-0
= f.label(:email_cont, t('activerecord.attributes.external_user.email'), class: 'visually-hidden form-label')
= f.search_field(:email_cont, class: 'form-control', placeholder: t('activerecord.attributes.external_user.email'))
= f.label(:email_cont, ExternalUser.human_attribute_name('email'), class: 'visually-hidden form-label')
= f.search_field(:email_cont, class: 'form-control', placeholder: ExternalUser.human_attribute_name('email'))
.col.mt-3.mt-lg-0
= f.label(:external_id_cont, t('activerecord.attributes.external_user.external_id'), class: 'visually-hidden form-label')
= f.search_field(:external_id_cont, class: 'form-control', placeholder: t('activerecord.attributes.external_user.external_id'))
= f.label(:external_id_cont, ExternalUser.human_attribute_name('external_id'), class: 'visually-hidden form-label')
= f.search_field(:external_id_cont, class: 'form-control', placeholder: ExternalUser.human_attribute_name('external_id'))
.row
.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] : ''}
.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'))
= f.label(:consumer_id_eq, ExternalUser.human_attribute_name('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: ExternalUser.human_attribute_name('consumer'))
- else
.col-auto
= f.label(:name_cont, t('activerecord.attributes.external_user.name'), class: 'visually-hidden form-label')
= f.search_field(:name_cont, class: 'form-control', placeholder: t('activerecord.attributes.external_user.name'))
= f.label(:name_cont, ExternalUser.human_attribute_name('name'), class: 'visually-hidden form-label')
= f.search_field(:name_cont, class: 'form-control', placeholder: ExternalUser.human_attribute_name('name'))
.col-auto
= f.label(:external_id_cont, t('activerecord.attributes.external_user.external_id'), class: 'visually-hidden form-label')
= f.search_field(:external_id_cont, class: 'form-control', placeholder: t('activerecord.attributes.external_user.external_id'))
= f.label(:external_id_cont, ExternalUser.human_attribute_name('external_id'), class: 'visually-hidden form-label')
= f.search_field(:external_id_cont, class: 'form-control', placeholder: ExternalUser.human_attribute_name('external_id'))
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.external_user.name')
th = t('activerecord.attributes.external_user.consumer')
th = t('activerecord.attributes.external_user.platform_admin')
th = ExternalUser.human_attribute_name('name')
th = ExternalUser.human_attribute_name('consumer')
th = ExternalUser.human_attribute_name('platform_admin')
th = t('shared.actions')
tbody
- @users.each do |user|

View File

@ -1,11 +1,11 @@
h1 = FileTemplate.model_name.human(count: 2)
h1 = FileTemplate.model_name.human(count: :other)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.file_template.name')
th = t('activerecord.attributes.file_template.file_type')
th = FileTemplate.human_attribute_name('name')
th = FileTemplate.human_attribute_name('file_type')
th colspan=3 = t('shared.actions')
tbody
- @file_templates.each do |file_template|

View File

@ -16,13 +16,13 @@
.form-check
label.form-check-label
= f.check_box(:binary, class: 'form-check-input')
= t('activerecord.attributes.file_type.binary')
= f.label(:binary, class: 'form-label mb-0')
.form-check
label.form-check-label
= f.check_box(:executable, class: 'form-check-input')
= t('activerecord.attributes.file_type.executable')
= f.label(:executable, class: 'form-label mb-0')
.form-check.mb-3
label.form-check-label
= f.check_box(:renderable, class: 'form-check-input')
= t('activerecord.attributes.file_type.renderable')
= f.label(:renderable, class: 'form-label mb-0')
.actions = render('shared/submit_button', f:, object: @file_type)

View File

@ -1,12 +1,12 @@
h1 = FileType.model_name.human(count: 2)
h1 = FileType.model_name.human(count: :other)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.file_type.name')
th = t('activerecord.attributes.file_type.user')
th = t('activerecord.attributes.file_type.file_extension')
th = FileType.human_attribute_name('name')
th = FileType.human_attribute_name('user')
th = FileType.human_attribute_name('file_extension')
th colspan=3 = t('shared.actions')
tbody
- @file_types.each do |file_type|

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|

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

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

View File

@ -1,12 +1,12 @@
h1 = RequestForComment.model_name.human(count: 2)
h1 = RequestForComment.model_name.human(count: :other)
= render(layout: 'shared/form_filters') do |f|
.col-md-9.col
.row.align-items-center
- if params[:exercise_id].nil?
.col-auto
= f.label(:exercise_title_cont, t('activerecord.attributes.request_for_comments.exercise'), class: 'visually-hidden form-label')
= f.search_field(:exercise_title_cont, class: 'form-control', placeholder: t('activerecord.attributes.request_for_comments.exercise'))
= f.label(:exercise_title_cont, RequestForComment.human_attribute_name('exercise'), class: 'visually-hidden form-label')
= f.search_field(:exercise_title_cont, class: 'form-control', placeholder: RequestForComment.human_attribute_name('exercise'))
.col-auto.mt-3.mt-md-0
= f.label(:title_cont, t('request_for_comments.solved'), class: 'visually-hidden form-label')
= f.select(:state, [[t('request_for_comments.show_all'), RequestForComment::ALL], [t('request_for_comments.show_unsolved'), RequestForComment::ONGOING], [t('request_for_comments.show_soft_solved'), RequestForComment::SOFT_SOLVED], [t('request_for_comments.show_solved'), RequestForComment::SOLVED]])
@ -23,13 +23,13 @@ h1 = RequestForComment.model_name.human(count: 2)
tr
th
i.fa-regular.fa-lightbulb aria-hidden='true' title = t('request_for_comments.solved') align='right'
th.sorttable_nosort = sort_link(@search, :title, t('activerecord.attributes.request_for_comments.exercise'))
th = t('activerecord.attributes.request_for_comments.question')
th.sorttable_nosort = sort_link(@search, :title, RequestForComment.human_attribute_name('exercise'))
th = RequestForComment.human_attribute_name('question')
th
i.fa-solid.fa-comment aria-hidden='true' title = t('request_for_comments.comments') align='center'
th = t('activerecord.attributes.request_for_comments.username')
th = t('activerecord.attributes.request_for_comments.requested_at')
th = t('activerecord.attributes.request_for_comments.last_update')
th = RequestForComment.human_attribute_name('username')
th = RequestForComment.human_attribute_name('requested_at')
th = RequestForComment.human_attribute_name('last_update')
tbody
- @request_for_comments.each do |request_for_comment|
tr data-id=request_for_comment.id

View File

@ -17,14 +17,14 @@
.rfc
.description
h5
= t('activerecord.attributes.exercise.description')
= Exercise.human_attribute_name('description')
.text
span.fa-solid.fa-chevron-up.collapse-button
= render_markdown(@request_for_comment.exercise.description)
.question
h5.mt-4
= t('activerecord.attributes.request_for_comments.question')
= RequestForComment.human_attribute_name('question')
.text
- question = @request_for_comment.question
= question.presence || t('request_for_comments.no_question')

View File

@ -10,10 +10,10 @@ h1 = t('.headline')
= form_tag(sessions_path) 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)
.mb-3
= label_tag(:password, t('activerecord.attributes.internal_user.password'))
= label_tag(:password, InternalUser.human_attribute_name('password'))
= password_field_tag(:password, nil, class: 'form-control', required: true)
.form-check.mb-3
label.form-check-label

View File

@ -4,12 +4,12 @@
= f.label(:name, class: 'form-label')
= f.text_field(:name, class: 'form-control', required: true)
h3 = t('activerecord.attributes.study_group.members')
h3 = StudyGroup.human_attribute_name('members')
.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.users')
= collection_check_boxes :study_group, :study_group_membership_ids, @members, :id, :id do |b|
tr

View File

@ -2,10 +2,10 @@
table.table.mt-4
thead
tr
th = t('activerecord.attributes.study_group.name')
th = t('activerecord.attributes.study_group.external_id')
th = t('activerecord.attributes.study_group.consumer')
th = t('activerecord.attributes.study_group.member_count')
th = StudyGroup.human_attribute_name('name')
th = StudyGroup.human_attribute_name('external_id')
th = StudyGroup.human_attribute_name('consumer')
th = StudyGroup.human_attribute_name('member_count')
th colspan=3 = t('shared.actions')
tbody
- study_groups.each do |group|

View File

@ -1,12 +1,12 @@
h1 = StudyGroup.model_name.human(count: 2)
h1 = StudyGroup.model_name.human(count: :other)
= 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_study_groups, :id, :name, class: 'form-control', 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_study_groups, :id, :name, class: 'form-control', prompt: InternalUser.human_attribute_name('consumer'))
.col-auto
= f.label(:name_cont, t('activerecord.attributes.study_group.name'), class: 'visually-hidden form-label')
= f.search_field(:name_cont, class: 'form-control', placeholder: t('activerecord.attributes.study_group.name'))
= f.label(:name_cont, StudyGroup.human_attribute_name('name'), class: 'visually-hidden form-label')
= f.search_field(:name_cont, class: 'form-control', placeholder: StudyGroup.human_attribute_name('name'))
= render('table', study_groups: @study_groups)
= render('shared/pagination', collection: @study_groups_paginate)

View File

@ -9,7 +9,7 @@ h1
= row(label: 'study_group.consumer', value: link_to_if(policy(@study_group).show?, @study_group.consumer, @study_group.consumer))
= row(label: 'study_group.member_count', value: @study_group.user_count)
h2.mt-4 = t('activerecord.attributes.study_group.members')
h2.mt-4 = StudyGroup.human_attribute_name('members')
.table-responsive
table.table class=(@study_group.users.present? ? 'sortable' : '')
thead

View File

@ -1,21 +1,21 @@
h1 = Submission.model_name.human(count: 2)
h1 = Submission.model_name.human(count: :other)
= render(layout: 'shared/form_filters') do |f|
.col-auto
= f.label(:exercise_id_eq, t('activerecord.attributes.submission.exercise'), class: 'visually-hidden form-label')
= f.collection_select(:exercise_id_eq, Exercise.with_submissions, :id, :title, class: 'form-control', prompt: t('activerecord.attributes.submission.exercise'))
= f.label(:exercise_id_eq, Submission.human_attribute_name('exercise'), class: 'visually-hidden form-label')
= f.collection_select(:exercise_id_eq, Exercise.with_submissions, :id, :title, class: 'form-control', prompt: Submission.human_attribute_name('exercise'))
.col-auto
= f.label(:cause_eq, t('activerecord.attributes.submission.cause'), class: 'visually-hidden form-label')
= f.select(:cause_eq, Submission.distinct.pluck(:cause).sort, class: 'form-control', prompt: t('activerecord.attributes.submission.cause'))
= f.label(:cause_eq, Submission.human_attribute_name('cause'), class: 'visually-hidden form-label')
= f.select(:cause_eq, Submission.distinct.pluck(:cause).sort, class: 'form-control', prompt: Submission.human_attribute_name('cause'))
.table-responsive
table.table.mt-4
thead
tr
th = sort_link(@search, :exercise_id, t('activerecord.attributes.submission.exercise'))
th = sort_link(@search, :user_id, t('activerecord.attributes.submission.contributor'))
th = sort_link(@search, :cause, t('activerecord.attributes.submission.cause'))
th = sort_link(@search, :score, t('activerecord.attributes.submission.score'))
th = sort_link(@search, :exercise_id, Submission.human_attribute_name('exercise'))
th = sort_link(@search, :user_id, Submission.human_attribute_name('contributor'))
th = sort_link(@search, :cause, Submission.human_attribute_name('cause'))
th = sort_link(@search, :score, Submission.human_attribute_name('score'))
th = sort_link(@search, :created_at, t('shared.created_at'))
th colspan=2 = t('shared.actions')
tbody

View File

@ -13,7 +13,7 @@ h1 = @submission
= row(label: 'submission.cause', value: t("submissions.causes.#{@submission.cause}"))
= row(label: 'submission.score', value: @submission.score)
h2.mt-4 = t('activerecord.attributes.submission.files')
h2.mt-4 = Submission.human_attribute_name('files')
ul.list-unstyled
- @files.each do |file|

View File

@ -12,7 +12,7 @@ h2.mt-4 = t('.history')
tr
th = t('shared.number')
th = t('shared.created_at')
th = t('activerecord.attributes.submission.score')
th = Submission.human_attribute_name('score')
th = t('.percentage')
th = t('shared.actions')
tbody

View File

@ -1,10 +1,10 @@
h1 = Tag.model_name.human(count: 2)
h1 = Tag.model_name.human(count: :other)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.hint.name')
th = Tag.human_attribute_name('name')
th colspan=3 = t('shared.actions')
tbody
- @tags.each do |tag|

View File

@ -7,7 +7,7 @@
.clearfix role='button'
i.fa-solid aria-hidden='true'
span
= t('activerecord.models.tip.one')
= Tip.model_name.human
=< tip_prefix + index.to_s
= ": #{tip.title}" if tip.title?
.card.card-collapse.collapse id="tip-collapse-#{exercise_tip.id}" aria-labelledby="tip-heading-#{exercise_tip.id}" role='tabpanel' data-exercise-tip-id=exercise_tip.id

View File

@ -14,7 +14,7 @@
= f.label(:description, class: 'form-label')
= f.markdown :description
.mb-3
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'), class: 'form-label')
= f.label(:file_type_id, CodeOcean::File.human_attribute_name('file_type_id'), class: 'form-label')
= f.collection_select(:file_type_id, @file_types, :id, :name, {include_blank: true}, class: 'form-control')
.mb-3
= f.label(:example, class: 'form-label')

View File

@ -1,11 +1,11 @@
h1 = Tip.model_name.human(count: 2)
h1 = Tip.model_name.human(count: :other)
.table-responsive
table.table class=(@tips.present? ? 'sortable' : '')
thead
tr
th = t('activerecord.attributes.tip.title')
th = t('activerecord.attributes.file.file_type')
th = Tip.human_attribute_name('title')
th = CodeOcean::File.human_attribute_name('file_type')
th colspan=3 = t('shared.actions')
tbody
- @tips.each do |tip|

View File

@ -1,12 +1,13 @@
= form_for([@exercise, @uef]) do |f|
div
h1#exercise-headline
= "#{t('activerecord.models.user_exercise_feedback.one')} #{@exercise.title}"
=> UserExerciseFeedback.model_name.human
= @exercise.title
= render('shared/form_errors', object: @uef)
p
== t('user_exercise_feedback.description')
#description-card.lead.description-card
u = t('activerecord.attributes.exercise.description')
u = Exercise.human_attribute_name('description')
= render_markdown(@exercise.description)
.mb-3
= f.text_area(:feedback_text, class: 'form-control', required: true, rows: '10')

View File

@ -5,7 +5,7 @@
table(border=1)
thead
tr
td = t('activerecord.attributes.exercise.title', locale: :de)
td = Exercise.human_attribute_name('title', locale: :de)
td = t('exercises.statistics.average_worktime', locale: :de)
td = t('shared.actions', locale: :de)
tbody
@ -24,7 +24,7 @@ table(border=1)
table(border=1)
thead
tr
td = t('activerecord.attributes.exercise.title', locale: :en)
td = Exercise.human_attribute_name('title', locale: :en)
td = t('exercises.statistics.average_worktime', locale: :en)
td = t('shared.actions', locale: :en)
tbody

View File

@ -7,11 +7,11 @@ de:
allow_file_creation: Dateierstellung erlauben
average_score_percentage: Durchschnittliche Bewertung in Prozent
description: Beschreibung
difficulty: Schwierigkeitsgrad
distinct_final_submissions: Endgültige Abgaben
embedding_parameters: Parameter für LTI-Einbettung
execution_environment: Ausführungsumgebung
execution_environment_id: Ausführungsumgebung
expected_difficulty: Schwierigkeitsgrad
files: Dateien
finishing_rate: Abschlussquote
hide_file_tree: Dateibaum verstecken

View File

@ -2,16 +2,16 @@
de:
activerecord:
attributes:
exercise_collections:
exercise_collection:
exercises: Aufgaben
id: ID
name: Name
solutions: Gesamtanzahl Lösungsversuche
submissions: Gesamtanzahl Submissions
submissions: Gesamtanzahl Abgaben
updated_at: Letzte Änderung
use_anomaly_detection: Abweichungen in der Arbeitszeit erkennen
user: Verantwortlicher
users_and_programming_groups: Teilnehmer und Programmiergruppen
user: Verantwortliche:r
users_and_programming_groups: Teilnehmende und Programmiergruppen
models:
exercise_collection:
one: Aufgabesammlung

View File

@ -7,9 +7,12 @@ de:
together: muss zusammen mit %{attribute} definiert werden
models:
exercise:
attributes:
files:
at_most_one_main_file: dürfen höchstens eine Hauptdatei enthalten
late_submission_deadline_not_alone: darf nicht ohne eine reguläre Abgabefrist verwendet werden
late_submission_deadline_not_before_submission_deadline: darf nicht vor der reguläre Abgabefrist liegen
late_submission_deadline:
not_alone: darf nicht ohne eine reguläre Abgabefrist verwendet werden
not_before_submission_deadline: darf nicht vor der reguläre Abgabefrist liegen
internal_user:
attributes:
password:

View File

@ -2,7 +2,7 @@
de:
activerecord:
attributes:
request_for_comments:
request_for_comment:
close: Fenster schließen
comments: Kommentare
execution_environment: Sprache

View File

@ -5,6 +5,7 @@ de:
tip:
description: Beschreibung
example: Beispiel
file_type: Dateityp
title: Titel
models:
tip:

View File

@ -7,11 +7,11 @@ en:
allow_file_creation: Allow file creation
average_score_percentage: Average Score Percentage
description: Description
difficulty: Difficulty
distinct_final_submissions: Distinct Final Submissions
embedding_parameters: LTI Embedding Parameters
execution_environment: Execution Environment
execution_environment_id: Execution Environment
expected_difficulty: Difficulty
files: Files
finishing_rate: Finishing Rate
hide_file_tree: Hide File Tree

View File

@ -2,7 +2,7 @@
en:
activerecord:
attributes:
exercise_collections:
exercise_collection:
exercises: Exercises
id: ID
name: Name

View File

@ -4,12 +4,15 @@ en:
errors:
messages:
at_least: or %{attribute} must be defined
together: has to be set along with %{attribute}
together: must be defined along with %{attribute}
models:
exercise:
attributes:
files:
at_most_one_main_file: must include at most one main file
late_submission_deadline_not_alone: must not be used without a regular submission deadline
late_submission_deadline_not_before_submission_deadline: must not be before the submission deadline passed
late_submission_deadline:
not_alone: must not be used without a regular submission deadline
not_before_submission_deadline: must not be before the submission deadline passed
internal_user:
attributes:
password:

View File

@ -2,7 +2,7 @@
en:
activerecord:
attributes:
request_for_comments:
request_for_comment:
close: Close window
comments: Comments
execution_environment: Language

View File

@ -5,6 +5,7 @@ en:
tip:
description: Description
example: Example
file_type: File Type
title: Title
models:
tip: