summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-10-31 14:16:31 +0100
committerHarald Eilertsen <haraldei@anduin.net>2015-10-31 14:16:31 +0100
commit37793a271f5ac06fad505ab27ad19d7f3f77be7f (patch)
tree642888aa2cbedc502e51a5f722d044c2a909c14a
parentaacafd1a448c8a0e89ab66cbde5daa4c33822304 (diff)
downloadnorsk-urskog-registrations-37793a271f5ac06fad505ab27ad19d7f3f77be7f.tar.gz
norsk-urskog-registrations-37793a271f5ac06fad505ab27ad19d7f3f77be7f.tar.bz2
norsk-urskog-registrations-37793a271f5ac06fad505ab27ad19d7f3f77be7f.zip
Make PDF rendering a bit nicer, and update member listing.
-rw-r--r--lib/band.rb4
-rw-r--r--lib/pdf_form.rb31
-rw-r--r--test_pdf.rb18
3 files changed, 22 insertions, 31 deletions
diff --git a/lib/band.rb b/lib/band.rb
index 54775f4..a951059 100644
--- a/lib/band.rb
+++ b/lib/band.rb
@@ -50,4 +50,8 @@ class Band
def has_errors
errors.length > 0
end
+
+ def name_and_city
+ city.empty? ? name : name + " (" + city + ")"
+ end
end
diff --git a/lib/pdf_form.rb b/lib/pdf_form.rb
index ba47303..19756a7 100644
--- a/lib/pdf_form.rb
+++ b/lib/pdf_form.rb
@@ -12,13 +12,14 @@ class PDFForm
next_line
intro_text
- @document.stroke { @document.horizontal_rule }
- field("Bandnavn:", @band.name)
- field("Hjemsted:", @band.city)
+ subheading("Generell info:")
+
+ field("Band:", @band.name_and_city)
field("Webside:", @band.website)
field("Plateselskap:", @band.label)
field("Kort bio:", @band.short_bio)
+ field("Medlemmer:", @band.members.split("\n"))
next_line
field("Kontaktperson:", @band.contact.name)
@@ -27,9 +28,8 @@ class PDFForm
field("Epost:", @band.contact.email)
next_line
- field("Medlemmer:", @band.members)
-
next_line
+
subheading("Låter:")
@band.songs.each do |song|
field("Tittel", song.to_s)
@@ -114,14 +114,17 @@ class PDFForm
end
def end_text
- @document.text((<<-END.gsub(/\s+/, ' ') + "\n\n"), :inline_format => true)
- Jeg bekrefter herved at informasjonen gitt ovenfor er riktig, og at jeg på vegne av
- #{@band.name} har fullmakt til å melde ovennevnte låter på Norsk Urskog Metal Sampler 2016:
- END
- field("Sted:", 5.cm)
- next_line
- field("Dato:", 5.cm)
- next_line
- field("Sign:", 10.cm)
+ @document.span(@document.bounds.right) do
+ next_line
+ @document.text((<<-END.gsub(/\s+/, ' ') + "\n\n"), :inline_format => true)
+ Jeg bekrefter herved at informasjonen gitt ovenfor er riktig, og at jeg på vegne av
+ #{@band.name} har fullmakt til å melde ovennevnte låter på Norsk Urskog Metal Sampler 2016:
+ END
+ field("Sted:", 5.cm)
+ next_line
+ field("Dato:", 5.cm)
+ next_line
+ field("Sign:", 10.cm)
+ end
end
end
diff --git a/test_pdf.rb b/test_pdf.rb
index 2162261..12dd3b8 100644
--- a/test_pdf.rb
+++ b/test_pdf.rb
@@ -7,29 +7,13 @@ params = {
'website' => 'http://imbalance.no',
'label' => 'Calculated Imperfection',
'shortbio' => 'Thrash metal from Norway',
+ 'members' => "Harald Eilertsen, Bass/Vocals\nWelle, Drums\nThormodr, Guitar",
'contact' => {
'name' => 'Harald Eilertsen',
'addr' => "Gamleveien 13\n1289 Snufstad",
'phone' => '98765432',
'email' => 'mail@imbalance.no'
},
- 'members' => {
- '1' => {
- 'name' => 'Harald Eilertsen',
- 'instrument' => 'Bass/Vocals',
- 'age' => ''
- },
- '2' => {
- 'name' => 'Welle',
- 'instrument' => 'Drums',
- 'age' => ''
- },
- '3' => {
- 'name' => 'Thormodr',
- 'instrument' => 'Guitar',
- 'age' => ''
- }
- },
'songs' => {
'1' => {
'title' => 'Bestial by Nature',