start of iteration 2
This commit is contained in:
parent
9fb87a74ce
commit
729ed13521
75 changed files with 705 additions and 170 deletions
|
|
@ -1,14 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Element < ApplicationRecord
|
||||
attr_accessor :checklist_id
|
||||
has_rich_text :description
|
||||
|
||||
has_rich_text :description_html
|
||||
|
||||
belongs_to :report, touch: true
|
||||
belongs_to :page, touch: true
|
||||
has_many :success_criteria, dependent: :destroy
|
||||
|
||||
validates :path, :title, presence: true
|
||||
delegate :report, to: :page
|
||||
|
||||
# Calculate actual conformity level:
|
||||
# - if a success_criterion has result :failed -> the confirmity_level
|
||||
|
|
|
|||
6
app/models/page.rb
Normal file
6
app/models/page.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class Page < ApplicationRecord
|
||||
belongs_to :report
|
||||
has_many :elements
|
||||
|
||||
has_rich_text :comment
|
||||
end
|
||||
|
|
@ -11,7 +11,7 @@ module PdfDocuments
|
|||
} ], align: :right
|
||||
|
||||
heading1 params.report.name
|
||||
rich_text params.report.comment_html
|
||||
rich_text params.report.comment
|
||||
|
||||
params.report.elements.each.with_index(1) do |element, element_index|
|
||||
heading2 "#{element_index} #{element.title}"
|
||||
|
|
@ -22,7 +22,7 @@ module PdfDocuments
|
|||
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
|
||||
rich_text success_criterion.comment
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Report < ApplicationRecord
|
||||
has_rich_text :comment_html
|
||||
has_many :pages, dependent: :destroy
|
||||
has_many :elements, through: :pages, dependent: :destroy
|
||||
has_rich_text :comment
|
||||
|
||||
has_many :elements, dependent: :destroy
|
||||
|
||||
validates :name, presence: true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,17 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SuccessCriterion < ApplicationRecord
|
||||
belongs_to :element, touch: true
|
||||
belongs_to :check, optional: true
|
||||
|
||||
has_rich_text :test_comment
|
||||
has_rich_text :quick_criterion
|
||||
has_rich_text :quick_fail
|
||||
has_rich_text :quick_fix
|
||||
|
||||
delegate :page, :report, to: :element
|
||||
|
||||
enum :result, %i[passed failed not_applicable]
|
||||
enum :level, %i[A AA AAA]
|
||||
|
||||
has_rich_text :comment_html
|
||||
has_rich_text :description_html
|
||||
|
||||
belongs_to :element, touch: true
|
||||
|
||||
def level_value
|
||||
return nil unless level
|
||||
|
||||
self.class.levels.values.index_of(level)
|
||||
end
|
||||
|
||||
def header
|
||||
"HEADER"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue