117 lines
4.7 KiB
Plaintext
117 lines
4.7 KiB
Plaintext
= form_with model: contestant, url: url, method: method do |form|
|
|
.row.mb-3
|
|
.col
|
|
.form-floating
|
|
= form.text_field :name, autocomplete: "off", class: "form-control"
|
|
= form.label :name, class: "required"
|
|
.row.mb-3
|
|
.col
|
|
.form-floating
|
|
= form.text_field :email, autocomplete: "off", class: "form-control"
|
|
= form.label :email
|
|
.form-text
|
|
= t("activerecord.attributes.contestant.email_description")
|
|
- if @contest.categories && method == :patch
|
|
.row.mt-4
|
|
.col
|
|
- @contest.categories.each do |category|
|
|
.form-check.form-switch
|
|
= form.check_box "category_#{category.id}".to_sym, class: "form-check-input", checked: @contestant.categories.where(id: category.id).any?
|
|
= form.label category.name
|
|
|
|
.row.mt-4
|
|
.col
|
|
- if method == :patch
|
|
= link_to t("helpers.buttons.delete"), contest_contestant_path(contest, contestant), data: { turbo_method: :delete }, class: "btn btn-danger me-2"
|
|
= form.submit submit_text, class: "btn btn-primary"
|
|
|
|
- if method == :patch
|
|
.row.mt-5
|
|
.col
|
|
h3 Completions
|
|
- if @contest.puzzles.length == 0
|
|
.row
|
|
.col
|
|
.alert.alert-warning
|
|
= t("contestants.edit.no_puzzles_note")
|
|
- else
|
|
.row
|
|
.col
|
|
.alert.alert-info
|
|
= t("contestants.edit.completions_note")
|
|
table.table.table-striped.table-hover
|
|
thead
|
|
tr
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.completed")
|
|
- if @contest.puzzles.size > 1
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.display_time_from_start")
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.display_relative_time")
|
|
- else
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.display_time")
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.projected_time")
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.missing_pieces")
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.remaining_pieces")
|
|
th scope="col"
|
|
= t("activerecord.attributes.completion.puzzle")
|
|
tbody
|
|
- @completions.each do |completion|
|
|
tr scope="row"
|
|
td
|
|
- if completion.completed
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-square" viewBox="0 0 16 16">
|
|
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>
|
|
<path d="M10.97 4.97a.75.75 0 0 1 1.071 1.05l-3.992 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/>
|
|
</svg>
|
|
td
|
|
= display_time(completion.time_seconds)
|
|
- if @contest.puzzles.size > 1
|
|
td
|
|
= completion.display_relative_time
|
|
- else
|
|
td
|
|
= display_time(completion.projected_time)
|
|
td
|
|
= completion.missing_pieces
|
|
td
|
|
= completion.remaining_pieces
|
|
td
|
|
- if !completion.puzzle.brand.blank?
|
|
| #{completion.puzzle.name} - #{completion.puzzle.brand}
|
|
- else
|
|
| #{completion.puzzle.name}
|
|
td
|
|
a.btn.btn-sm.btn-secondary.me-2 href=edit_contest_completion_path(@contest, completion, contestant_id: contestant.id)
|
|
= t("helpers.buttons.edit")
|
|
= link_to t("helpers.buttons.delete"), contest_completion_path(contest, completion, contestant_id: contestant.id),
|
|
data: { turbo_method: :delete }, class: "btn btn-sm btn-secondary"
|
|
.row
|
|
.col
|
|
a.btn.btn-primary href=new_contest_completion_path(@contest, contestant_id: contestant.id)
|
|
= t("helpers.buttons.add")
|
|
|
|
- if contestant.offline.present?
|
|
.row.mt-5.mb-2
|
|
.col
|
|
h3 = t("contestants.edit.offline_participation")
|
|
.row.mb-5
|
|
.col-6
|
|
h4 = t("contestants.edit.start_image")
|
|
- if contestant.offline.images.length > 0
|
|
.mt-3.mb-1
|
|
= contestant.offline.start_time.to_fs(:rfc822)
|
|
= image_tag(contestant.offline.images[0], class: "img-fluid", style: "max-height: 400px")
|
|
.col-6
|
|
h4 = t("contestants.edit.end_image")
|
|
- if contestant.offline.images.length > 1
|
|
.mt-3.mb-1
|
|
= contestant.offline.end_time.to_fs(:rfc822)
|
|
= image_tag(contestant.offline.images[1], class: "img-fluid", style: "max-height: 400px")
|
|
- else
|
|
= t("contestants.edit.not_finished") |