Files
codeocean/app/views/exercises/_file_form.html.slim
Sebastian Serth db56a690c7 Add option to suppress feedback messages
This is used to dynamically exclude some test results from being shown to users, but still allows them to run in the background (e.g., for research).
2023-07-27 10:38:49 +02:00

50 lines
2.6 KiB
Plaintext

- id = f.object.id
li.card.mt-2
.card-header role="tab" id="heading"
- collapsed_class = f.index != 'index' ? 'collapsed' : nil
- aria_expanded = f.index != 'index' ? 'false' : 'true'
a class=['file-heading', collapsed_class] data-bs-toggle="collapse" href="#collapse#{f.index}" aria-expanded="#{aria_expanded}"
div.clearfix role="button"
i.fa-solid aria-hidden="true"
span = f.object.filepath
.card-collapse.collapse class=('in' if f.object.name.nil?) id="collapse#{f.index}" role="tabpanel"
.card-body
- if policy(f.object).destroy? && id.present?
.clearfix
.btn.btn-warning.btn-sm.float-end.delete-file data-file-url=code_ocean_file_path(id) = t('shared.destroy')
.mb-3
= f.label(:name, t('activerecord.attributes.file.name'), class: 'form-label')
= f.text_field(:name, class: 'form-control')
.mb-3
= f.label(:path, t('activerecord.attributes.file.path'), class: 'form-label')
= f.text_field(:path, class: 'form-control')
.help-block.form-text = t('.hints.path')
.mb-3
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'), class: 'form-label')
= f.collection_select(:file_type_id, @file_types, :id, :name, {}, class: 'form-control')
.mb-3
= f.label(:role, t('activerecord.attributes.file.role'), class: 'form-label')
= f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map { |role| [t("files.roles.#{role}"), role] }, {}, class: 'form-control')
.form-check
label.form-check-label
= f.check_box(:hidden, class: 'form-check-input')
= t('activerecord.attributes.file.hidden')
.form-check
label.form-check-label
= f.check_box(:read_only, class: 'form-check-input')
= t('activerecord.attributes.file.read_only')
.form-check.mb-3
label.form-check-label
= f.check_box(:hidden_feedback, class: 'form-check-input')
= t('activerecord.attributes.file.hidden_feedback')
.test-related-fields style="display: #{f.object.teacher_defined_assessment? ? 'initial' : 'none'};"
.mb-3
= f.label(:name, t('activerecord.attributes.file.feedback_message'), class: 'form-label')
= f.text_area(:feedback_message, class: 'form-control', maxlength: 255)
.help-block.form-text = t('.hints.feedback_message')
.mb-3
= f.label(:role, t('activerecord.attributes.file.weight'), class: 'form-label')
= f.number_field(:weight, class: 'form-control', min: 0, step: 'any')
= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))