39 lines
1.9 KiB
Plaintext
39 lines
1.9 KiB
Plaintext
= 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.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')
|
|
.mb-3
|
|
= f.label(t('activerecord.attributes.exercise_collections.user'), class: 'form-label')
|
|
= f.collection_select(:user_id, InternalUser.order(:name), :id, :name, {}, {class: 'form-control'})
|
|
|
|
.table-responsive#exercise-list
|
|
table.table
|
|
thead
|
|
tr
|
|
th
|
|
th = t('activerecord.attributes.exercise_collection_item.exercise')
|
|
th colspan=2 = t('shared.actions')
|
|
tbody#sortable
|
|
- @exercise_collection.items.order(:position).each do |item|
|
|
tr data-id=item.exercise.id
|
|
td
|
|
span.fa-solid.fa-bars
|
|
td = item.exercise.title
|
|
td = link_to(t('shared.show'), item.exercise, 'data-turbolinks': 'false')
|
|
td
|
|
a.remove-exercise href='#' = t('shared.destroy')
|
|
.d-none
|
|
= f.collection_select(:exercise_ids, Exercise.all, :id, :title, {}, {id: 'exercise-select', class: 'form-control', multiple: true})
|
|
.exercise-actions
|
|
button.btn.btn-outline-primary type='button' data-bs-toggle='modal' data-bs-target='#add-exercise-modal' = t('exercise_collections.form.add_exercises')
|
|
button.btn.btn-secondary#sort-button type='button' = t('exercise_collections.form.sort_by_title')
|
|
|
|
.actions = render('shared/submit_button', f:, object: @exercise_collection)
|
|
|
|
= render('shared/modal', id: 'add-exercise-modal', title: t('.add_exercises'), template: 'exercise_collections/_add_exercise_modal')
|