Before a few renames
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
module IdCard
|
||||
class PrintDataController < ApplicationController
|
||||
|
||||
def generate_sample
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
sample_cards_pdf = IdCardPrinter::SampleCardsGenerator.new(@employer).call
|
||||
|
||||
send_data sample_cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def generate_print
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "PrintCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def generate_mobile_display
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def generate_full_page
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
cards_pdf = IdCardPrinter::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||
|
||||
cards_pdf.rewind
|
||||
send_data cards_pdf.sysread,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip",
|
||||
type: 'application/zip',
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user