2015-04-23 12:07:11 +03:00
|
|
|
prawn_document(force_download: true, filename: @pdf_filename, page_layout: :landscape) do |pdf|
|
2013-01-07 09:04:09 +01:00
|
|
|
table_array = []
|
2015-04-23 12:07:11 +03:00
|
|
|
header_array = ['Attended',
|
|
|
|
|
'Name',
|
|
|
|
|
'Nickname',
|
|
|
|
|
'Affiliation',
|
|
|
|
|
'Email',
|
|
|
|
|
'Arrival Date',
|
|
|
|
|
'Departure Date']
|
|
|
|
|
@conference.questions.each do |question|
|
|
|
|
|
header_array << question.title
|
|
|
|
|
end
|
|
|
|
|
|
2013-01-07 09:04:09 +01:00
|
|
|
table_array << header_array
|
|
|
|
|
@registrations.each do |registration|
|
|
|
|
|
row = []
|
2015-04-23 12:07:11 +03:00
|
|
|
row << ( registration.attended ? 'X' : '' )
|
2014-06-23 19:07:50 +03:00
|
|
|
row << registration.name
|
2015-04-23 12:07:11 +03:00
|
|
|
row << registration.nickname
|
|
|
|
|
row << registration.affiliation
|
2013-01-07 09:04:09 +01:00
|
|
|
row << registration.email
|
2015-04-23 12:07:11 +03:00
|
|
|
row << registration.arrival.to_s || ''
|
|
|
|
|
row << registration.departure.to_s || ''
|
2013-01-07 09:04:09 +01:00
|
|
|
|
2015-04-23 12:07:11 +03:00
|
|
|
@conference.questions.each do |question|
|
|
|
|
|
qa = registration.qanswers.find_by(question: question)
|
|
|
|
|
answer = ( qa ? qa.answer.title : '' )
|
|
|
|
|
|
|
|
|
|
row << answer
|
2013-01-07 09:04:09 +01:00
|
|
|
end
|
2015-04-23 12:07:11 +03:00
|
|
|
|
2013-01-07 09:04:09 +01:00
|
|
|
table_array << row
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-23 12:07:11 +03:00
|
|
|
pdf.text "#{@conference.title} Registrations", font_size: 25
|
|
|
|
|
pdf.table table_array, header: true, cell_style: {size: 5, border_width: 1}
|
2013-05-07 14:46:33 +02:00
|
|
|
end
|