Printable tickets for osem

This commit is contained in:
Siddhant Bajaj 2017-02-20 07:39:46 +05:30
parent 945b4aac60
commit 76afd89f2b
4 changed files with 25 additions and 1 deletions

View file

@ -127,6 +127,10 @@ gem 'country_select'
# as PDF generator
gem 'prawn_rails'
# as QR code generator
gem 'rqrcode'
gem 'prawn-qrcode', '~> 0.2.2.1'
# to render XLS spreadsheets
gem 'axlsx_rails'

View file

@ -111,6 +111,7 @@ GEM
chart-js-rails (0.0.6)
railties (> 3.1)
chronic (0.10.2)
chunky_png (1.3.8)
cliver (0.3.2)
cloudinary (1.1.6)
aws_cf_signer
@ -331,6 +332,9 @@ GEM
prawn (1.0.0)
pdf-core (~> 0.2.2)
ttfunk (~> 1.1.1)
prawn-qrcode (0.2.2.1)
prawn (>= 0.11.1)
rqrcode (>= 0.4.1)
prawn_rails (0.0.11)
prawn (>= 0.11.1)
railties (>= 3.0.0)
@ -417,6 +421,8 @@ GEM
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rolify (5.0.0)
rqrcode (0.10.1)
chunky_png (~> 1.0)
rspec (3.0.0)
rspec-core (~> 3.0.0)
rspec-expectations (~> 3.0.0)
@ -594,6 +600,7 @@ DEPENDENCIES
phantomjs
piwik_analytics (~> 1.0.1)
poltergeist
prawn-qrcode (~> 0.2.2.1)
prawn_rails
rails (~> 4.2)
rails-assets-bootstrap-markdown!
@ -614,6 +621,7 @@ DEPENDENCIES
redcarpet
responders (~> 2.0)
rolify
rqrcode
rspec-activemodel-mocks
rspec-rails
rubocop
@ -635,4 +643,4 @@ DEPENDENCIES
whenever
BUNDLED WITH
1.12.5
1.13.7

View file

@ -32,6 +32,8 @@ class ConferenceRegistrationsController < ApplicationController
@tickets = current_user.ticket_purchases.by_conference(@conference).paid
@ticket_payments = @tickets.group_by(&:ticket_id)
@total_quantity = @tickets.group(:ticket_id).sum(:quantity)
@pdf_filename = "#{@conference.title}.pdf"
@user = current_user
end
def edit; end

View file

@ -0,0 +1,10 @@
prawn_document(force_download: true, filename: @pdf_filename, page_layout: :landscape) do |pdf|
pdf.text "Registration for #{@conference.title}", font_size: 25
pdf.text "at #{@conference.venue.name},#{@conference.venue.street},#{@conference.venue.city} / #{@conference.venue.country_name}.", font_size: 12
pdf.text "Ticket Type: #{}", font_size: 15
pdf.text "Date: #{}", font_size: 15
pdf.text "Username: #{@user.username}", font_size: 15
pdf.text "User Email: #{@user.email}", font_size: 15
pdf.text "Description: #{}", font_size: 15
pdf.print_qr_code(@user.username, :extent=>72)
end