Make asking for missing pieces in forms optional
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
sto
2026-08-25 09:26:29 +02:00
parent 95c336be65
commit 00e14b7cff
9 changed files with 20 additions and 5 deletions

View File

@@ -78,6 +78,7 @@
javascript:
savetime = "";
ispatch = #{method == :patch};
showMissingPieces = #{@completion.contest.missing_pieces}
// Actions for radio buttons.
completed_radio_yes_el = document.getElementById('completed_radio_yes');
@@ -90,7 +91,7 @@
if (ispatch) timeEl.value = '#{@completion.display_time_from_start}';
else timeEl.value = savetime;
timeEl.parentElement.parentElement.parentElement.style.display = '';
missingPiecesEl.style.display = 'block';
if (showMissingPieces) missingPiecesEl.style.display = 'block';
remainingPiecesEl.style.display = 'none';
submitEl.style.display = '';
if (refreshEl) refreshEl.style.display = '';
@@ -150,7 +151,7 @@
updateTime();
/ Text field for recording the missing pieces, if any.
.row.mt-3 id="missing_pieces" style="display: #{@completion.completed ? "" : "none"};"
.row.mt-3 id="missing_pieces" style="display: #{@completion.completed && @completion.contest.missing_pieces ? "" : "none"};"
.col
.form-floating
= form.text_field :missing_pieces, autocomplete: "off", class: "form-control"

View File

@@ -10,13 +10,17 @@
.form-check.form-switch
= form.check_box :organizer_form, class: "form-check-input"
= form.label :organizer_form
.form-text = t("activerecord.attributes.contest.organizer_form")
.row.mt-3.mb-3
.col
.form-floating
= form.text_field :code, autocomplete: "off", class: "form-control"
= form.label :code, class: "required"
.form-text = t("activerecord.attributes.contest.code_description")
.row.mt-1
.col
.form-check.form-switch
= form.check_box :missing_pieces, class: "form-check-input"
= form.label :missing_pieces
.row.mt-4
.col
= form.submit t("helpers.buttons.update"), class: "btn btn-primary"