From 762ecc23f8e091317b2ebac122e1fc35594e8f58 Mon Sep 17 00:00:00 2001 From: sto Date: Tue, 25 Aug 2026 09:37:31 +0200 Subject: [PATCH] Show public scoreboard QR code for events --- app/controllers/contests_controller.rb | 9 +++++++++ app/views/layouts/authenticated.html.slim | 3 +++ 2 files changed, 12 insertions(+) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 9916740..1381ed7 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -192,6 +192,15 @@ class ContestsController < ApplicationController authorize @contest render :scoreboard_not_started and return end + host = Rails.application.config.action_controller.default_url_options[:host] + @qrcode = RQRCode::QRCode.new("https://#{host}/public/event/#{@event.friendly_id}?contest_id=#{@contest.id}").as_svg( + color: "000", + shape_rendering: "crispEdges", + module_size: 3, + standalone: true, + use_path: true, + viewbox: true + ) else @contest = Contest.find_by(slug: params[:id]) unless @contest && @contest.public diff --git a/app/views/layouts/authenticated.html.slim b/app/views/layouts/authenticated.html.slim index 7990889..aedef06 100644 --- a/app/views/layouts/authenticated.html.slim +++ b/app/views/layouts/authenticated.html.slim @@ -48,6 +48,9 @@ html - if active_page("/public") == "active" && @is_scoreboard - if active_page("/public/event/") == "active" = @contest.event.name + - if @qrcode + .float-end style="width: 80px; height: 80px;" + = @qrcode.html_safe = render "event_nav" - else = @contest.name