Add contest param for offline form participation
Some checks failed
CI / scan_ruby (push) Successful in 20s
CI / scan_js (push) Successful in 15s
CI / lint (push) Failing after 13s
CI / test (push) Successful in 38s

This commit is contained in:
sto
2025-10-30 10:30:32 +01:00
parent 35ad7da355
commit aea001cdf6
9 changed files with 30 additions and 3 deletions

View File

@@ -101,7 +101,7 @@ class ContestsController < ApplicationController
def offline_new
@contest = Contest.find_by(slug: params[:id])
unless @contest && @contest.public
unless @contest && @contest.offline_form
skip_authorization
not_found and return
end
@@ -127,7 +127,7 @@ class ContestsController < ApplicationController
end
def contest_params
params.expect(contest: [ :lang, :name, :public, :team, :allow_registration ])
params.expect(contest: [ :lang, :name, :offline_form, :public, :team, :allow_registration ])
end
def filter_contestants_per_category

View File

@@ -6,6 +6,7 @@
# allow_registration :boolean default(FALSE)
# lang :string default("en")
# name :string
# offline_form :boolean default(FALSE)
# public :boolean default(FALSE)
# slug :string
# team :boolean default(FALSE)

View File

@@ -15,6 +15,11 @@ h4.mt-5 = t("contests.form.general")
.form-check.form-switch
= form.check_box :public, class: "form-check-input"
= form.label :public
.row.mb-3
.col
.form-check.form-switch
= form.check_box :offline_form, class: "form-check-input"
= form.label :offline_form
.row.mb-3
.col
.form-check.form-switch

View File

@@ -20,6 +20,12 @@ javascript:
- else
a.btn.btn-success.disabled
= t("contests.show.public_scoreboard_disabled")
- if @contest.offline_form
a.ms-3.btn.btn-success href="/public/#{@contest.slug}/offline"
= t("contests.show.open_offline_form")
- else
a.ms-3.btn.btn-success.disabled
= t("contests.show.offline_form_disabled")
button.btn.btn-success.ms-3 onclick="copyExtensionUrlToClipboard()"
css:
button > svg {