A lot :)
This commit is contained in:
parent
aad67af0d1
commit
63fc206c27
153 changed files with 2043 additions and 646 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PdfDocuments
|
||||
class Base
|
||||
attr_reader :params
|
||||
|
|
@ -11,7 +13,7 @@ module PdfDocuments
|
|||
# exta_bold: 'vendor/assets/fonts/Lexend-ExtraBold.ttf',
|
||||
# italic: 'vendor/assets/fonts/Lexend-Regular.ttf'
|
||||
# })
|
||||
@prawn_document.font 'Helvetica', size: 12
|
||||
@prawn_document.font "Helvetica", size: 12
|
||||
@params = OpenStruct.new(params)
|
||||
end
|
||||
|
||||
|
|
@ -47,7 +49,7 @@ module PdfDocuments
|
|||
end
|
||||
|
||||
def hr
|
||||
@prawn_document.markup '<hr>'
|
||||
@prawn_document.markup "<hr>"
|
||||
end
|
||||
|
||||
def markup_options
|
||||
|
|
@ -63,12 +65,12 @@ module PdfDocuments
|
|||
end
|
||||
|
||||
def logo
|
||||
@prawn_document.image 'app/assets/images/logo-apfelschule.png', width: 150
|
||||
@prawn_document.image "app/assets/images/logo-apfelschule.png", width: 150
|
||||
@prawn_document.move_down 30
|
||||
end
|
||||
|
||||
def prepare_rich_text(rich_text)
|
||||
{ h1: 'h4' }.each do |tag, replacement|
|
||||
{ h1: "h4" }.each do |tag, replacement|
|
||||
rich_text = rich_text.to_s.gsub("<#{tag}", "<#{replacement}")
|
||||
rich_text = rich_text.to_s.gsub("</#{tag}>", "</#{replacement}>")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,19 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PdfDocuments
|
||||
class CustomerReport < Base
|
||||
private
|
||||
|
||||
def generate
|
||||
logo
|
||||
@prawn_document.formatted_text_box [{
|
||||
@prawn_document.formatted_text_box [ {
|
||||
text: "Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.", size: 8, align: :right
|
||||
}], align: :right
|
||||
} ], align: :right
|
||||
|
||||
heading1 params.report.name
|
||||
rich_text params.report.comment_html
|
||||
|
||||
params.report.elements.each.with_index(1) do |element, element_index|
|
||||
heading2 "#{element_index} #{element.title}"
|
||||
formatted_text [{ text: element.path, styles: %i[bold italic underline] }]
|
||||
formatted_text [ { text: element.path, styles: %i[bold italic underline] } ]
|
||||
move_down(5)
|
||||
rich_text element.description_html
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue