Remove PDF generation and make HTML one printable
Some checks failed
CI / scan_ruby (push) Failing after 16s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 14s
CI / test (push) Failing after 39s

This commit is contained in:
sto
2025-11-24 12:04:08 +01:00
parent c0f2358a36
commit 768af7c3e9
7 changed files with 17 additions and 32 deletions

View File

@@ -77,5 +77,3 @@ group :test do
end
gem "pundit", "~> 2.5"
gem "ferrum_pdf", "~> 3.0"

View File

@@ -128,15 +128,6 @@ GEM
railties (>= 6.1.0)
faker (3.5.2)
i18n (>= 1.8.11, < 2)
ferrum (0.17.1)
addressable (~> 2.5)
base64 (~> 0.2)
concurrent-ruby (~> 1.1)
webrick (~> 1.7)
websocket-driver (~> 0.7)
ferrum_pdf (3.0.1)
actionpack (>= 6.0.0)
ferrum (~> 0.15)
friendly_id (5.5.1)
activerecord (>= 4.0.0)
fugit (1.12.1)
@@ -429,7 +420,6 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webrick (1.9.1)
websocket (1.2.11)
websocket-driver (0.8.0)
base64
@@ -462,7 +452,6 @@ DEPENDENCIES
debug
factory_bot_rails
faker
ferrum_pdf (~> 3.0)
friendly_id (~> 5.5.0)
importmap-rails
jbuilder

View File

@@ -131,13 +131,8 @@ class ContestantsController < ApplicationController
@contestants = @contest.contestants.sort_by { |contestant| contestant.name }
@nonav = true
FerrumPdf.configure do |config|
config.process_timeout = 20
end
respond_to do |format|
format.html
format.pdf { render ferrum_pdf: {}, disposition: :inline, filename: "#{@contest.friendly_id}_qrcodes.pdf", layout: "blank" }
format.html { render layout: "blank" }
end
end

View File

@@ -5,8 +5,8 @@
.alert.alert-info
= t("contestants.generate_qrcodes.note")
a.mt-3.mb-3.btn.btn-primary href="#{contest_generate_qrcodes_pdf_path(@contest)}.pdf" target="_blank" style="margin-top: -3px"
= t("helpers.buttons.download_pdf")
a.mt-3.mb-3.btn.btn-primary href="#{contest_generate_qrcodes_pdf_path(@contest)}" target="_blank" style="margin-top: -3px"
= t("helpers.buttons.open_raw")
.col.d-flex.flex-column style="height: calc(100% - 200px)"
.d-flex.flex-column style="overflow-y: auto;"

View File

@@ -1,10 +1,11 @@
h1.text-center.mb-5 = @contest.name
h1.text-center.mt-4.mb-4 = @contest.name
.d-flex.flex-column.align-items-center
- for row in 0..((@contestants.length - 1) / 5)
.mt-4.d-flex.flex-row
- for col in 0..3
- if row * 4 + col < @contestants.length
.d-flex.flex-column.ms-5 style="align-items: center"
.d-flex.flex-column.ms-4.me-4 style="align-items: center"
- if @contestants[row * 4 + col].qrcode.present?
.mt-1 style="width: 128px; height: 120px;"
= @contestants[row * 4 + col].qrcode.html_safe

View File

@@ -271,6 +271,7 @@ en:
generate_qrcodes: Generate QR codes
import: CSV Import
open: Open
open_raw: Open in a raw page
refresh: Refresh
settings: Settings
sign_in: Sign in

View File

@@ -242,6 +242,7 @@ fr:
generate_qrcodes: Générer des QR codes
import: Importer un CSV
open: Détails
open_raw: Ouvrir dans un format imprimable
refresh: Rafraîchir
settings: Paramètres
sign_in: Se connecter