wip: wcag structure
This commit is contained in:
parent
4c31dbbed0
commit
4dd445be57
48 changed files with 461 additions and 137 deletions
|
|
@ -25,10 +25,6 @@ class ApplicationController < ActionController::Base
|
|||
label: Project.model_name.human(count: 2),
|
||||
icon: :'folder',
|
||||
path: :projects },
|
||||
# {
|
||||
# label: Report.model_name.human(count: 2),
|
||||
# icon: :'journal-text',
|
||||
# path: :reports },
|
||||
{
|
||||
label: I18n.t("backoffice"),
|
||||
icon: :gear,
|
||||
|
|
@ -36,7 +32,8 @@ class ApplicationController < ActionController::Base
|
|||
active: %w[backoffice checklists checks links link_categories].include?(controller_name) },
|
||||
{
|
||||
label: "Konto",
|
||||
path: profile_path
|
||||
path: profile_path,
|
||||
icon: "person-circle"
|
||||
}
|
||||
]
|
||||
else
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class ChecksController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def check_params
|
||||
params.require(:check).permit(:principle_id,
|
||||
params.require(:check).permit(:guideline_id,
|
||||
:number,
|
||||
:name_de,
|
||||
:name_en,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module BackofficeMenu
|
|||
[
|
||||
{ label: "Einstellungen", icon: :sliders, path: :backoffice },
|
||||
{ label: Checklist.model_name.human(count: 2), icon: :'list-check', path: :checklists },
|
||||
{ label: Guideline.model_name.human(count: 2), icon: :'rulers', path: :guidelines },
|
||||
{ label: Check.model_name.human(count: 2), icon: :check2, path: :checks },
|
||||
{ label: Link.model_name.human(count: 2), icon: :link, path: :links },
|
||||
{ label: LinkCategory.model_name.human(count: 2), icon: :folder, path: :link_categories } ]
|
||||
|
|
|
|||
58
app/controllers/guidelines_controller.rb
Normal file
58
app/controllers/guidelines_controller.rb
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
class GuidelinesController < BackofficeController
|
||||
before_action :set_guideline, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /guidelines
|
||||
def index
|
||||
@guidelines = Guideline.all
|
||||
end
|
||||
|
||||
# GET /guidelines/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /guidelines/new
|
||||
def new
|
||||
@guideline = Guideline.new
|
||||
end
|
||||
|
||||
# GET /guidelines/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /guidelines
|
||||
def create
|
||||
@guideline = Guideline.new(guideline_params)
|
||||
|
||||
if @guideline.save
|
||||
redirect_to @guideline, notice: "Guideline was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /guidelines/1
|
||||
def update
|
||||
if @guideline.update(guideline_params)
|
||||
redirect_to @guideline, notice: "Guideline was successfully updated.", status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /guidelines/1
|
||||
def destroy
|
||||
@guideline.destroy!
|
||||
redirect_to guidelines_url, notice: "Guideline was successfully destroyed.", status: :see_other
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_guideline
|
||||
@guideline = Guideline.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def guideline_params
|
||||
params.require(:guideline).permit(:principle_id, :number, :name_de, :name_en, :description_de, :description_en)
|
||||
end
|
||||
end
|
||||
|
|
@ -4,7 +4,11 @@ import * as bootstrap from "bootstrap"
|
|||
// Connects to data-controller="toast"
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(this.element)
|
||||
toastBootstrap.show()
|
||||
const shownKey = `toastsShown[${this.element.getAttribute("data-ts")}]`
|
||||
if(!window.sessionStorage.getItem(shownKey)) {
|
||||
window.sessionStorage.setItem(shownKey, Date.now());
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(this.element)
|
||||
toastBootstrap.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
18
app/models/guideline.rb
Normal 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
|
||||
|
|
@ -21,4 +21,8 @@ class Report < ApplicationRecord
|
|||
success_criteria: export_success_criteria
|
||||
}
|
||||
end
|
||||
|
||||
def test
|
||||
139
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@
|
|||
<%= link_to Checklist.model_name.human(count: Checklist.count), :checklists %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<i class="bi bi-rulers"></i>
|
||||
<%= Guideline.count %>
|
||||
<%= link_to Guideline.model_name.human(count: Guideline.count), :guidelines %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<i class="bi bi-check2"></i>
|
||||
<%= Check.count %>
|
||||
|
|
@ -27,4 +33,4 @@
|
|||
<li>
|
||||
<%= link_to "ZIP Backup herunterladen", admin_backup_url(format: :zip), class: " ", data: { turbo_prefetch: false, frame: "_top", turbo: false } %>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ div id=dom_id(check)
|
|||
th = Check.human_attribute_name(:number)
|
||||
td = check.number
|
||||
tr
|
||||
th = Principle.model_name.human
|
||||
td = check.principle&.t_name
|
||||
th = Guideline.model_name.human
|
||||
td = check.guideline&.name_en
|
||||
tr
|
||||
th = Standard.model_name.human(count: check.standard_ids.size)
|
||||
td = check.standards.map(&:t_name).sort_by(&:downcase).join(", ")
|
||||
|
|
@ -80,4 +80,4 @@ div id=dom_id(check)
|
|||
ul
|
||||
- check.links.select{ _1.link_category == category }.map { |link| link_to link.text, link.url, target: :_blank }.each do |link|
|
||||
li = link
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
= bootstrap_form_with(model: check, remote: true, data: { controller: "unsaved-changes" }) do |form|
|
||||
h2 Details
|
||||
= multilang_form_field(form, :name)
|
||||
= form.text_field :number, required: false
|
||||
.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_radio_buttons(:guideline_id, Guideline.all.sort_by(&:full_number), :id, :to_s) { |b| b.label(class: "col-md-2") { b.radio_button + b.text } }
|
||||
= form.text_field :number, required: false
|
||||
= form.collection_check_boxes :standard_ids, Standard.all.sort_by{ _1.t_name.downcase }, :id, :t_name, include_blank: true
|
||||
|
||||
h2 Einschränkung/Zugänglichkeit
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@
|
|||
- if element.persisted?
|
||||
= safe_display(element.screenshot) { tag.div(link_to(_1.filename.to_s, _1), class: "mb-3") }
|
||||
= form.submit class: "btn btn-primary"
|
||||
= link_to("Abbrechen", element.persisted? ? element : element.report, class: "btn btn-outline-secondary")
|
||||
- unless modal?
|
||||
= link_to("Abbrechen", element.persisted? ? element : element.report, class: "btn btn-outline-secondary")
|
||||
|
|
|
|||
|
|
@ -1,26 +1,3 @@
|
|||
/nav
|
||||
= link_to(@report.name, "##{dom_id(@report)}")
|
||||
ul
|
||||
li = link_to("Inhaltsverzeichnis", "#toc")
|
||||
li
|
||||
= link_to('Testbericht')
|
||||
ul
|
||||
- @report.pages.select { |p| p.elements.any? { |e| e.success_criteria.any?(&:failed?) } }.each do |page|
|
||||
li
|
||||
= link_to("#{page.position} #{page.path}", "##{dom_id(page)}")
|
||||
ul
|
||||
- page.elements.select { |e| e.success_criteria.any?(&:failed?) }.each do |element|
|
||||
li
|
||||
= link_to("#{element.number} #{element.title}")
|
||||
ul
|
||||
- element.success_criteria.select(&:failed?).each do |sc|
|
||||
li = link_to("#{sc.number} #{sc.title}", "##{dom_id(sc)}")
|
||||
li
|
||||
= link_to("Anhang")
|
||||
ul
|
||||
- @failed_success_criteria.group_by(&:check).each do |check, scs|
|
||||
li = link_to(check.display_label)
|
||||
|
||||
h1.title id=dom_id(@report) = @report.name
|
||||
|
||||
h2 1 Einschätzung
|
||||
|
|
@ -42,18 +19,18 @@ h2 2 Protokoll
|
|||
- current_page_pos += 1
|
||||
- current_element_pos = 0
|
||||
h3 = "2.#{current_page_pos} #{page.path}"
|
||||
p
|
||||
strong URL
|
||||
= page.url
|
||||
- page.elements.select { |e| e.success_criteria.any? { _1.failed? } }.each do |element|
|
||||
- current_element_pos += 1
|
||||
- current_abs_element_pos += 1
|
||||
- current_sc_pos = 0
|
||||
h4 = "2.#{current_page_pos}.#{current_element_pos} #{element.title}"
|
||||
/h3 = "2.#{current_abs_element_pos} #{element.title}"
|
||||
p
|
||||
strong Pfad:
|
||||
span =< page.path
|
||||
= safe_display(element.screenshot) { image_tag(_1.representation(resize_to_fit: [250, 250]))}
|
||||
= element.description
|
||||
- element.success_criteria.select{ _1.failed? }.each do |sc|
|
||||
- element.success_criteria.select(&:failed?).each do |sc|
|
||||
- current_sc_pos += 1
|
||||
/h4
|
||||
= "2.#{current_abs_element_pos}.#{current_sc_pos} #{sc.title}"
|
||||
|
|
|
|||
7
app/views/guidelines/_form.html.erb
Normal file
7
app/views/guidelines/_form.html.erb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<%= bootstrap_form_with(model: guideline) do |form| %>
|
||||
<%= form.collection_select :principle_id, Principle.all.sort_by(&:id), :id, :t_name %>
|
||||
<%= form.number_field :number %>
|
||||
<%= form.text_field :name_de %>
|
||||
<%= form.rich_text_area :description_de %>
|
||||
<%= form.submit %>
|
||||
<% end %>
|
||||
15
app/views/guidelines/_guideline.html.erb
Normal file
15
app/views/guidelines/_guideline.html.erb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<div id="<%= dom_id guideline %>">
|
||||
<p>
|
||||
<strong>Principle:</strong>
|
||||
<%= guideline.principle.t_name %>
|
||||
</p>
|
||||
|
||||
<%= guideline.description_de %>
|
||||
<h2 class="mt-4">Richtlinien</h2>
|
||||
<% guideline.checks.each do |check| %>
|
||||
<section class="pt-3">
|
||||
<h3 class="fs-5"><%= link_to check %></h3>
|
||||
<%= check.t_criterion %>
|
||||
</section>
|
||||
<% end %>
|
||||
</div>
|
||||
2
app/views/guidelines/_guideline.json.jbuilder
Normal file
2
app/views/guidelines/_guideline.json.jbuilder
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
json.extract! guideline, :id, :principle_id, :number, :name_de, :created_at, :updated_at
|
||||
json.url guideline_url(guideline, format: :json)
|
||||
8
app/views/guidelines/edit.html.erb
Normal file
8
app/views/guidelines/edit.html.erb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<h1><%= t("scaffold.pagetitle_edit", model: Guideline.model_name.human) %></h1>
|
||||
|
||||
<%= render "form", guideline: @guideline %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_show", model: Guideline.model_name.human), @guideline %>
|
||||
<%= link_to t("scaffold.link_index", model: Guideline.model_name.human(count: 2)), guidelines_path %>
|
||||
</div>
|
||||
28
app/views/guidelines/index.html.erb
Normal file
28
app/views/guidelines/index.html.erb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<h1><%= t("scaffold.pagetitle_index", model: Guideline.model_name.human(count: 2)) %></h1>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th><%= Guideline.human_attribute_name(:name_de) %></th>
|
||||
|
||||
<th><%= Guideline.human_attribute_name(:description_de) %></th>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @guidelines.each do |guideline| %>
|
||||
<tr>
|
||||
|
||||
|
||||
|
||||
<td><%= link_to(guideline, url_for(guideline)) %></td>
|
||||
<td><%= link_to(guideline.description_de, url_for(guideline)) %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_new", model: Guideline.model_name.human), new_guideline_path %>
|
||||
</div>
|
||||
1
app/views/guidelines/index.json.jbuilder
Normal file
1
app/views/guidelines/index.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.array! @guidelines, partial: "guidelines/guideline", as: :guideline
|
||||
7
app/views/guidelines/new.html.erb
Normal file
7
app/views/guidelines/new.html.erb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<h1><%= t("scaffold.pagetitle_new", model: Guideline.model_name.human) %></h1>
|
||||
|
||||
<%= render "form", guideline: @guideline %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_index", model: Guideline.model_name.human(count: 2)), guidelines_path %>
|
||||
</div>
|
||||
9
app/views/guidelines/show.html.erb
Normal file
9
app/views/guidelines/show.html.erb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<h1><%= @guideline %></h1>
|
||||
|
||||
<%= render @guideline %>
|
||||
|
||||
<div class="action-row">
|
||||
<%= link_to t("scaffold.link_edit", model: @guideline.model_name.human), edit_guideline_path(@guideline) %>
|
||||
<%= link_to t("scaffold.link_index", model: @guideline.model_name.human(count: 2)), guidelines_path %>
|
||||
<%= button_to t("scaffold.link_destroy", model: @guideline.model_name.human), @guideline, method: :delete, class: "btn btn-outline-danger" %>
|
||||
</div>
|
||||
1
app/views/guidelines/show.json.jbuilder
Normal file
1
app/views/guidelines/show.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.partial! "guidelines/guideline", guideline: @guideline
|
||||
|
|
@ -19,6 +19,12 @@ h1 Dashboard
|
|||
li = link_to(r.name, r)
|
||||
|
||||
.col-md-6
|
||||
h2 Browser Erweiterungen
|
||||
p = link_to "Language Tools KI Korrektur", "https://languagetool.org/services#browsers"
|
||||
p = link_to "DeepL Firefox Extension", "https://www.deepl.com/en/firefox-extension"
|
||||
p = link_to "DeepL Chrome Extension", "https://www.deepl.com/en/chrome-extension"
|
||||
p = link_to "DeepL Edge Extension", "https://www.deepl.com/en/edge-extension"
|
||||
|
||||
h2 Hotkeys
|
||||
p Auf der Bericht-Ausfüllen Seite können folgende Shortcuts verwendet werden:
|
||||
dl
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.toast class="#{alert ? "text-bg-danger" : "text-bg-info"}" role="alert" aria-live="assertive" aria-atomic="true" data={ controller: "toast" }
|
||||
.toast class="#{alert ? "text-bg-danger" : "text-bg-info"}" role="alert" aria-live="assertive" aria-atomic="true" data={ controller: "toast", ts: Time.now.to_f }
|
||||
.toast-header
|
||||
/img src="..." class="rounded me-2" alt="...">
|
||||
/strong.me-auto = heading
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
doctype html
|
||||
html data-bs-theme="#{cookies[:"modeTheme"] || "light"}" data-controller="set-theme"
|
||||
html lang=:de data-bs-theme="#{cookies[:"modeTheme"] || "light"}" data-controller="set-theme"
|
||||
head
|
||||
title a11ydive
|
||||
meta[name="viewport" content="width=device-width,initial-scale=1"]
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
= form.text_field :path
|
||||
= form.text_field :url
|
||||
= form.submit
|
||||
= link_to("Abbrechen", report_path(@page.report), class: "btn btn-outline-secondary")
|
||||
- unless modal?
|
||||
= link_to("Abbrechen", report_path(@page.report), class: "btn btn-outline-secondary")
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
= form.rich_text_area :test_comment
|
||||
= form.submit class: "btn btn-primary"
|
||||
- unless modal?
|
||||
p Not MODAL
|
||||
=< link_to "Abbrechen", success_criterion.persisted? ? success_criterion : success_criterion.element, class: "btn btn-outline-secondary"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue