Add internal title for exercise
The internal title is designed to provide an alternative title for teachers. It is not exposed to learners.
This commit is contained in:
@ -208,6 +208,7 @@ class ExercisesController < ApplicationController
|
||||
:allow_file_creation,
|
||||
:allow_auto_completion,
|
||||
:title,
|
||||
:internal_title,
|
||||
:expected_difficulty,
|
||||
:tips,
|
||||
files_attributes: file_attributes,
|
||||
|
@ -614,7 +614,7 @@ class Exercise < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.ransackable_attributes(_auth_object = nil)
|
||||
%w[title]
|
||||
%w[title internal_title]
|
||||
end
|
||||
|
||||
def self.ransackable_associations(_auth_object = nil)
|
||||
|
@ -12,6 +12,10 @@
|
||||
.mb-3
|
||||
= f.label(:title, class: 'form-label')
|
||||
= f.text_field(:title, class: 'form-control', required: true)
|
||||
.mb-3
|
||||
= f.label(:internal_title, class: 'form-label')
|
||||
= f.text_field(:internal_title, class: 'form-control')
|
||||
.help-block.form-text == t('.hints.internal_title')
|
||||
.mb-3
|
||||
= f.label(:description, class: 'form-label')
|
||||
= f.pagedown :description, input_html: { preview: true, rows: 10 }
|
||||
|
@ -5,8 +5,8 @@ h1 = Exercise.model_name.human(count: 2)
|
||||
= 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'))
|
||||
.col-auto
|
||||
= f.label(:title_cont, t('activerecord.attributes.exercise.title'), class: 'visually-hidden form-label')
|
||||
= f.search_field(:title_cont, class: 'form-control', placeholder: t('activerecord.attributes.exercise.title'))
|
||||
= 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'))
|
||||
|
||||
.table-responsive
|
||||
table.table.mt-2
|
||||
@ -27,7 +27,12 @@ h1 = Exercise.model_name.human(count: 2)
|
||||
tbody
|
||||
- @exercises.each do |exercise|
|
||||
tr data-id=exercise.id
|
||||
td.p-1.pt-2 = link_to_if(policy(exercise).show?, exercise.title, exercise, 'data-turbolinks' => "false")
|
||||
td.p-1.pt-2
|
||||
= link_to_if(policy(exercise).show?, exercise.title, exercise, 'data-turbolinks' => "false")
|
||||
- if exercise.internal_title.present?
|
||||
p.mb-0.text-muted
|
||||
i.fa-solid.fa-arrow-turn-up.fa-rotate-90
|
||||
span = exercise.internal_title
|
||||
td.p-1.pt-2 = link_to_if(exercise.execution_environment && policy(exercise.execution_environment).show?, exercise.execution_environment, exercise.execution_environment)
|
||||
td.p-1.pt-2 = exercise.files.filter(&:teacher_defined_assessment?).length
|
||||
td.p-1.pt-2 = exercise.maximum_score
|
||||
|
@ -5,7 +5,12 @@
|
||||
- append_javascript_pack_tag('highlight')
|
||||
- append_stylesheet_pack_tag('highlight')
|
||||
|
||||
h1.d-inline-block = @exercise
|
||||
h1.d-inline-block
|
||||
= @exercise
|
||||
- if @exercise.internal_title.present?
|
||||
p.mb-0.ps-1.text-muted.small
|
||||
i.fa-solid.fa-arrow-turn-up.fa-rotate-90
|
||||
span = @exercise.internal_title
|
||||
.btn-group.float-end
|
||||
= render('shared/edit_button', object: @exercise)
|
||||
button.btn.btn-secondary.float-end.dropdown-toggle data-bs-toggle='dropdown' type='button'
|
||||
@ -19,6 +24,7 @@ h1.d-inline-block = @exercise
|
||||
li = link_to(t('exercises.export_codeharbor.label'), '', class: 'dropdown-item export-start', data: {'exercise-id' => @exercise.id}) if policy(@exercise).export_external_confirm?
|
||||
|
||||
= row(label: 'exercise.title', value: @exercise.title)
|
||||
= row(label: 'exercise.internal_title', value: @exercise.internal_title)
|
||||
= row(label: 'exercise.user', value: link_to_if(policy(@exercise.author).show?, @exercise.author, @exercise.author))
|
||||
= row(label: 'exercise.description', value: render_markdown(@exercise.description), class: 'm-0')
|
||||
= row(label: 'exercise.execution_environment', value: link_to_if(@exercise.execution_environment && policy(@exercise.execution_environment).show?, @exercise.execution_environment, @exercise.execution_environment))
|
||||
@ -57,4 +63,4 @@ ul.list-unstyled#files
|
||||
.clearfix = link_to(t('shared.destroy'), file, class:'btn btn-warning btn-sm float-end', data: {confirm: t('shared.confirm_destroy')}, method: :delete)
|
||||
= render('shared/file', file: file)
|
||||
|
||||
= render('shared/modal', id: 'export-modal', title: t('exercises.export_codeharbor.dialogtitle'), template: 'exercises/_export_dialogcontent')
|
||||
= render('shared/modal', id: 'export-modal', title: t('exercises.export_codeharbor.dialogtitle'), template: 'exercises/_export_dialogcontent')
|
||||
|
Reference in New Issue
Block a user