Finalize check fields
This commit is contained in:
parent
63fc206c27
commit
174cf9f503
12 changed files with 73 additions and 34 deletions
|
|
@ -54,6 +54,6 @@ class LinksController < ApplicationController
|
||||||
|
|
||||||
# Only allow a list of trusted parameters through.
|
# Only allow a list of trusted parameters through.
|
||||||
def link_params
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ module ApplicationHelper
|
||||||
delegate :filter_params, to: :controller
|
delegate :filter_params, to: :controller
|
||||||
|
|
||||||
def multilang_form_field(form, attribute, as: :text_field)
|
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
|
col_width = as == :rich_text_area ? 12 : 12 / I18n.available_locales.count
|
||||||
tag.div(class: "row") do
|
tag.div(class: "row") do
|
||||||
fields = I18n.available_locales.map { _1.to_s.split("-").first }.map do |lang|
|
fields = I18n.available_locales.map { _1.to_s.split("-").first }.map do |lang|
|
||||||
|
|
|
||||||
11
app/models/concerns/filter_scopeable.rb
Normal file
11
app/models/concerns/filter_scopeable.rb
Normal file
|
|
@ -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
|
||||||
|
|
@ -6,7 +6,7 @@ class Link < ApplicationRecord
|
||||||
belongs_to :link_category
|
belongs_to :link_category
|
||||||
has_and_belongs_to_many :checks
|
has_and_belongs_to_many :checks
|
||||||
|
|
||||||
has_rich_text :description_html
|
has_rich_text :description
|
||||||
|
|
||||||
validates :url, :text, presence: true
|
validates :url, :text, presence: true
|
||||||
validate :check_url
|
validate :check_url
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,23 @@
|
||||||
= bootstrap_form_with(model: check, remote: true) do |form|
|
= bootstrap_form_with(model: check, remote: true) do |form|
|
||||||
h2 Details
|
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)
|
= 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
|
h2 Zugänglichkeit
|
||||||
.row
|
.row
|
||||||
.col-md-3
|
- %w[visual auditory physical cognitive].sort_by { |d| t("disability.#{d}") }.each do |d|
|
||||||
= form.check_box :visual, label: t("disability.visual").capitalize
|
.col-md-3
|
||||||
.col-md-3
|
= form.check_box d, label: t("disability.#{d}").capitalize
|
||||||
= 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
|
|
||||||
h2 Anwendbarkeit
|
h2 Anwendbarkeit
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
- %w[applicable_to_web applicable_to_app].sort_by { |d| t("applicability.#{d}") }.each do |d|
|
||||||
= form.check_box :applicable_to_web, label: t("applicability.applicable_to_web").capitalize
|
.col-md-6
|
||||||
.col-md-6
|
= form.check_box d, label: t("applicability.#{d}").capitalize
|
||||||
= form.check_box :applicable_to_app, label: t("applicability.applicable_to_app").capitalize
|
|
||||||
h2 Richtlinie
|
h2 Richtlinie
|
||||||
= form.text_field :external_number
|
= form.text_field :external_number
|
||||||
|
= form.text_field :external_url
|
||||||
= form.select :conformity_level, Check.conformity_levels.keys, include_blank: true
|
= form.select :conformity_level, Check.conformity_levels.keys, include_blank: true
|
||||||
= multilang_form_field(form, :conformity_notice, as: :rich_text_area)
|
= 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, :criterion_details, as: :rich_text_area)
|
||||||
= multilang_form_field(form, :example, 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, :exemption_details, as: :rich_text_area)
|
||||||
= multilang_form_field(form, :standard_text, as: :rich_text_area)
|
|
||||||
|
|
||||||
h2 Intern
|
h2 Intern
|
||||||
= form.rich_text_area :test_instructions
|
= form.rich_text_area :test_instructions
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Description:</strong>
|
<strong>Description:</strong>
|
||||||
<%= link.description_html %>
|
<%= link.description %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<td><%= link_to(link.link_category.name, url_for(link)) %></td>
|
<td><%= link_to(link.link_category.name, url_for(link)) %></td>
|
||||||
<td><%= link_to(truncate(link.url), link.url, target: "_blank", rel: "nofollow") %></td>
|
<td><%= link_to(truncate(link.url), link.url, target: "_blank", rel: "nofollow") %></td>
|
||||||
<td><%= link_to(link.text, url_for(link)) %></td>
|
<td><%= link_to(link.text, url_for(link)) %></td>
|
||||||
<td><%= link_to(truncate(link.description_html.to_plain_text), url_for(link)) %></td>
|
<td><%= link_to(truncate(link.description.to_plain_text), url_for(link)) %></td>
|
||||||
<td><%= link.last_check_at && l(link.last_check_at, format: :short) %></td>
|
<td><%= link.last_check_at && l(link.last_check_at, format: :short) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ de-CH:
|
||||||
external_number: WCAG Nummer
|
external_number: WCAG Nummer
|
||||||
conformity_level: Konformitätsstufe
|
conformity_level: Konformitätsstufe
|
||||||
position: Position
|
position: Position
|
||||||
conformity_notice_de: Konformitätserklärung (de)
|
conformity_notice_de: Anmerkungen zur Konformität (de)
|
||||||
conformity_notice_en: Konformitätserklärung (eng)
|
conformity_notice_en: Anmerkungen zur Konformität (eng)
|
||||||
standard_ids: Standards
|
standard_ids: Standards
|
||||||
name_de: Name (de)
|
name_de: Name (de)
|
||||||
name_en: Name (eng)
|
name_en: Name (eng)
|
||||||
|
|
@ -45,6 +45,7 @@ de-CH:
|
||||||
comment: Kommentar
|
comment: Kommentar
|
||||||
target_disability: Zugänglichkeit
|
target_disability: Zugänglichkeit
|
||||||
applicability: Anwendbarkeit
|
applicability: Anwendbarkeit
|
||||||
|
external_url: WCAG Link
|
||||||
checklist:
|
checklist:
|
||||||
id: ID
|
id: ID
|
||||||
name: Überschrift
|
name: Überschrift
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ de-CH:
|
||||||
applicable_to_app: app
|
applicable_to_app: app
|
||||||
applicable_to_web: web
|
applicable_to_web: web
|
||||||
priority:
|
priority:
|
||||||
highest: "Sehr hoch"
|
highest: "A (hoch)"
|
||||||
high: "Hoch"
|
high: "B (mittel)"
|
||||||
medium: "Mittel"
|
normal: "C (niedrig)"
|
||||||
low: "Niedrig"
|
low: "D (nice to have)"
|
||||||
|
|
@ -17,10 +17,12 @@ class FinalizeCheckFields < ActiveRecord::Migration[7.2]
|
||||||
add_reference :checks, :principle, foreign_key: true
|
add_reference :checks, :principle, foreign_key: true
|
||||||
|
|
||||||
add_column :checks, :external_number, :string, null: true
|
add_column :checks, :external_number, :string, null: true
|
||||||
add_column :checks, :conformity_level, :integer, null: false, default: 0
|
add_column :checks, :conformity_level, :integer, null: true
|
||||||
add_column :checks, :priority, :integer, null: false, default: 0
|
add_column :checks, :priority, :integer, null: true
|
||||||
|
|
||||||
add_column :checks, :manual_test, :boolean, null: false, default: true
|
add_column :checks, :manual_test, :boolean, null: false, default: true
|
||||||
add_column :checks, :test_url, :string, null: true
|
add_column :checks, :test_url, :string, null: true
|
||||||
|
|
||||||
|
add_column :checks, :external_url, :string, null: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
8
db/schema.rb
generated
8
db/schema.rb
generated
|
|
@ -73,9 +73,6 @@ ActiveRecord::Schema[7.2].define(version: 2024_08_30_134641) do
|
||||||
t.integer "level"
|
t.integer "level"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_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.integer "number"
|
||||||
t.string "name_de"
|
t.string "name_de"
|
||||||
t.string "name_en"
|
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.boolean "applicable_to_app", default: false, null: false
|
||||||
t.integer "principle_id"
|
t.integer "principle_id"
|
||||||
t.string "external_number"
|
t.string "external_number"
|
||||||
t.integer "conformity_level", default: 0, null: false
|
t.integer "conformity_level"
|
||||||
t.integer "priority", default: 0, null: false
|
t.integer "priority"
|
||||||
t.boolean "manual_test", default: true, null: false
|
t.boolean "manual_test", default: true, null: false
|
||||||
t.string "test_url"
|
t.string "test_url"
|
||||||
|
t.string "external_url"
|
||||||
t.index ["number"], name: "index_checks_on_number", unique: true
|
t.index ["number"], name: "index_checks_on_number", unique: true
|
||||||
t.index ["principle_id"], name: "index_checks_on_principle_id"
|
t.index ["principle_id"], name: "index_checks_on_principle_id"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
32
db/seeds.rb
32
db/seeds.rb
|
|
@ -14,8 +14,38 @@ Standard.create!(name_de: "EN 301 549",
|
||||||
version: "V3",
|
version: "V3",
|
||||||
url_de: "https://www.etsi.org/deliver/etsi_en/301500_301599/301549/03.02.01_60/en_301549v030201p.pdf",
|
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")
|
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: "Wahrnehmbar", name_en: "Perceivable")
|
||||||
Principle.create!(name_de: "Bedienbar", name_en: "Operable")
|
Principle.create!(name_de: "Bedienbar", name_en: "Operable")
|
||||||
Principle.create!(name_de: "Verständlich", name_en: "Understandable")
|
Principle.create!(name_de: "Verständlich", name_en: "Understandable")
|
||||||
Principle.create!(name_de: "Robust", name_en: "Robust")
|
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"))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue