Autofill puzzle and don't show it when there's only one puzzle
All checks were successful
CI / scan_ruby (push) Successful in 14s
CI / scan_js (push) Successful in 11s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 30s

This commit is contained in:
sto 2025-06-18 07:15:39 +02:00
parent bc32387c21
commit baea71b312

View File

@ -21,11 +21,16 @@
.form-floating
= form.select :contestant_id, @contestants.map { |contestant| [contestant.name, contestant.id] }, {}, class: "form-select"
= form.label :contestant_id
.row.mb-3
.col
.form-floating
= form.select :puzzle_id, @puzzles.map { |puzzle| ["#{puzzle.name} - #{puzzle.brand}", puzzle.id] }, {}, class: "form-select"
= form.label :puzzle_id
- if @puzzles.size > 1
.row.mb-3
.col
.form-floating
= form.select :puzzle_id, @puzzles.map { |puzzle| ["#{puzzle.name} - #{puzzle.brand}", puzzle.id] }, {}, class: "form-select"
= form.label :puzzle_id
- elsif @puzzles.size == 1
= form.hidden_field :puzzle_id, value: @puzzles.first.id
- else
= form.hidden_field :puzzle_id
.row
.col
= form.submit submit_text, class: "btn btn-primary"