Added projects
Some checks failed
/ Run tests (push) Failing after 2m3s
/ Run system tests (push) Failing after 2m17s
/ Build, push and deploy image (push) Has been skipped

This commit is contained in:
david 2024-11-24 22:08:36 +01:00
parent 0964187f22
commit 8b4ffb83ec
37 changed files with 470 additions and 1935 deletions

View file

@ -13,13 +13,13 @@ module PdfDocuments
move_down 20
@prawn_document.text "#{I18n.l params.report.updated_at.to_date, format: :long}"
move_down 40
safe_display(params.report.comment) do
safe_display(params.report.comment) do
rich_text _1
move_down 30
end
@prawn_document.font_size(8) do
@prawn_document.draw_text("Dokument erstellt am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')}", at: [0, 0])
@prawn_document.draw_text("Dokument erstellt am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')}", at: [ 0, 0 ])
end
@prawn_document.start_new_page
@pages = {}
@ -29,9 +29,9 @@ module PdfDocuments
without_page_break do
heading2 "#{element_index} #{element.title}"
@prawn_document.text("<b>Pfad:</b> #{element.page.path}", inline_format: true)
safe_display(element.screenshot) do
image(_1.variant(:thumbnail), height: 160)
move_down(15)
safe_display(element.screenshot) do
image(_1.variant(:thumbnail), height: 160)
move_down(15)
end
end
rich_text element.description
@ -45,10 +45,10 @@ module PdfDocuments
@prawn_document.start_new_page
heading1("Anhang: Richtlinien")
params.report.export[:success_criteria].group_by(&:check).sort_by{ |c, _scs| c.external_number }.each do |check, criteria|
params.report.export[:success_criteria].group_by(&:check).sort_by { |c, _scs| c.external_number }.each do |check, criteria|
heading2(check.display_label)
@pages[check] = @prawn_document.page_number
{
{
external_number: { label: "WCAG Nummer" },
external_url: { label: "WCAG Link" },
conformity_level: { label: "Konformität" },
@ -61,12 +61,12 @@ module PdfDocuments
annotation_de: { label: "Anmerkung", rich: true }
}.each do |attribute, options|
v = check.send(attribute)
safe_display(v) do
safe_display(v) do
text("<b>#{options[:label]}</b>", inline_format: true)
if options[:rich]
rich_text(_1)
else
text(_1)
else
text(_1)
end
end
end
@ -79,7 +79,7 @@ module PdfDocuments
rich_text(%Q(
<span>#{cat.name}</span>
<ul>
#{links.map{ "<li><a href='#{_1.url}'>#{_1.text}</a></li>" }.join() }
#{links.map { "<li><a href='#{_1.url}'>#{_1.text}</a></li>" }.join() }
</ul>
))
end
@ -101,10 +101,10 @@ module PdfDocuments
@prawn_document.repeat(2..) do
@prawn_document.text_box "<b>#{params.report.name}</b>", at: [ 50, 777 ], inline_format: true, width: 300
@prawn_document.bounding_box([0, 766], width: 532) do
@prawn_document.bounding_box([ 0, 766 ], width: 532) do
hr
end
@prawn_document.bounding_box([0, 796], width: 200, height: 200) do
@prawn_document.bounding_box([ 0, 796 ], width: 200, height: 200) do
logo
end
end
@ -120,7 +120,7 @@ module PdfDocuments
end
end
section("Anhang: Richtlinien") do
x.report.export[:success_criteria].group_by(&:check).sort_by{ |c, _scs| c.external_number }.each do |check, _criteria|
x.report.export[:success_criteria].group_by(&:check).sort_by { |c, _scs| c.external_number }.each do |check, _criteria|
page(title: check.display_label, destination: p[check])
end
end

7
app/models/project.rb Normal file
View file

@ -0,0 +1,7 @@
class Project < ApplicationRecord
has_many :reports, dependent: :restrict_with_error
has_rich_text :details
scope :current, -> { where("updated_at > ?", 1.month.ago) }
end

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class Report < ApplicationRecord
belongs_to :project, touch: true
has_many :pages, -> { order(:position) }, dependent: :destroy
has_many :elements, through: :pages, dependent: :destroy
has_many :success_criteria, through: :elements, dependent: :destroy