summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-10-31 14:39:53 +0100
committerHarald Eilertsen <haraldei@anduin.net>2015-10-31 16:50:56 +0100
commitc1fa8c69f8c71e011ca339cd13ef64dcf6104540 (patch)
treef590f410ab8b4a1f2c2b84958fbe62ba0a5c4998 /lib
parent37793a271f5ac06fad505ab27ad19d7f3f77be7f (diff)
downloadnorsk-urskog-registrations-c1fa8c69f8c71e011ca339cd13ef64dcf6104540.tar.gz
norsk-urskog-registrations-c1fa8c69f8c71e011ca339cd13ef64dcf6104540.tar.bz2
norsk-urskog-registrations-c1fa8c69f8c71e011ca339cd13ef64dcf6104540.zip
Move PDF file output to public/uploads
Diffstat (limited to 'lib')
-rw-r--r--lib/pdf_form.rb4
-rw-r--r--lib/registration.rb8
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/pdf_form.rb b/lib/pdf_form.rb
index 19756a7..0695c47 100644
--- a/lib/pdf_form.rb
+++ b/lib/pdf_form.rb
@@ -7,7 +7,7 @@ class PDFForm
@document = Prawn::Document.new(:page_size => "A4")
end
- def render
+ def render(filename)
heading
next_line
@@ -45,7 +45,7 @@ class PDFForm
end_text
@document.number_pages "Side <page>", :align => :center, :at => [0, 0]
- @document.render_file "#{@band.name}.pdf"
+ @document.render_file filename
end
private
diff --git a/lib/registration.rb b/lib/registration.rb
index 9826f91..5ace438 100644
--- a/lib/registration.rb
+++ b/lib/registration.rb
@@ -13,7 +13,11 @@ def send_registration_emails_for(band)
mail.deliver!
end
-def generate_pdf_for(band)
+def generate_pdf_for(band, filename)
pdf = PDFForm.new(band)
- pdf.render
+ pdf.render(filename)
+end
+
+def create_pdf_file_name(band)
+ filename = "#{Date.today.iso8601}-#{band.name}-#{band.city}.pdf"
end