wip: wcag structure
Some checks failed
/ Run tests (push) Successful in 7m57s
/ Run system tests (push) Failing after 4m18s
/ Build, push and deploy image (push) Failing after 59s

This commit is contained in:
david 2025-05-16 19:02:33 +02:00
parent 4c31dbbed0
commit 4dd445be57
48 changed files with 461 additions and 137 deletions

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
class Check < ApplicationRecord
belongs_to :principle
belongs_to :guideline
has_and_belongs_to_many :links
has_and_belongs_to_many :standards
@ -51,9 +51,9 @@ class Check < ApplicationRecord
:standard_text,
:powerpoint_text
validates :number, uniqueness: true, presence: true
validates :number, uniqueness: { scope: :guideline_id }, presence: true
before_validation { self.number = self.class.maximum(:id).to_i + 1 unless self.number.present? }
# before_validation { self.number = self.class.maximum(:id).to_i + 1 unless self.number.present? }
scope(:search, lambda { |terms|
# TODO: Search only fields for current locale.
@ -129,4 +129,20 @@ class Check < ApplicationRecord
def external_number
[ external_number_1, external_number_2, external_number_3 ].compact_blank.join(".")
end
def external_number
[
guideline.principle.id,
guideline.number,
number
].compact.join(".")
end
def full_number
external_number
end
def to_s
display_label
end
end

18
app/models/guideline.rb Normal file
View file

@ -0,0 +1,18 @@
class Guideline < ApplicationRecord
belongs_to :principle
has_many :checks
has_rich_text :description_de
has_rich_text :description_en
translates_attributes :name, :description
def to_s
"#{full_number} #{t_name}"
end
def full_number
[ principle.id, number ].join(".")
end
end

View file

@ -21,4 +21,8 @@ class Report < ApplicationRecord
success_criteria: export_success_criteria
}
end
def test
139
end
end