Some UX improvements

This commit is contained in:
David Schärer 2024-07-19 02:29:18 +02:00
parent 48c0067076
commit 8c81237501
81 changed files with 791 additions and 151 deletions

View file

@ -0,0 +1,14 @@
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
<% if blob.representable? %>
<%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
<% end %>
<figcaption class="attachment__caption">
<% if caption = blob.try(:caption) %>
<%= caption %>
<% else %>
<span class="attachment__name"><%= blob.filename %></span>
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
<% end %>
</figcaption>
</figure>

View file

@ -0,0 +1,8 @@
<div id="<%= dom_id checklist_entry %>">
<p>
<%= button_to tag.i(class: "bi bi-trash"), checklist_entry_path(checklist_entry), method: :delete, class: "btn btn-link p-0 ps-3 float-end" %>
<%= link_to "edit", edit_checklist_entry_path(checklist_entry), class: "float-end" %>
<%= checklist_entry.position %>
<%= link_to(checklist_entry.check.name, checklist_entry.check, data: { turbo_frame: "_top" }) %>
</p>
</div>

View file

@ -0,0 +1,2 @@
json.extract! checklist_entry, :id, :checklist_id, :check_id, :position, :created_at, :updated_at
json.url checklist_entry_url(checklist_entry, format: :json)

View file

@ -0,0 +1,6 @@
<%= bootstrap_form_with(model: checklist_entry, layout: :horizontal) do |form| %>
<%= form.hidden_field :checklist_id %>
<%= form.collection_select :check_id, Check.all.order(:name), :id, :name %>
<%= form.number_field :position %>
<%= form.submit %>
<% end %>

View file

@ -0,0 +1,11 @@
<h1><%= t("scaffold.pagetitle_edit", model: ChecklistEntry.model_name.human) %></h1>
<%= turbo_frame_tag dom_id(@checklist_entry, :frame) do %>
<%= render "form", checklist_entry: @checklist_entry %>
<%= link_to "cancel", @checklist_entry %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_show", model: ChecklistEntry.model_name.human), @checklist_entry %>
<%= link_to t("scaffold.link_index", model: ChecklistEntry.model_name.human(count: 2)), checklist_entries_path %>
</div>

View file

@ -0,0 +1,33 @@
<h1><%= t("scaffold.pagetitle_index", model: ChecklistEntry.model_name.human(count: 2)) %></h1>
<table class="table table-striped">
<thead>
<tr>
<th><%= ChecklistEntry.human_attribute_name(:id) %></th>
<th><%= ChecklistEntry.human_attribute_name(:checklist_id) %></th>
<th><%= ChecklistEntry.human_attribute_name(:check_id) %></th>
<th><%= ChecklistEntry.human_attribute_name(:position) %></th>
</thead>
<tbody>
<% @checklist_entries.each do |checklist_entry| %>
<tr>
<td><%= link_to(checklist_entry.id, url_for(checklist_entry)) %></td>
<td><%= link_to(checklist_entry.checklist_id, url_for(checklist_entry)) %></td>
<td><%= link_to(checklist_entry.check_id, url_for(checklist_entry)) %></td>
<td><%= link_to(checklist_entry.position, url_for(checklist_entry)) %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="action-row">
<%= link_to t("scaffold.link_new", model: ChecklistEntry.model_name.human), new_checklist_entry_path %>
</div>

View file

@ -0,0 +1 @@
json.array! @checklist_entries, partial: "checklist_entries/checklist_entry", as: :checklist_entry

View file

@ -0,0 +1,9 @@
<h1><%= t("scaffold.pagetitle_new", model: ChecklistEntry.model_name.human) %></h1>
<%= turbo_frame_tag "new_checklist_entry" do %>
<%= render "form", checklist_entry: @checklist_entry %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_index", model: ChecklistEntry.model_name.human(count: 2)), checklist_entries_path %>
</div>

View file

@ -0,0 +1,11 @@
<h1><%= t("scaffold.pagetitle_show", model: @checklist_entry.class.model_name.human) %></h1>
<%= turbo_frame_tag dom_id(@checklist_entry, :frame) do %>
<%= render @checklist_entry %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @checklist_entry.model_name.human), edit_checklist_entry_path(@checklist_entry) %>
<%= link_to t("scaffold.link_index", model: @checklist_entry.model_name.human(count: 2)), checklist_entries_path %>
<%= button_to t("scaffold.link_destroy", model: @checklist_entry.model_name.human), @checklist_entry, method: :delete, class: "btn btn-outline-danger" %>
</div>

View file

@ -0,0 +1 @@
json.partial! "checklist_entries/checklist_entry", checklist_entry: @checklist_entry

View file

@ -10,8 +10,8 @@
</p>
<p>
<strong>Description:</strong>
<%= checklist.description %>
<strong>Description (formatted):</strong>
<%= checklist.description_html %>
</p>
<p>

View file

@ -1,2 +1,2 @@
json.extract! checklist, :id, :code, :name, :description, :created_at, :updated_at
json.extract! checklist, :id, :code, :name, :description_html, :created_at, :updated_at
json.url checklist_url(checklist, format: :json)

View file

@ -1,13 +1,6 @@
<%= bootstrap_form_with(model: checklist) do |form| %>
<%= form.text_field :code %>
<%= form.text_field :name %>
<%= form.text_area :description %>
<h2>Checks</h2>
<% checklist.checklist_entries.each do |entry| %>
<%= form.fields_for(:checklist_entries, entry) do |eform| %>
<%= eform.number_field :position %>
<%= eform.collection_select :check_id, Check.all, :id, :name %>
<% end %>
<% end %>
<%= form.rich_text_area :description_html %>
<%= form.submit %>
<% end %>
<% end %>

View file

@ -1,6 +1,24 @@
<h1><%= t("scaffold.pagetitle_edit", model: Checklist.model_name.human) %></h1>
<%= render "form", checklist: @checklist %>
<div class="row">
<div class="col">
<%= render "form", checklist: @checklist %>
</div>
<div class="col">
<h2>Checks</h2>
<div class="mb-2">
<%= turbo_frame_tag "new_checklist_entry" do %>
<%= link_to tag.i(class: "bi bi-plus"), new_checklist_entry_path(checklist_id: @checklist.id), class: "btn btn-primary", data: { turbo_frame: "new_checklist_entry"} %>
<% end %>
</div>
<% @checklist.checklist_entries.each do |entry| %>
<%= turbo_frame_tag dom_id(entry, :frame) do %>
<%= render entry %>
<% end %>
<% end %>
</div>
</div>
<div class="action-row">
<%= link_to t("scaffold.link_show", model: Checklist.model_name.human), @checklist %>

View file

@ -9,7 +9,7 @@
<th><%= Checklist.human_attribute_name(:name) %></th>
<th><%= Checklist.human_attribute_name(:description) %></th>
<th><%= Checklist.human_attribute_name(:description_html) %></th>
</thead>
<tbody>
@ -21,8 +21,7 @@
<td><%= link_to(checklist.name, url_for(checklist)) %></td>
<td><%= link_to(checklist.description, url_for(checklist)) %></td>
<td><%= link_to(truncate(strip_tags(checklist.description_html.to_s)), url_for(checklist)) %></td>
</tr>
<% end %>
</tbody>

View file

@ -1,9 +1,11 @@
<h1><%= t("scaffold.pagetitle_show", model: @checklist.class.model_name.human) %></h1>
<%= render @checklist %>
<pre>Dashboard
is
sidebar</pre>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @checklist.model_name.human), edit_checklist_path(@checklist) %>
<%= link_to t("scaffold.link_index", model: @checklist.model_name.human(count: 2)), checklists_path %>
<%= button_to t("scaffold.link_destroy", model: @checklist.model_name.human), @checklist, method: :delete, class: "btn btn-warning" %>
<%= button_to t("scaffold.link_destroy", model: @checklist.model_name.human), @checklist, method: :delete, class: "btn btn-outline-danger" %>
</div>

View file

@ -10,8 +10,8 @@
</p>
<p>
<strong><%= Check.human_attribute_name(:success_criterion) %>:</strong>
<%= check.success_criterion %>
<strong><%= Check.human_attribute_name(:success_criterion_html) %>:</strong>
<%= check.success_criterion_html %>
</p>
<p>

View file

@ -1,2 +1,2 @@
json.extract! check, :id, :position, :name, :success_criterion, :level, :created_at, :updated_at
json.extract! check, :id, :position, :name, :success_criterion_html, :level, :created_at, :updated_at
json.url check_url(check, format: :json)

View file

@ -1,7 +1,7 @@
<%= bootstrap_form_with(model: check, remote: true) do |form| %>
<%= form.text_field :position %>
<%= form.text_field :name %>
<%= form.text_area :success_criterion %>
<%= form.rich_text_area :success_criterion_html %>
<%= form.select :level, Check.levels.keys, add_blank: !form.object.level.present? %>
<%= form.submit %>
<% end %>

View file

@ -6,7 +6,7 @@
<th><%= Check.human_attribute_name(:id) %></th>
<th><%= Check.human_attribute_name(:level) %></th>
<th><%= Check.human_attribute_name(:name) %></th>
<th><%= Check.human_attribute_name(:success_criterion) %></th>
<th><%= Check.human_attribute_name(:success_criterion_html) %></th>
</thead>
<tbody>
<% @checks.each do |check| %>
@ -14,7 +14,7 @@
<td><%= check.id %></td>
<td><%= check.level %></td>
<td><%= link_to(check.name, url_for(check)) %></td>
<td><%= link_to(truncate(check.success_criterion), url_for(check)) %></td>
<td><%= link_to(truncate(strip_tags(check.success_criterion_html.to_s)), url_for(check)) %></td>
</tr>
<% end %>
</tbody>

View file

@ -5,5 +5,5 @@
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @check.model_name.human), edit_check_path(@check) %>
<%= link_to t("scaffold.link_index", model: @check.model_name.human(count: 2)), checks_path %>
<%= button_to t("scaffold.link_destroy", model: @check.model_name.human), @check, method: :delete, class: "btn btn-warning" %>
<%= button_to t("scaffold.link_destroy", model: @check.model_name.human), @check, method: :delete, class: "btn btn-outline-danger" %>
</div>

View file

@ -6,7 +6,11 @@
<%= element.path %>
</p>
<%= element.description_html %>
<% element.success_criteria.each do |sc| %>
<%= render sc %>
<%= turbo_frame_tag(dom_id(sc, :frame)) do %>
<%= render sc %>
<% end %>
<% end %>
</div>

View file

@ -1,2 +1,2 @@
json.extract! element, :id, :report_id, :path, :title, :description, :created_at, :updated_at
json.extract! element, :id, :report_id, :path, :title, :description_html, :created_at, :updated_at
json.url element_url(element, format: :json)

View file

@ -1,7 +1,8 @@
<%= bootstrap_form_with(model: element) do |form| %>
<%= form.text_field :report_id %>
<%= form.text_field :path %>
<%= form.text_field :title %>
<%= form.text_area :description %>
<%= form.submit %>
<%= bootstrap_form_with(model: element, data: { turbo_frame: "_top"}) do |form| %>
<%= form.hidden_field :report_id %>
<%= form.collection_select(:checklist_id, Checklist.all, :id, :name) %>
<%= form.text_field :path %>
<%= form.text_field :title %>
<%= form.rich_text_area :description_html %>
<%= form.submit %>
<% end %>

View file

@ -11,7 +11,7 @@
<th><%= Element.human_attribute_name(:title) %></th>
<th><%= Element.human_attribute_name(:description) %></th>
<th><%= Element.human_attribute_name(:description_html) %></th>
</thead>
<tbody>
@ -25,7 +25,7 @@
<td><%= link_to(element.title, url_for(element)) %></td>
<td><%= link_to(element.description, url_for(element)) %></td>
<td><%= link_to(truncate(strip_tags(element.description_html)), url_for(element)) %></td>
</tr>
<% end %>

View file

@ -1,6 +1,9 @@
<h1><%= t("scaffold.pagetitle_new", model: Element.model_name.human) %></h1>
<%= render "form", element: @element %>
<%= turbo_frame_tag "new_element_frame" do %>
<h2><i class="bi bi-plus"></i>Element hinzufügen</h2>
<%= render "form", element: @element %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_index", model: Element.model_name.human(count: 2)), elements_path %>

View file

@ -5,5 +5,5 @@
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @element.model_name.human), edit_element_path(@element) %>
<%= link_to t("scaffold.link_index", model: @element.model_name.human(count: 2)), elements_path %>
<%= button_to t("scaffold.link_destroy", model: @element.model_name.human), @element, method: :delete, class: "btn btn-warning" %>
<%= button_to t("scaffold.link_destroy", model: @element.model_name.human), @element, method: :delete, class: "btn btn-outline-danger" %>
</div>

View file

@ -1,5 +1,4 @@
<h1>Dashboard</h1>
<h2>Data</h2>
<p>
<i class="bi bi-journal-text"></i>
<%= Report.count %>
@ -11,7 +10,7 @@
<%= link_to Checklist.model_name.human(count: Checklist.count), :checklists %>
</p>
<p>
<i class="bi bi-check"></i>
<i class="bi bi-check2"></i>
<%= Check.count %>
<%= link_to Check.model_name.human(count: Check.count), :checks %>
</p>

View file

@ -1,6 +1,6 @@
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="<%= root_path %>">A11Yist</a>
<a class="navbar-brand" href="<%= root_path %>">A11yist</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

View file

@ -0,0 +1,3 @@
<div class="trix-content">
<%= yield -%>
</div>

View file

@ -1,5 +1,5 @@
<%= bootstrap_form_with(model: report) do |form| %>
<%= form.text_field :name %>
<%= form.text_area :comment %>
<%= form.submit %>
<%= form.text_field :name %>
<%= form.rich_text_area :comment_html %>
<%= form.submit %>
<% end %>

View file

@ -6,7 +6,7 @@
<p>
<strong>Comment:</strong>
<%= report.comment %>
<%= report.comment_html %>
</p>
</div>

View file

@ -1,2 +1,2 @@
json.extract! report, :id, :name, :comment, :created_at, :updated_at
json.extract! report, :id, :name, :comment_html, :created_at, :updated_at
json.url report_url(report, format: :json)

View file

@ -7,17 +7,17 @@
<th><%= Report.human_attribute_name(:name) %></th>
<th><%= Report.human_attribute_name(:comment) %></th>
<th><%= Report.human_attribute_name(:comment_html) %></th>
</thead>
<tbody>
<% @reports.each do |report| %>
<tr>
<td><%= link_to(report.id, url_for([:work, report])) %></td>
<td><%= link_to(report.id, url_for(report)) %></td>
<td><%= link_to(report.name, url_for([:work, report])) %></td>
<td><%= link_to(report.name, url_for(report)) %></td>
<td><%= link_to(report.comment, url_for([:work, report])) %></td>
<td><%= link_to(truncate(strip_tags(report.comment)), url_for(report)) if report.comment %></td>
</tr>
<% end %>

View file

@ -1,9 +1,24 @@
<h1><%= t("scaffold.pagetitle_show", model: @report.class.model_name.human) %></h1>
<div class="container">
<h1><i class="bi bi-journal-text me-2"></i><%= @report.name %></h1>
<%= render @report %>
<%= @report.comment_html %>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @report.model_name.human), edit_report_path(@report) %>
<%= link_to t("scaffold.link_index", model: @report.model_name.human(count: 2)), reports_path %>
<%= button_to t("scaffold.link_destroy", model: @report.model_name.human), @report, method: :delete, class: "btn btn-warning" %>
</div>
<div class="my-5">
<%= turbo_frame_tag "new_element_frame" do %>
<%= link_to "#{tag.i(class: "bi bi-plus-lg")} Element".html_safe, new_element_path(report_id: @report.id), class: "btn btn-primary" %>
<% end %>
</div>
<% @report.elements.each do |element| %>
<%= turbo_frame_tag dom_id(element, :frame) do %>
<%= render element %>
<% end %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @report.model_name.human), edit_report_path(@report) %>
<%= link_to t("scaffold.link_index", model: @report.model_name.human(count: 2)), reports_path %>
<%= button_to t("scaffold.link_destroy", model: @report.model_name.human), @report, method: :delete, class: "btn btn-outline-danger" %>
</div>
</div>

View file

@ -0,0 +1,14 @@
prawn_document do |pdf|
pdf.text @report.name
@report.elements.each do |element|
pdf.text element.title
pdf.text element.path
pdf.text element.description_html, inline_format: true
element.success_criteria.each do |success_criterion|
pdf.text success_criterion.title
pdf.text success_criterion.description_html, inline_format: true
pdf.text success_criterion.comment_html, inline_format: true
end
end
end

View file

@ -1,21 +0,0 @@
<div class="container">
<h1><i class="bi bi-journal-text me-2"></i><%= @report.name %></h1>
<% @report.elements.each do |element| %>
<%= render element %>
<% end %>
<hr>
<h2><i class="bi bi-plus"></i>Element hinzufügen</h2>
<%= bootstrap_form_with(model: @report.elements.build, layout: :horizontal) do |form| %>
<%= form.collection_select(:checklist_id, Checklist.all, :id, :name) %>
<%= form.hidden_field :report_id %>
<%= form.text_field :path %>
<%= form.submit %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @report.model_name.human), edit_report_path(@report) %>
<%= link_to t("scaffold.link_index", model: @report.model_name.human(count: 2)), reports_path %>
<%= button_to t("scaffold.link_destroy", model: @report.model_name.human), @report, method: :delete, class: "btn btn-warning" %>
</div>
</div>

View file

@ -1,9 +1,18 @@
<%= bootstrap_form_with(model: success_criterion) do |form| %>
<%= form.text_field :element_id %>
<%= form.text_field :title %>
<%= form.text_area :description %>
<%= form.number_field :level %>
<%= form.number_field :result %>
<%= form.text_area :comment %>
<%= form.submit %>
<% end %>
<div id="<%= dom_id success_criterion %>" class="card mt-3">
<div class="card-header">
<h3><i class="bi bi-check2 me-2"></i><%= success_criterion.title %></h3>
<%= link_to "cancel", success_criterion %>
</div>
<div class="card-body">
<%= bootstrap_form_with(model: success_criterion) do |form| %>
<%= form.text_field :title %>
<%= form.rich_text_area :description_html %>
<%= form.number_field :level %>
<%= form.select :result, SuccessCriterion.results.keys, include_blank: true %>
<%= form.rich_text_area :comment_html %>
<%= form.submit %>
<% end %>
</div>
<%# <%= link_to "edit", url_for([:edit, success_criterion]) %>
</div>

View file

@ -1,15 +1,19 @@
<div id="<%= dom_id success_criterion %>" class="card mt-3">
<div class="card-header">
<h3><i class="bi bi-check me-2"></i><%= success_criterion.title %></h3>
<h3><i class="bi bi-check2 me-2"></i><%= success_criterion.title %></h3>
<%= link_to "edit", [:edit, success_criterion]%>
</div>
<div class="card-body">
<p>
<%= success_criterion.description %>
</p>
<%= bootstrap_form_with(model: success_criterion, layout: :horizontal) do |form| %>
<%= form.select :result, SuccessCriterion.results, include_blank: true %>
<%= form.text_area :comment %>
<%= form.submit(class: "btn btn-secondary") %>
<% end %>
<%= success_criterion.description_html %>
<p class="mt-3">
<strong>Level</strong>: <%= success_criterion.level %>
</p>
<p>
<strong>Resultat</strong>: <%= success_criterion.result %>
</p>
<% if success_criterion.comment_html.present? %>
<h4 class="mt-3">Kommentar</h4>
<%= success_criterion.comment_html %>
<% end %>
</div>
</div>

View file

@ -1,2 +1,3 @@
json.extract! success_criterion, :id, :element_id, :title, :description, :level, :result, :comment, :created_at, :updated_at
json.extract! success_criterion, :id, :element_id, :title, :description_html, :level, :result, :comment_html,
:created_at, :updated_at
json.url success_criterion_url(success_criterion, format: :json)

View file

@ -1,6 +1,8 @@
<h1><%= t("scaffold.pagetitle_edit", model: SuccessCriterion.model_name.human) %></h1>
<%= render "form", success_criterion: @success_criterion %>
<%= turbo_frame_tag(dom_id(@success_criterion, :frame)) do %>
<%= render "form", success_criterion: @success_criterion %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_show", model: SuccessCriterion.model_name.human), @success_criterion %>

View file

@ -9,13 +9,13 @@
<th><%= SuccessCriterion.human_attribute_name(:title) %></th>
<th><%= SuccessCriterion.human_attribute_name(:description) %></th>
<th><%= SuccessCriterion.human_attribute_name(:description_html) %></th>
<th><%= SuccessCriterion.human_attribute_name(:level) %></th>
<th><%= SuccessCriterion.human_attribute_name(:result) %></th>
<th><%= SuccessCriterion.human_attribute_name(:comment) %></th>
<th><%= SuccessCriterion.human_attribute_name(:comment_html) %></th>
</thead>
<tbody>
@ -27,13 +27,13 @@
<td><%= link_to(success_criterion.title, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.description, url_for(success_criterion)) %></td>
<td><%= link_to(truncate(strip_tags(success_criterion.description_html)), url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.level, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.result, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.comment, url_for(success_criterion)) %></td>
<td><%= link_to(truncate(strip_tags(success_criterion.comment_html)), url_for(success_criterion)) %></td>
</tr>
<% end %>

View file

@ -1,9 +1,11 @@
<h1><%= t("scaffold.pagetitle_show", model: @success_criterion.class.model_name.human) %></h1>
<%= render @success_criterion %>
<%= turbo_frame_tag(dom_id(@success_criterion, :frame)) do %>
<% render @success_criterion %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @success_criterion.model_name.human), edit_success_criterion_path(@success_criterion) %>
<%= link_to t("scaffold.link_index", model: @success_criterion.model_name.human(count: 2)), success_criteria_path %>
<%= button_to t("scaffold.link_destroy", model: @success_criterion.model_name.human), @success_criterion, method: :delete, class: "btn btn-warning" %>
<%= button_to t("scaffold.link_destroy", model: @success_criterion.model_name.human), @success_criterion, method: :delete, class: "btn btn-outline-danger" %>
</div>