Add contest organizer form param
This commit is contained in:
@@ -164,7 +164,7 @@ class ContestantsController < ApplicationController
|
||||
skip_authorization
|
||||
|
||||
@contestant = Contestant.find(params[:contestant_id])
|
||||
if !@contestant || !@contestant.contest.code.present?
|
||||
if !@contestant || !@contestant.contest.code.present? || !@contestant.contest.organizer_form
|
||||
not_found and return
|
||||
end
|
||||
@contest = @contestant.contest
|
||||
|
||||
@@ -286,7 +286,7 @@ class ContestsController < ApplicationController
|
||||
end
|
||||
|
||||
def settings_onsite_params
|
||||
params.expect(contest: [ :code ])
|
||||
params.expect(contest: [ :code, :organizer_form ])
|
||||
end
|
||||
|
||||
def settings_online_params
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
# lang :string default("en")
|
||||
# name :string
|
||||
# offline_form :boolean default(FALSE)
|
||||
# organizer_form :boolean
|
||||
# pause_time :datetime
|
||||
# public :boolean default(FALSE)
|
||||
# ranking_mode :string
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
= render "params_nav"
|
||||
|
||||
= form_with model: @contest, url: "/contests/#{@contest.id}/settings/onsite" do |form|
|
||||
.row.mt-2.mb-3
|
||||
.row
|
||||
.col
|
||||
.alert.alert-warning role="alert"
|
||||
= t("contests.nav.onsite_description")
|
||||
.row.mt-1
|
||||
.col
|
||||
.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"
|
||||
|
||||
@@ -63,6 +63,8 @@ en:
|
||||
offline_form: Enable the offline participation form
|
||||
offline_form_description: Offline participants will have to fill the form by providing an image taken of the puzzle before starting solving it, and validate their finish time with an upload of an image of the completed puzzle
|
||||
offline_form_warning: Only for single-puzzle contests
|
||||
organizer_form: Enable the public organizer forms
|
||||
organizer_form_description: Required for QR codes to work.
|
||||
public: Enable the public scoreboard
|
||||
ranking_mode: Ranking mode (public scoreboard & CSV exports)
|
||||
show_stopwatch: Display the stopwatch
|
||||
@@ -213,6 +215,7 @@ en:
|
||||
general: General
|
||||
online: Online contests
|
||||
onsite: Onsite contests
|
||||
onsite_description: Beware once those forms are activated, the puzzle names become findable through guessing the form URL. Later I'll work on better securing them so this setting won't be necessary anymore.
|
||||
public: Public scoreboard
|
||||
settings: Settings
|
||||
stopwatch: Stopwatch
|
||||
|
||||
@@ -25,7 +25,7 @@ fr:
|
||||
projected_time: Temps projeté
|
||||
remaining_pieces: Pièces restantes (puzzle non fini)
|
||||
contest:
|
||||
code: Code pour les organisateur.ice.s
|
||||
code: Code pour les organisateur.ices
|
||||
code_description: Optionnel. Utilisé pour les organisateur.ices dans les concours en présentiel lorsque sont imprimés des QR codes à placer sur les tables
|
||||
duration: Durée
|
||||
duration_description: Format h:mm ou hh:mm
|
||||
@@ -34,6 +34,8 @@ fr:
|
||||
offline_form: Activer le formulaire de participation hors-ligne
|
||||
offline_form_description: Les participant.e.s hors-ligne pourront participer en prenant une photo du puzzle avant de le commencer, puis valider leur temps avec une photo du puzzle une fois complété
|
||||
offline_form_warning: Activable uniquement pour les concours avec un seul puzzle
|
||||
organizer_form: Activer les formulaires publics pour les organisateur.ices
|
||||
organizer_form_description: Nécessaire pour que les QR codes fonctionnent
|
||||
public: Activer le classement public
|
||||
ranking_mode: Mode de classement (classement public & exports CSV)
|
||||
show_stopwatch: Afficher le chronomètre
|
||||
@@ -184,6 +186,7 @@ fr:
|
||||
general: Général
|
||||
online: Concours en ligne
|
||||
onsite: Concours en présentiel
|
||||
onsite_description: Attention, les URLs de ces formulaires sont actuellement techniquement devinables, et une personne mal intentionnée pourrait y trouver la liste de noms des puzzles grâce au menu déroulant présent sur ce formulaire. Je vais travailler bientôt à mieux sécuriser ces formulaires et ce paramètre deviendra alors non nécessaire. En attendant je recommande de garder ce paramètre désactivé tant que le concours n'est pas commencé.
|
||||
public: Classement public
|
||||
settings: Paramètres
|
||||
stopwatch: Chronomètre
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddOrganizerFormToContest < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :contests, :organizer_form, :boolean
|
||||
end
|
||||
end
|
||||
3
db/schema.rb
generated
3
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_12_10_092658) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2026_04_24_091108) do
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "record_type", null: false
|
||||
@@ -106,6 +106,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_10_092658) do
|
||||
t.datetime "start_time"
|
||||
t.datetime "pause_time"
|
||||
t.boolean "show_stopwatch"
|
||||
t.string "organizer_form"
|
||||
t.index ["slug"], name: "index_contests_on_slug", unique: true
|
||||
t.index ["user_id"], name: "index_contests_on_user_id"
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
# lang :string default("en")
|
||||
# name :string
|
||||
# offline_form :boolean default(FALSE)
|
||||
# organizer_form :boolean
|
||||
# pause_time :datetime
|
||||
# public :boolean default(FALSE)
|
||||
# ranking_mode :string
|
||||
|
||||
Reference in New Issue
Block a user