Add PDF generation for QR codes
This commit is contained in:
@@ -1,20 +1,25 @@
|
||||
- if @contest.code.present?
|
||||
.row.mb-4 style="height: calc(100vh - 280px)"
|
||||
.mb-4 style="height: calc(100vh - 280px)"
|
||||
.row
|
||||
.col
|
||||
.alert.alert-info
|
||||
= t("contestants.generate_qrcodes.note")
|
||||
.col.d-flex.flex-column style="height: 100%"
|
||||
.d-flex.flex-column style="overflow-y: auto"
|
||||
|
||||
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")
|
||||
|
||||
.col.d-flex.flex-column style="height: calc(100% - 200px)"
|
||||
.d-flex.flex-column style="overflow-y: auto;"
|
||||
- for row in 0..((@contestants.length - 1) / 5)
|
||||
.mt-4.d-flex.flex-row
|
||||
- for col in 0..4
|
||||
- if row * 5 + col < @contestants.length
|
||||
- for col in 0..3
|
||||
- if row * 4 + col < @contestants.length
|
||||
.d-flex.flex-column.ms-5 style="align-items: center"
|
||||
= @contestants[row * 5 + col].name
|
||||
- if @contestants[row * 5 + col].qrcode.present?
|
||||
.mt-1 style="width: 180px; height: 180px;"
|
||||
= @contestants[row * 5 + col].qrcode.html_safe
|
||||
- if @contestants[row * 4 + col].qrcode.present?
|
||||
.mt-1 style="width: 128px; height: 120px;"
|
||||
= @contestants[row * 4 + col].qrcode.html_safe
|
||||
.name.text-center.mt-3 style="font-size: 0.7rem; max-width: 128px; height: 30px;"
|
||||
= @contestants[row * 4 + col].name
|
||||
- else
|
||||
.row
|
||||
.col
|
||||
|
||||
12
app/views/contestants/generate_qrcodes_pdf.html.slim
Normal file
12
app/views/contestants/generate_qrcodes_pdf.html.slim
Normal file
@@ -0,0 +1,12 @@
|
||||
h1.text-center.mb-5 = @contest.name
|
||||
|
||||
- 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"
|
||||
- if @contestants[row * 4 + col].qrcode.present?
|
||||
.mt-1 style="width: 128px; height: 120px;"
|
||||
= @contestants[row * 4 + col].qrcode.html_safe
|
||||
.name.text-center.mt-3 style="font-size: 0.7rem; max-width: 128px; height: 30px;"
|
||||
= @contestants[row * 4 + col].name
|
||||
6
app/views/layouts/blank.html.slim
Normal file
6
app/views/layouts/blank.html.slim
Normal file
@@ -0,0 +1,6 @@
|
||||
doctype html
|
||||
html
|
||||
= render "layouts/header"
|
||||
|
||||
body
|
||||
= yield
|
||||
Reference in New Issue
Block a user