Files
puzzle-scoreboard/app/views/contests/offline_new.html.slim
sto 37a65526e4
Some checks failed
CI / scan_ruby (push) Successful in 17s
CI / scan_js (push) Successful in 14s
CI / lint (push) Failing after 15s
CI / test (push) Successful in 42s
Implement offline POST method for starting an offline participation
2025-10-30 11:37:20 +01:00

30 lines
1.1 KiB
Plaintext

= form_with model: @offline, url: "/public/#{@contest.friendly_id}/offline" 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-text.mb-1
= t("offlines.start_image_select")
= form.file_field :start_image, accept: "image/*", class: "form-control"
.form-text.error-message style="display: none;" id="image-error-message"
= t("puzzles.form.file_too_big")
javascript:
function setMaxUploadSize() {
const el = document.querySelector('input[type="file"]');
el.onchange = function() {
if(this.files[0].size > 2 * 1024 * 1024) {
document.getElementById('image-error-message').style.display = 'block';
this.value = "";
} else {
document.getElementById('image-error-message').style.display = 'none';
}
};
}
setMaxUploadSize();
.row.mt-4
.col
= form.submit t("helpers.buttons.start"), class: "btn btn-primary"