Make asking for missing pieces in forms optional
This commit is contained in:
@@ -328,7 +328,7 @@ class ContestsController < ApplicationController
|
||||
end
|
||||
|
||||
def settings_onsite_params
|
||||
params.expect(contest: [ :code, :organizer_form ])
|
||||
params.expect(contest: [ :code, :organizer_form, :missing_pieces ])
|
||||
end
|
||||
|
||||
def settings_online_params
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
# duration :string
|
||||
# duration_seconds :integer
|
||||
# lang :string default("en")
|
||||
# missing_pieces :boolean
|
||||
# name :string
|
||||
# offline_form :boolean default(FALSE)
|
||||
# organizer_form :boolean
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user