From a2a8a9fcef9db15e1829f8f0832780e77fac2901 Mon Sep 17 00:00:00 2001 From: sto Date: Thu, 4 Dec 2025 10:50:10 +0100 Subject: [PATCH] Make public contestant forms activated only when organizers code are set https://gitea.puzzle-scoreboard.org/sto/puzzle-scoreboard/issues/20 --- app/controllers/contestants_controller.rb | 6 +++--- config/locales/en.yml | 2 +- config/locales/fr.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/contestants_controller.rb b/app/controllers/contestants_controller.rb index 80ffefc..6c2d1d2 100644 --- a/app/controllers/contestants_controller.rb +++ b/app/controllers/contestants_controller.rb @@ -144,7 +144,7 @@ class ContestantsController < ApplicationController skip_authorization @contestant = Contestant.find(params[:contestant_id]) - if !@contestant + if !@contestant || !@contestant.contest.code.present? not_found and return end @contest = @contestant.contest @@ -161,7 +161,7 @@ class ContestantsController < ApplicationController skip_authorization @contestant = Contestant.find(params[:contestant_id]) - if !@contestant + if !@contestant || !@contestant.contest.code.present? not_found and return end @contest = @contestant.contest @@ -191,7 +191,7 @@ class ContestantsController < ApplicationController skip_authorization @contestant = Contestant.find(params[:contestant_id]) - if !@contestant + if !@contestant || !@contestant.contest.code.present? not_found and return end I18n.locale = @contestant.contest.lang diff --git a/config/locales/en.yml b/config/locales/en.yml index 8171174..ca7b281 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -55,7 +55,7 @@ en: remaining_pieces: Remaining pieces (not completed puzzle) contest: code: Code for onsite judges - code_description: Only useful for onsite contests, if printing QR codes on tables + code_description: Optional. Used for organizers on onsite contests, when printing QR codes on tables duration: Duration duration_description: Format h:mm or hh:mm lang: Language for the public scoreboard diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 2c253e0..3461a55 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -26,7 +26,7 @@ fr: remaining_pieces: Pièces restantes (puzzle non fini) contest: code: Code pour les organisateur.ice.s - code_description: Utile uniquement pour les concours en présentiel, si les QR codes sont imprimés et placés sur les tables + 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 lang: Langue pour le classement public