A lot :)
This commit is contained in:
parent
aad67af0d1
commit
63fc206c27
153 changed files with 2043 additions and 646 deletions
|
|
@ -1,11 +1,67 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Check < ApplicationRecord
|
||||
include RichTextTargetBlank
|
||||
|
||||
enum :level, %i[A AA AAA]
|
||||
belongs_to :principle
|
||||
|
||||
has_rich_text :success_criterion_html
|
||||
has_and_belongs_to_many :links
|
||||
has_and_belongs_to_many :standards
|
||||
|
||||
scope :search, lambda { |term|
|
||||
joins("INNER JOIN action_text_rich_texts ON action_text_rich_texts.record_id = checks.id AND record_type = 'Check'").where('checks.name LIKE :term OR action_text_rich_texts.body_text LIKE :term', term: "%#{term}%")
|
||||
}
|
||||
accepts_nested_attributes_for :links, allow_destroy: true
|
||||
|
||||
enum :conformity_level, %i[A AA AAA]
|
||||
enum :priority, %i[highest high normal low]
|
||||
|
||||
has_rich_text :conformity_notice_de
|
||||
has_rich_text :conformity_notice_en
|
||||
has_rich_text :quick_criterion_de
|
||||
has_rich_text :quick_criterion_en
|
||||
has_rich_text :quick_fail_de
|
||||
has_rich_text :quick_fail_en
|
||||
has_rich_text :quick_fix_de
|
||||
has_rich_text :quick_fix_en
|
||||
|
||||
has_rich_text :criterion_de
|
||||
has_rich_text :criterion_en
|
||||
has_rich_text :criterion_details_de
|
||||
has_rich_text :criterion_details_en
|
||||
has_rich_text :example_de
|
||||
has_rich_text :example_en
|
||||
has_rich_text :exemption_details_de
|
||||
has_rich_text :exemption_details_en
|
||||
has_rich_text :standard_text_de
|
||||
has_rich_text :standard_text_en
|
||||
|
||||
has_rich_text :test_instructions
|
||||
|
||||
has_rich_text :powerpoint_text_de
|
||||
has_rich_text :powerpoint_text_en
|
||||
|
||||
has_rich_text :comment
|
||||
|
||||
translates_attributes :name,
|
||||
:conformity_notice,
|
||||
:quick_criterion,
|
||||
:quick_fail,
|
||||
:quick_fix,
|
||||
:criterion,
|
||||
:criterion_details,
|
||||
:example,
|
||||
:exemption_details,
|
||||
:standard_text,
|
||||
:powerpoint_text
|
||||
|
||||
scope(:search, lambda do |term|
|
||||
# TODO: Search only fields for current locale.
|
||||
joins("INNER JOIN action_text_rich_texts ON action_text_rich_texts.record_id = checks.id AND record_type = 'Check'").where("checks.name_de LIKE :term OR checks.name_de LIKE :term OR action_text_rich_texts.body LIKE :term", term: "%#{term}%").distinct
|
||||
end)
|
||||
|
||||
def display_target_disabilities
|
||||
%i[visual auditory physical cognitive].select { |d| send(:"#{d}?") }.map { |d| I18n.t("disability.#{d}") }.map(&:first).join(", ")
|
||||
end
|
||||
|
||||
def display_applicabilities
|
||||
%i[applicable_to_app applicable_to_web].select { |a| send(:"#{a}?") }.map { |a| I18n.t("applicability.#{a}") }.map(&:first).join(", ")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue