Require contest durations, prefill end times for unfinished puzzles & allow to modify them
This commit is contained in:
@@ -43,19 +43,19 @@
|
||||
const missingPiecesEl = document.getElementById('missing_pieces');
|
||||
const remainingPiecesEl = document.getElementById('remaining_pieces');
|
||||
if (e.target.checked) {
|
||||
timeEl.style.display = 'block';
|
||||
timeEl.value = '#{@completion.display_time_from_start}';
|
||||
missingPiecesEl.style.display = 'block';
|
||||
remainingPiecesEl.style.display = 'none';
|
||||
} else {
|
||||
timeEl.style.display = 'none';
|
||||
timeEl.value = '#{display_time(@contest.duration_seconds)}';
|
||||
missingPiecesEl.style.display = 'none';
|
||||
remainingPiecesEl.style.display = 'block';
|
||||
}
|
||||
})
|
||||
.row.mb-3 id="time"
|
||||
.row.mb-3
|
||||
.col
|
||||
.form-floating
|
||||
= form.text_field :display_time_from_start, autocomplete: "off", class: "form-control"
|
||||
= form.text_field :display_time_from_start, autocomplete: "off", class: "form-control", id: "time"
|
||||
= form.label :display_time_from_start, class: "required"
|
||||
.row.mb-3 id="missing_pieces"
|
||||
.col
|
||||
@@ -69,15 +69,12 @@
|
||||
= form.label :remaining_pieces
|
||||
javascript:
|
||||
completedEl = document.getElementById('completion_completed');
|
||||
timeEl = document.getElementById('time');
|
||||
missingPiecesEl = document.getElementById('missing_pieces');
|
||||
remainingPiecesEl = document.getElementById('remaining_pieces');
|
||||
if (completedEl.checked) {
|
||||
timeEl.style.display = 'block';
|
||||
missingPiecesEl.style.display = 'block';
|
||||
remainingPiecesEl.style.display = 'none';
|
||||
} else {
|
||||
timeEl.style.display = 'none';
|
||||
missingPiecesEl.style.display = 'none';
|
||||
remainingPiecesEl.style.display = 'block';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user