diff --git a/.forgejo/workflows/build_push.yml b/.forgejo/workflows/build_push.yml
index c114064..0e53725 100644
--- a/.forgejo/workflows/build_push.yml
+++ b/.forgejo/workflows/build_push.yml
@@ -12,7 +12,7 @@ jobs:
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
- uses: docker/login-action@v3
+ uses: docker/login-action@v5
with:
registry: code.hohl.cloud
username: ${{ secrets.DOCKERHUB_USERNAME }}
diff --git a/app/assets/images/logo-apfelschule.png b/app/assets/images/logo-apfelschule.png
new file mode 100644
index 0000000..475c455
Binary files /dev/null and b/app/assets/images/logo-apfelschule.png differ
diff --git a/app/models/pdf_documents/base.rb b/app/models/pdf_documents/base.rb
index b72bceb..6c7ecef 100644
--- a/app/models/pdf_documents/base.rb
+++ b/app/models/pdf_documents/base.rb
@@ -1,14 +1,17 @@
module PdfDocuments
class Base
+ attr_reader :params
+
def initialize(prawn_document, **params)
@prawn_document = prawn_document
@prawn_document.markup_options = markup_options
- @prawn_document.font_families.update('Lexend' => {
- normal: 'vendor/assets/fonts/Lexend-Light.ttf',
- bold: 'vendor/assets/fonts/Lexend-Bold.ttf',
- italic: 'vendor/assets/fonts/Lexend-Regular.ttf'
- })
- @prawn_document.font 'Lexend'
+ # @prawn_document.font_families.update('Lexend' => {
+ # normal: 'vendor/assets/fonts/Lexend-Light.ttf',
+ # bold: 'vendor/assets/fonts/Lexend-Bold.ttf',
+ # exta_bold: 'vendor/assets/fonts/Lexend-ExtraBold.ttf',
+ # italic: 'vendor/assets/fonts/Lexend-Regular.ttf'
+ # })
+ @prawn_document.font 'Helvetica', size: 12
@params = OpenStruct.new(params)
end
@@ -24,14 +27,14 @@ module PdfDocuments
end
def heading1(text)
- @prawn_document.markup "
#{text}
"
+ @prawn_document.markup "#{text}
"
end
def heading2(text)
@prawn_document.markup "#{text}
"
end
- def heading2(text)
+ def heading3(text)
@prawn_document.markup "#{text}
"
end
@@ -43,18 +46,27 @@ module PdfDocuments
@prawn_document.markup prepare_rich_text(text)
end
+ def hr
+ @prawn_document.markup '
'
+ end
+
def markup_options
{
- text: { size: 10, margin_bottom: 10 },
- heading1: { style: :bold, size: 24, margin_bottom: 10, margin_top: 20 },
- heading2: { style: :bold, size: 18, margin_bottom: 10, margin_top: 15 },
- heading3: { style: :bold, size: 16, margin_bottom: 10, margin_top: 10 },
- heading4: { style: :bold, size: 14, margin_bottom: 10, margin_top: 5 },
- heading5: { style: :bold, size: 14, margin_bottom: 10, margin_top: 5 },
- heading6: { style: :thin, size: 14, margin_bottom: 10, margin_top: 5 }
+ text: { size: 12, margin_bottom: 5 },
+ heading1: { style: :bold, size: 26, margin_bottom: 10, margin_top: 0 },
+ heading2: { style: :bold, size: 17, margin_bottom: 10, margin_top: 5 },
+ heading3: { style: :bold, size: 13, margin_bottom: 10, margin_top: 5 },
+ heading4: { style: :bold, size: 12, margin_bottom: 10, margin_top: 5 },
+ heading5: { style: :bold, size: 12, margin_bottom: 10, margin_top: 5 },
+ heading6: { style: :thin, size: 12, margin_bottom: 10, margin_top: 5 }
}
end
+ def logo
+ @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|
rich_text = rich_text.to_s.gsub("<#{tag}", "<#{replacement}")
@@ -63,5 +75,17 @@ module PdfDocuments
rich_text
end
+
+ def font(...)
+ @prawn_document.font(...)
+ end
+
+ def formatted_text(...)
+ @prawn_document.formatted_text(...)
+ end
+
+ def move_down(...)
+ @prawn_document.move_down(...)
+ end
end
end
diff --git a/app/models/pdf_documents/customer_report.rb b/app/models/pdf_documents/customer_report.rb
index 997c5a1..048ca10 100644
--- a/app/models/pdf_documents/customer_report.rb
+++ b/app/models/pdf_documents/customer_report.rb
@@ -3,15 +3,22 @@ module PdfDocuments
private
def generate
- heading1 @params.report.name
+ logo
+ @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
- @params.report.elements.each do |element|
- heading2 element.title
- text element.path
+ 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] }]
+ move_down(5)
rich_text element.description_html
- element.success_criteria.each do |success_criterion|
- text success_criterion.title
+ element.success_criteria.each.with_index(1) do |success_criterion, sc_index|
+ heading3 "#{element_index}.#{sc_index} #{success_criterion.title}"
rich_text success_criterion.description_html
rich_text success_criterion.comment_html
end
diff --git a/app/views/elements/_element.html.erb b/app/views/elements/_element.html.erb
index a667966..b468c09 100644
--- a/app/views/elements/_element.html.erb
+++ b/app/views/elements/_element.html.erb
@@ -1,7 +1,7 @@
<%= turbo_frame_tag dom_id(element, :frame) do %>
-
+
<%= element.title %>
diff --git a/app/views/success_criteria/_header.html.erb b/app/views/success_criteria/_header.html.erb
index e13f5c1..8fa1cae 100644
--- a/app/views/success_criteria/_header.html.erb
+++ b/app/views/success_criteria/_header.html.erb
@@ -1,7 +1,7 @@
<% edit_mode = action_name == "edit" %>