diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index 20f1c7d..05f502c 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -54,6 +54,6 @@ class LinksController < ApplicationController # Only allow a list of trusted parameters through. def link_params - params.require(:link).permit(:url, :text, :description_html, :last_check_at, :fail_count, :link_category_id) + params.require(:link).permit(:url, :text, :description, :link_category_id) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 70edee3..7ebfbf9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6,6 +6,8 @@ module ApplicationHelper delegate :filter_params, to: :controller def multilang_form_field(form, attribute, as: :text_field) + return form.send(as, "#{attribute}_de") + col_width = as == :rich_text_area ? 12 : 12 / I18n.available_locales.count tag.div(class: "row") do fields = I18n.available_locales.map { _1.to_s.split("-").first }.map do |lang| diff --git a/app/models/concerns/filter_scopeable.rb b/app/models/concerns/filter_scopeable.rb new file mode 100644 index 0000000..564a1e0 --- /dev/null +++ b/app/models/concerns/filter_scopeable.rb @@ -0,0 +1,11 @@ +module FilterScopeable + extend ActiveSupport::Concern + + def filter_scope(name, block) + define_method(name) do |filter_value| + return self if filter_value.blank? + + instance_exec(filter_value, &block) + end + end +en \ No newline at end of file diff --git a/app/models/link.rb b/app/models/link.rb index 067e159..98e7e25 100644 --- a/app/models/link.rb +++ b/app/models/link.rb @@ -6,7 +6,7 @@ class Link < ApplicationRecord belongs_to :link_category has_and_belongs_to_many :checks - has_rich_text :description_html + has_rich_text :description validates :url, :text, presence: true validate :check_url diff --git a/app/views/checks/_form.html.slim b/app/views/checks/_form.html.slim index 72933a1..64cb873 100644 --- a/app/views/checks/_form.html.slim +++ b/app/views/checks/_form.html.slim @@ -1,27 +1,23 @@ = bootstrap_form_with(model: check, remote: true) do |form| h2 Details - = form.collection_select :principle_id, Principle.all.sort_by(&:t_name), :id, :t_name - = form.text_field :number = multilang_form_field(form, :name) - = form.collection_check_boxes :standard_ids, Standard.all.sort_by(&:t_name), :id, :t_name, include_blank: true + = form.text_field :number + .row + = form.collection_radio_buttons(:principle_id, Principle.all.sort_by(&:t_name), :id, :t_name) { |b| b.label(class: "col-md-2") { b.radio_button + b.text } } + = form.collection_check_boxes :standard_ids, Standard.all.sort_by{ _1.t_name.downcase }, :id, :t_name, include_blank: true h2 Zugänglichkeit .row - .col-md-3 - = form.check_box :visual, label: t("disability.visual").capitalize - .col-md-3 - = form.check_box :auditory, label: t("disability.auditory").capitalize - .col-md-3 - = form.check_box :physical, label: t("disability.physical").capitalize - .col-md-3 - = form.check_box :cognitive, label: t("disability.cognitive").capitalize + - %w[visual auditory physical cognitive].sort_by { |d| t("disability.#{d}") }.each do |d| + .col-md-3 + = form.check_box d, label: t("disability.#{d}").capitalize h2 Anwendbarkeit .row - .col-md-6 - = form.check_box :applicable_to_web, label: t("applicability.applicable_to_web").capitalize - .col-md-6 - = form.check_box :applicable_to_app, label: t("applicability.applicable_to_app").capitalize + - %w[applicable_to_web applicable_to_app].sort_by { |d| t("applicability.#{d}") }.each do |d| + .col-md-6 + = form.check_box d, label: t("applicability.#{d}").capitalize h2 Richtlinie = form.text_field :external_number + = form.text_field :external_url = form.select :conformity_level, Check.conformity_levels.keys, include_blank: true = multilang_form_field(form, :conformity_notice, as: :rich_text_area) @@ -36,7 +32,6 @@ = multilang_form_field(form, :criterion_details, as: :rich_text_area) = multilang_form_field(form, :example, as: :rich_text_area) = multilang_form_field(form, :exemption_details, as: :rich_text_area) - = multilang_form_field(form, :standard_text, as: :rich_text_area) h2 Intern = form.rich_text_area :test_instructions diff --git a/app/views/links/_link.html.erb b/app/views/links/_link.html.erb index ffdb788..7208183 100644 --- a/app/views/links/_link.html.erb +++ b/app/views/links/_link.html.erb @@ -11,7 +11,7 @@

Description: - <%= link.description_html %> + <%= link.description %>

diff --git a/app/views/links/index.html.erb b/app/views/links/index.html.erb index d88f4ab..ecca5d6 100644 --- a/app/views/links/index.html.erb +++ b/app/views/links/index.html.erb @@ -18,7 +18,7 @@ <%= link_to(link.link_category.name, url_for(link)) %> <%= link_to(truncate(link.url), link.url, target: "_blank", rel: "nofollow") %> <%= link_to(link.text, url_for(link)) %> - <%= link_to(truncate(link.description_html.to_plain_text), url_for(link)) %> + <%= link_to(truncate(link.description.to_plain_text), url_for(link)) %> <%= link.last_check_at && l(link.last_check_at, format: :short) %> <% end %> diff --git a/config/locales/activerecord.yml b/config/locales/activerecord.yml index 894aeb0..73019bf 100644 --- a/config/locales/activerecord.yml +++ b/config/locales/activerecord.yml @@ -16,8 +16,8 @@ de-CH: external_number: WCAG Nummer conformity_level: Konformitätsstufe position: Position - conformity_notice_de: Konformitätserklärung (de) - conformity_notice_en: Konformitätserklärung (eng) + conformity_notice_de: Anmerkungen zur Konformität (de) + conformity_notice_en: Anmerkungen zur Konformität (eng) standard_ids: Standards name_de: Name (de) name_en: Name (eng) @@ -45,6 +45,7 @@ de-CH: comment: Kommentar target_disability: Zugänglichkeit applicability: Anwendbarkeit + external_url: WCAG Link checklist: id: ID name: Überschrift diff --git a/config/locales/i11yist.yml b/config/locales/i11yist.yml index a83f572..a4c851d 100644 --- a/config/locales/i11yist.yml +++ b/config/locales/i11yist.yml @@ -54,7 +54,7 @@ de-CH: applicable_to_app: app applicable_to_web: web priority: - highest: "Sehr hoch" - high: "Hoch" - medium: "Mittel" - low: "Niedrig" \ No newline at end of file + highest: "A (hoch)" + high: "B (mittel)" + normal: "C (niedrig)" + low: "D (nice to have)" \ No newline at end of file diff --git a/db/migrate/20240820164827_finalize_check_fields.rb b/db/migrate/20240820164827_finalize_check_fields.rb index ceb0e27..488070e 100644 --- a/db/migrate/20240820164827_finalize_check_fields.rb +++ b/db/migrate/20240820164827_finalize_check_fields.rb @@ -17,10 +17,12 @@ class FinalizeCheckFields < ActiveRecord::Migration[7.2] add_reference :checks, :principle, foreign_key: true add_column :checks, :external_number, :string, null: true - add_column :checks, :conformity_level, :integer, null: false, default: 0 - add_column :checks, :priority, :integer, null: false, default: 0 + add_column :checks, :conformity_level, :integer, null: true + add_column :checks, :priority, :integer, null: true add_column :checks, :manual_test, :boolean, null: false, default: true add_column :checks, :test_url, :string, null: true + + add_column :checks, :external_url, :string, null: true end end diff --git a/db/schema.rb b/db/schema.rb index 7b21686..9f5849c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -73,9 +73,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_08_30_134641) do t.integer "level" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.boolean "applicability_web", default: false, null: false - t.boolean "applicability_app", default: false, null: false - t.string "exernal_number" t.integer "number" t.string "name_de" t.string "name_en" @@ -87,10 +84,11 @@ ActiveRecord::Schema[7.2].define(version: 2024_08_30_134641) do t.boolean "applicable_to_app", default: false, null: false t.integer "principle_id" t.string "external_number" - t.integer "conformity_level", default: 0, null: false - t.integer "priority", default: 0, null: false + t.integer "conformity_level" + t.integer "priority" t.boolean "manual_test", default: true, null: false t.string "test_url" + t.string "external_url" t.index ["number"], name: "index_checks_on_number", unique: true t.index ["principle_id"], name: "index_checks_on_principle_id" end diff --git a/db/seeds.rb b/db/seeds.rb index 38c0424..6c5e763 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -14,8 +14,38 @@ Standard.create!(name_de: "EN 301 549", version: "V3", url_de: "https://www.etsi.org/deliver/etsi_en/301500_301599/301549/03.02.01_60/en_301549v030201p.pdf", url_en: "https://www.etsi.org/deliver/etsi_en/301500_301599/301549/03.02.01_60/en_301549v030201p.pdf") +Standard.create!(name_de: "EPUB AT", + name_en: "EPUB AT", + version: "3.3", + url_de: "https://www.w3.org/TR/epub-33/", + url_en: "https://www.w3.org/TR/epub-33/") +Standard.create!(name_de: "Goran", + name_en: "Goran", + version: "1.0", + url_de: "", + url_en: "") Principle.create!(name_de: "Wahrnehmbar", name_en: "Perceivable") Principle.create!(name_de: "Bedienbar", name_en: "Operable") Principle.create!(name_de: "Verständlich", name_en: "Understandable") -Principle.create!(name_de: "Robust", name_en: "Robust") \ No newline at end of file +Principle.create!(name_de: "Robust", name_en: "Robust") +Principle.create!(name_de: "Sonstige", name_en: "Other") + +LinkCategory.create!(name: "Tools") +LinkCategory.create!(name: "Beispiele") +LinkCategory.create!(name: "Artikel") + +Link.create!(url: "https://a11y.digitaldialog.swiss/de/checklist", + link_category: LinkCategory.find_by(name: "Tools"), + text: "Accessibility Checkliste", + description: "Diese praxisorientierte Checkliste unterstützt Sie dabei, den Zustand Ihres digitalen Angebots hinsichtlich der Barrierefreiheit zu beurteilen. Zielgruppe der Accessibility-Checkliste sind Design-, Entwicklungs- und Content-Teams ebenso wie Qualitätssicherungsverantwortliche und Projektleitende.") + +Link.create!(url: "https://www.a11yproject.com/", + text: "The A11Y Project", + description: "The A11Y Project is a community-driven effort to make digital accessibility easier.", + link_category: LinkCategory.find_by(name: "Beispiele")) + +Link.create!(url: "https://www.a11yproject.com/", + text: "The A11Y Project", + description: "The A11Y Project is a community-driven effort to make digital accessibility easier.", + link_category: LinkCategory.find_by(name: "Artikel")) \ No newline at end of file