Add contest param for offline form participation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user