Files
codeocean/app/views/proxy_exercises/_form.html.slim
2024-05-21 19:42:26 +02:00

39 lines
1.7 KiB
Plaintext

- content_for :head do
// Force a full page reload, see https://github.com/turbolinks/turbolinks/issues/326.
Otherwise, code might not be highlighted correctly (race condition)
meta name='turbolinks-visit-control' content='reload'
- append_javascript_pack_tag('toast-ui')
- append_stylesheet_pack_tag('toast-ui')
= form_for(@proxy_exercise, multipart: true, builder: MarkdownFormBuilder) do |f|
= render('shared/form_errors', object: @proxy_exercise)
.mb-3
= f.label(:title, class: 'form-label')
= f.text_field(:title, class: 'form-control', required: true)
.mb-3
= f.label(:description, class: 'form-label')
= f.markdown :description
.mb-3
= f.label(:algorithm, class: 'form-label')
= f.collection_select(:algorithm, ProxyExercise.algorithms.map {|algorithm, _id| [t("activerecord.attributes.proxy_exercise.algorithm_type.#{algorithm}"), algorithm] }, :second, :first, {}, class: 'form-control form-control-sm')
.form-check.mb-3
label.form-check-label
= f.check_box(:public, class: 'form-check-input')
= f.label(:public, class: 'form-label mb-0')
h3 Exercises
.table-responsive
table.table
thead
tr
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
td = b.check_box class: 'form-check-input'
td = link_to_if(policy(b.object).show?, b.object, b.object)
td = l(b.object.created_at, format: :short)
.actions = render('shared/submit_button', f:, object: @proxy_exercise)