Module: WithCertificateRender
- Extended by:
- ActiveSupport::Concern
- Included in:
- CertificatesController, UserMailer
- Defined in:
- app/controllers/concerns/with_certificate_render.rb
Instance Method Summary collapse
Instance Method Details
#pdf_for(certificate) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/concerns/with_certificate_render.rb', line 17 def pdf_for(certificate) pdf_html = render_to_string(partial: 'certificates/download', locals: { certificate: certificate }) WickedPdf.new.pdf_from_string pdf_html, orientation: 'Landscape', page_size: 'A5', margin: { top: 0.5, left: 1, bottom: 0.5, right: 1 } end |
#qr_for(certificate) ⇒ Object
12 13 14 15 |
# File 'app/controllers/concerns/with_certificate_render.rb', line 12 def qr_for(certificate) qr = RQRCode::QRCode.new(verify_certificate_url certificate.organization, certificate.code).as_svg(color: '0B465D') "data:image/svg+xml,#{URI.encode(qr)}" end |