a11yist/app/models/pdf_documents/customer_report.rb

31 lines
999 B
Ruby
Raw Permalink Normal View History

2024-09-05 22:54:38 +02:00
# frozen_string_literal: true
2024-07-21 02:57:13 +02:00
module PdfDocuments
class CustomerReport < Base
private
def generate
2024-07-22 01:29:09 +02:00
logo
2024-09-05 22:54:38 +02:00
@prawn_document.formatted_text_box [ {
2024-07-22 01:29:09 +02:00
text: "Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.", size: 8, align: :right
2024-09-05 22:54:38 +02:00
} ], align: :right
2024-07-21 02:57:13 +02:00
2024-07-22 01:29:09 +02:00
heading1 params.report.name
2024-10-31 23:13:18 +01:00
rich_text params.report.comment
2024-07-22 01:29:09 +02:00
params.report.elements.each.with_index(1) do |element, element_index|
heading2 "#{element_index} #{element.title}"
2024-09-05 22:54:38 +02:00
formatted_text [ { text: element.path, styles: %i[bold italic underline] } ]
2024-07-22 01:29:09 +02:00
move_down(5)
2024-07-21 02:57:13 +02:00
rich_text element.description_html
2024-07-22 01:29:09 +02:00
element.success_criteria.each.with_index(1) do |success_criterion, sc_index|
heading3 "#{element_index}.#{sc_index} #{success_criterion.title}"
2024-07-21 02:57:13 +02:00
rich_text success_criterion.description_html
2024-10-31 23:13:18 +01:00
rich_text success_criterion.comment
2024-07-21 02:57:13 +02:00
end
end
end
end
end