From 8c812375015ae50970beecf47e13f3c218375f32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Sch=C3=A4rer?=
Date: Fri, 19 Jul 2024 02:29:18 +0200
Subject: [PATCH] Some UX improvements
---
.gitignore | 1 +
Dockerfile | 2 +-
Gemfile | 3 +-
Gemfile.lock | 27 ++++++++
app/assets/stylesheets/actiontext.css | 65 +++++++++++++++++++
.../stylesheets/application.bootstrap.scss | 3 +
app/assets/stylesheets/layout.scss | 34 +++++++++-
app/controllers/application_controller.rb | 2 +-
.../checklist_entries_controller.rb | 59 +++++++++++++++++
app/controllers/checklists_controller.rb | 3 +-
app/controllers/checks_controller.rb | 2 +-
app/controllers/elements_controller.rb | 12 ++--
app/controllers/reports_controller.rb | 2 +-
.../success_criteria_controller.rb | 25 +++----
app/helpers/checklist_entries_helper.rb | 2 +
app/javascript/application.js | 3 +
app/models/check.rb | 4 +-
app/models/checklist.rb | 4 +-
app/models/element.rb | 2 +
app/models/report.rb | 2 +
app/models/success_criterion.rb | 4 ++
app/views/active_storage/blobs/_blob.html.erb | 14 ++++
.../_checklist_entry.html.erb | 8 +++
.../_checklist_entry.json.jbuilder | 2 +
app/views/checklist_entries/_form.html.erb | 6 ++
app/views/checklist_entries/edit.html.erb | 11 ++++
app/views/checklist_entries/index.html.erb | 33 ++++++++++
.../checklist_entries/index.json.jbuilder | 1 +
app/views/checklist_entries/new.html.erb | 9 +++
app/views/checklist_entries/show.html.erb | 11 ++++
.../checklist_entries/show.json.jbuilder | 1 +
app/views/checklists/_checklist.html.erb | 4 +-
app/views/checklists/_checklist.json.jbuilder | 2 +-
app/views/checklists/_form.html.erb | 11 +---
app/views/checklists/edit.html.erb | 20 +++++-
app/views/checklists/index.html.erb | 5 +-
app/views/checklists/show.html.erb | 6 +-
app/views/checks/_check.html.erb | 4 +-
app/views/checks/_check.json.jbuilder | 2 +-
app/views/checks/_form.html.erb | 2 +-
app/views/checks/index.html.erb | 4 +-
app/views/checks/show.html.erb | 2 +-
app/views/elements/_element.html.erb | 6 +-
app/views/elements/_element.json.jbuilder | 2 +-
app/views/elements/_form.html.erb | 13 ++--
app/views/elements/index.html.erb | 4 +-
app/views/elements/new.html.erb | 5 +-
app/views/elements/show.html.erb | 2 +-
app/views/home/show.html.erb | 3 +-
app/views/layouts/_navigation.html.erb | 2 +-
.../action_text/contents/_content.html.erb | 3 +
app/views/reports/_form.html.erb | 6 +-
app/views/reports/_report.html.erb | 2 +-
app/views/reports/_report.json.jbuilder | 2 +-
app/views/reports/index.html.erb | 8 +--
app/views/reports/show.html.erb | 29 +++++++--
app/views/reports/show.pdf.prawn | 14 ++++
app/views/reports/work.html.erb | 21 ------
app/views/success_criteria/_form.html.erb | 27 +++++---
.../_success_criterion.html.erb | 22 ++++---
.../_success_criterion.json.jbuilder | 3 +-
app/views/success_criteria/edit.html.erb | 4 +-
app/views/success_criteria/index.html.erb | 8 +--
app/views/success_criteria/show.html.erb | 6 +-
config/locales/activerecord.yml | 2 +-
config/routes.rb | 15 ++---
db/migrate/20240715123847_create_checks.rb | 1 -
.../20240715192449_create_checklists.rb | 1 -
db/migrate/20240715203351_create_reports.rb | 1 -
db/migrate/20240715210937_create_elements.rb | 1 -
.../20240715211614_create_success_criteria.rb | 2 -
...te_active_storage_tables.active_storage.rb | 57 ++++++++++++++++
...3_create_action_text_tables.action_text.rb | 26 ++++++++
db/schema.rb | 42 +++++++++++-
lib/tasks/import.rake | 54 +++++++++++++++
lib/templates/erb/scaffold/show.html.erb.tt | 2 +-
package.json | 6 +-
.../checklist_entries_controller_test.rb | 48 ++++++++++++++
test/fixtures/action_text/rich_texts.yml | 4 ++
test/system/checklist_entries_test.rb | 45 +++++++++++++
yarn.lock | 24 +++++++
81 files changed, 791 insertions(+), 151 deletions(-)
create mode 100644 app/assets/stylesheets/actiontext.css
create mode 100644 app/controllers/checklist_entries_controller.rb
create mode 100644 app/helpers/checklist_entries_helper.rb
create mode 100644 app/views/active_storage/blobs/_blob.html.erb
create mode 100644 app/views/checklist_entries/_checklist_entry.html.erb
create mode 100644 app/views/checklist_entries/_checklist_entry.json.jbuilder
create mode 100644 app/views/checklist_entries/_form.html.erb
create mode 100644 app/views/checklist_entries/edit.html.erb
create mode 100644 app/views/checklist_entries/index.html.erb
create mode 100644 app/views/checklist_entries/index.json.jbuilder
create mode 100644 app/views/checklist_entries/new.html.erb
create mode 100644 app/views/checklist_entries/show.html.erb
create mode 100644 app/views/checklist_entries/show.json.jbuilder
create mode 100644 app/views/layouts/action_text/contents/_content.html.erb
create mode 100644 app/views/reports/show.pdf.prawn
create mode 100644 db/migrate/20240716182332_create_active_storage_tables.active_storage.rb
create mode 100644 db/migrate/20240716182333_create_action_text_tables.action_text.rb
create mode 100644 lib/tasks/import.rake
create mode 100644 test/controllers/checklist_entries_controller_test.rb
create mode 100644 test/fixtures/action_text/rich_texts.yml
create mode 100644 test/system/checklist_entries_test.rb
diff --git a/.gitignore b/.gitignore
index 288c5a2..50d55f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,4 @@
!/app/assets/builds/.keep
/node_modules
+/.irbrc_history
diff --git a/Dockerfile b/Dockerfile
index 87dfcae..2968489 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -42,7 +42,7 @@ RUN \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update -yqq && \
apt-get install -yqq --no-install-recommends \
- sqlite3 nodejs npm sassc yarn && \
+ sqlite3 nodejs npm sassc yarn libvips && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
truncate -s 0 /var/log/*log && \
diff --git a/Gemfile b/Gemfile
index 4e90674..9fcf1cb 100644
--- a/Gemfile
+++ b/Gemfile
@@ -47,8 +47,9 @@ gem 'tzinfo-data', platforms: %i[windows jruby]
gem 'bootsnap', require: false
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
-# gem "image_processing", "~> 1.2"
gem 'bootstrap_form'
+gem 'image_processing', '~> 1.2'
+gem 'prawn-rails'
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
diff --git a/Gemfile.lock b/Gemfile.lock
index 4984631..98d77fb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -107,10 +107,19 @@ GEM
reline (>= 0.3.8)
drb (2.2.1)
erubi (1.13.0)
+ ffi (1.17.0-aarch64-linux-gnu)
+ ffi (1.17.0-arm-linux-gnu)
+ ffi (1.17.0-arm64-darwin)
+ ffi (1.17.0-x86-linux-gnu)
+ ffi (1.17.0-x86_64-darwin)
+ ffi (1.17.0-x86_64-linux-gnu)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
+ image_processing (1.12.2)
+ mini_magick (>= 4.9.5, < 5)
+ ruby-vips (>= 2.0.17, < 3)
io-console (0.7.2)
irb (1.14.0)
rdoc (>= 4.0.0)
@@ -133,6 +142,7 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.2)
+ mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.24.1)
msgpack (1.7.2)
@@ -163,6 +173,17 @@ GEM
parser (3.3.4.0)
ast (~> 2.4.1)
racc
+ pdf-core (0.10.0)
+ prawn (2.5.0)
+ matrix (~> 0.4)
+ pdf-core (~> 0.10.0)
+ ttfunk (~> 1.8)
+ prawn-rails (1.4.2)
+ actionview (>= 3.1.0)
+ prawn
+ prawn-table
+ prawn-table (0.2.2)
+ prawn (>= 1.3.0, < 3.0.0)
prism (0.30.0)
psych (5.1.2)
stringio
@@ -246,6 +267,8 @@ GEM
ruby-lsp-rails (0.3.10)
ruby-lsp (>= 0.17.2, < 0.18.0)
ruby-progressbar (1.13.0)
+ ruby-vips (2.2.1)
+ ffi (~> 1.12)
rubyzip (2.3.2)
selenium-webdriver (4.22.0)
base64 (~> 0.2)
@@ -273,6 +296,8 @@ GEM
strscan (3.1.0)
thor (1.3.1)
timeout (0.4.1)
+ ttfunk (1.8.0)
+ bigdecimal (~> 3.1)
turbo-rails (2.0.5)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
@@ -308,8 +333,10 @@ DEPENDENCIES
capybara
cssbundling-rails
debug
+ image_processing (~> 1.2)
jbuilder
jsbundling-rails
+ prawn-rails
puma (>= 5.0)
rails (~> 7.1.3, >= 7.1.3.4)
rubocop
diff --git a/app/assets/stylesheets/actiontext.css b/app/assets/stylesheets/actiontext.css
new file mode 100644
index 0000000..7786117
--- /dev/null
+++ b/app/assets/stylesheets/actiontext.css
@@ -0,0 +1,65 @@
+/*
+ * Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and
+ * the trix-editor content (whether displayed or under editing). Feel free to incorporate this
+ * inclusion directly in any other asset bundle and remove this file.
+ *
+ *= require trix
+*/
+
+/*
+ * We need to override trix.css’s image gallery styles to accommodate the
+ * element we wrap around attachments. Otherwise,
+ * images in galleries will be squished by the max-width: 33%; rule.
+*/
+.trix-content .attachment-gallery > action-text-attachment,
+.trix-content .attachment-gallery > .attachment {
+ flex: 1 0 33%;
+ padding: 0 0.5em;
+ max-width: 33%;
+}
+
+.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
+.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
+.trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
+ flex-basis: 50%;
+ max-width: 50%;
+}
+
+.trix-content action-text-attachment .attachment {
+ padding: 0 !important;
+ max-width: 100% !important;
+}
+
+
+/* Fix trix dark mode */
+.trix-button-row {
+ .trix-button-group {
+ border: var(--bs-border-width) solid var(--bs-border-color);
+
+ .trix-button {
+ border: 0;
+ padding: var(--bs-padding)
+ }
+ }
+}
+
+[data-bs-theme=dark] {
+ .trix-button-row {
+ .trix-button-group {
+ .trix-button {
+ background-color: transparent;
+ filter: invert(100%);
+ }
+ }
+ }
+}
+/* end fix trix dark mode */
+
+.trix-content {
+ pre {
+ background-color: var(--bs-secondary-bg) !important;
+ color: var(--bs-secondary-color) !important;
+ border: var(--bs-border-width) solid var(--bs-border-color) !important;
+ border-radius: var(--bs-border-radius) !important;
+ }
+}
diff --git a/app/assets/stylesheets/application.bootstrap.scss b/app/assets/stylesheets/application.bootstrap.scss
index 9c980a6..32022f7 100644
--- a/app/assets/stylesheets/application.bootstrap.scss
+++ b/app/assets/stylesheets/application.bootstrap.scss
@@ -28,4 +28,7 @@ $font-family-sans-serif:
@import 'bootstrap-icons/font/bootstrap-icons';
@import "rails_bootstrap_forms.css";
+@import './actiontext.css';
+@import 'trix.css';
+
@import "./layout.scss";
\ No newline at end of file
diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss
index 29de506..927375b 100644
--- a/app/assets/stylesheets/layout.scss
+++ b/app/assets/stylesheets/layout.scss
@@ -5,10 +5,40 @@
// background-color: map-get($theme-colors, "primary");
background-color: var(--bs-tertiary-bg);
- background-color: var(--bs-secondary-bg);
* {
@extend .me-2;
@extend .my-auto;
}
-}
\ No newline at end of file
+}
+
+// // Fix trix dark mode
+// .trix-button-row {
+// .trix-button-group {
+// border: var(--bs-border-width) solid var(--bs-border-color);
+
+// .trix-button {
+// border: 0;
+// }
+// }
+// }
+
+// [data-bs-theme=dark] {
+// .trix-button-row {
+// .trix-button-group {
+// .trix-button {
+// background-color: transparent;
+// filter: invert(100%);
+// }
+// }
+// }
+// }
+// // end fix trix dark mode
+
+// .trix-content pre {
+// background-color: var(--bs-secondary-bg);
+// color: var(--bs-secondary-color);
+// border: var(--bs-border-width) solid var(--bs-border-color);
+// border-radius: var(--bs-border-radius);
+// padding: var(--bs-padding);
+// }
\ No newline at end of file
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 7593990..3ce22a9 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
{ label: 'Dashboard', icon: :speedometer2, path: :root },
{ label: Report.model_name.human(count: 2), icon: :'journal-text', path: :reports },
{ label: Checklist.model_name.human(count: 2), icon: :'list-check', path: :checklists },
- { label: Check.model_name.human(count: 2), icon: :check, path: :checks }
+ { label: Check.model_name.human(count: 2), icon: :check2, path: :checks }
]
@search_url = nil # root_url
end
diff --git a/app/controllers/checklist_entries_controller.rb b/app/controllers/checklist_entries_controller.rb
new file mode 100644
index 0000000..f4d3ce4
--- /dev/null
+++ b/app/controllers/checklist_entries_controller.rb
@@ -0,0 +1,59 @@
+class ChecklistEntriesController < ApplicationController
+ before_action :set_checklist_entry, only: %i[show edit update destroy]
+
+ # GET /checklist_entries
+ def index
+ @checklist_entries = ChecklistEntry.all
+ end
+
+ # GET /checklist_entries/1
+ def show
+ end
+
+ # GET /checklist_entries/new
+ def new
+ @checklist_entry = ChecklistEntry.new(checklist_id: params[:checklist_id])
+ end
+
+ # GET /checklist_entries/1/edit
+ def edit
+ end
+
+ # POST /checklist_entries
+ def create
+ @checklist_entry = ChecklistEntry.new(checklist_entry_params)
+
+ if @checklist_entry.save
+ redirect_to @checklist_entry, notice: 'Checklist entry was successfully created.'
+ else
+ render :new, status: :unprocessable_entity
+ end
+ end
+
+ # PATCH/PUT /checklist_entries/1
+ def update
+ if @checklist_entry.update(checklist_entry_params)
+ redirect_to @checklist_entry, notice: 'Checklist entry was successfully updated.', status: :see_other
+ else
+ render :edit, status: :unprocessable_entity
+ end
+ end
+
+ # DELETE /checklist_entries/1
+ def destroy
+ @checklist_entry.destroy!
+ redirect_to checklist_entries_url, notice: 'Checklist entry was successfully destroyed.', status: :see_other
+ end
+
+ private
+
+ # Use callbacks to share common setup or constraints between actions.
+ def set_checklist_entry
+ @checklist_entry = ChecklistEntry.find(params[:id])
+ end
+
+ # Only allow a list of trusted parameters through.
+ def checklist_entry_params
+ params.require(:checklist_entry).permit(:checklist_id, :check_id, :position)
+ end
+end
diff --git a/app/controllers/checklists_controller.rb b/app/controllers/checklists_controller.rb
index 9418bff..02a20b8 100644
--- a/app/controllers/checklists_controller.rb
+++ b/app/controllers/checklists_controller.rb
@@ -17,7 +17,6 @@ class ChecklistsController < ApplicationController
# GET /checklists/1/edit
def edit
- @checklist.checklist_entries.build
end
# POST /checklists
@@ -55,7 +54,7 @@ class ChecklistsController < ApplicationController
# Only allow a list of trusted parameters through.
def checklist_params
- params.require(:checklist).permit(:code, :name, :description,
+ params.require(:checklist).permit(:code, :name, :description, :description_html,
checklist_entries_attributes: %i[id check_id position _destroy])
end
end
diff --git a/app/controllers/checks_controller.rb b/app/controllers/checks_controller.rb
index 3757ca8..7f26d7e 100644
--- a/app/controllers/checks_controller.rb
+++ b/app/controllers/checks_controller.rb
@@ -75,6 +75,6 @@ class ChecksController < ApplicationController
# Only allow a list of trusted parameters through.
def check_params
- params.require(:check).permit(:position, :name, :success_criterion, :level)
+ params.require(:check).permit(:position, :name, :success_criterion, :success_criterion_html, :level)
end
end
diff --git a/app/controllers/elements_controller.rb b/app/controllers/elements_controller.rb
index e78b27d..3ffdf98 100644
--- a/app/controllers/elements_controller.rb
+++ b/app/controllers/elements_controller.rb
@@ -12,7 +12,7 @@ class ElementsController < ApplicationController
# GET /elements/new
def new
- @element = Element.new
+ @element = Element.new(report_id: params[:report_id])
end
# GET /elements/1/edit
@@ -23,13 +23,15 @@ class ElementsController < ApplicationController
def create
checklist_id = element_params.delete(:checklist_id)
checklist = Checklist.find(checklist_id)
- @element = Element.new(element_params.merge(title: checklist.name))
+ @element = Element.new(element_params)
+ @element.title = checklist.name if @element.title.blank?
if @element.save
checklist.checks.each do |check|
- @element.success_criteria.create!(title: check.name, description: check.success_criterion, level: check.level)
+ @element.success_criteria.create!(title: check.name, description_html: check.success_criterion_html,
+ level: check.level)
end
- redirect_to [:work, @element.report], notice: 'Element was successfully created.'
+ redirect_to @element.report, notice: 'Element was successfully created.'
else
render :new, status: :unprocessable_entity
end
@@ -59,6 +61,6 @@ class ElementsController < ApplicationController
# Only allow a list of trusted parameters through.
def element_params
- params.require(:element).permit(:report_id, :path, :title, :description, :checklist_id)
+ params.require(:element).permit(:report_id, :path, :title, :description_html, :checklist_id)
end
end
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index b92bfac..206a387 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -58,6 +58,6 @@ class ReportsController < ApplicationController
# Only allow a list of trusted parameters through.
def report_params
- params.require(:report).permit(:name, :comment)
+ params.require(:report).permit(:name, :comment_html)
end
end
diff --git a/app/controllers/success_criteria_controller.rb b/app/controllers/success_criteria_controller.rb
index 9251457..73802b9 100644
--- a/app/controllers/success_criteria_controller.rb
+++ b/app/controllers/success_criteria_controller.rb
@@ -1,5 +1,5 @@
class SuccessCriteriaController < ApplicationController
- before_action :set_success_criterion, only: %i[ show edit update destroy ]
+ before_action :set_success_criterion, only: %i[show edit update destroy]
# GET /success_criteria
def index
@@ -24,7 +24,7 @@ class SuccessCriteriaController < ApplicationController
@success_criterion = SuccessCriterion.new(success_criterion_params)
if @success_criterion.save
- redirect_to @success_criterion, notice: "Success criterion was successfully created."
+ redirect_to @success_criterion, notice: 'Success criterion was successfully created.'
else
render :new, status: :unprocessable_entity
end
@@ -33,7 +33,7 @@ class SuccessCriteriaController < ApplicationController
# PATCH/PUT /success_criteria/1
def update
if @success_criterion.update(success_criterion_params)
- redirect_to @success_criterion, notice: "Success criterion was successfully updated.", status: :see_other
+ redirect_to @success_criterion, notice: 'Success criterion was successfully updated.', status: :see_other
else
render :edit, status: :unprocessable_entity
end
@@ -42,17 +42,18 @@ class SuccessCriteriaController < ApplicationController
# DELETE /success_criteria/1
def destroy
@success_criterion.destroy!
- redirect_to success_criteria_url, notice: "Success criterion was successfully destroyed.", status: :see_other
+ redirect_to success_criteria_url, notice: 'Success criterion was successfully destroyed.', status: :see_other
end
private
- # Use callbacks to share common setup or constraints between actions.
- def set_success_criterion
- @success_criterion = SuccessCriterion.find(params[:id])
- end
- # Only allow a list of trusted parameters through.
- def success_criterion_params
- params.require(:success_criterion).permit(:element_id, :title, :description, :level, :result, :comment)
- end
+ # Use callbacks to share common setup or constraints between actions.
+ def set_success_criterion
+ @success_criterion = SuccessCriterion.find(params[:id])
+ end
+
+ # Only allow a list of trusted parameters through.
+ def success_criterion_params
+ params.require(:success_criterion).permit(:element_id, :title, :description_html, :level, :result, :comment_html)
+ end
end
diff --git a/app/helpers/checklist_entries_helper.rb b/app/helpers/checklist_entries_helper.rb
new file mode 100644
index 0000000..09d2b52
--- /dev/null
+++ b/app/helpers/checklist_entries_helper.rb
@@ -0,0 +1,2 @@
+module ChecklistEntriesHelper
+end
diff --git a/app/javascript/application.js b/app/javascript/application.js
index 3016c21..5630ff0 100644
--- a/app/javascript/application.js
+++ b/app/javascript/application.js
@@ -2,3 +2,6 @@
import "@hotwired/turbo-rails"
import "./controllers"
import * as bootstrap from "bootstrap"
+
+import "trix"
+import "@rails/actiontext"
diff --git a/app/models/check.rb b/app/models/check.rb
index a67436e..f4079d2 100644
--- a/app/models/check.rb
+++ b/app/models/check.rb
@@ -1,5 +1,5 @@
class Check < ApplicationRecord
enum :level, %i[A AA AAA]
- validates :position, :name, :success_criterion, :level, presence: true
- validates :position, numericality: { less_than: 200 }
+
+ has_rich_text :success_criterion_html
end
diff --git a/app/models/checklist.rb b/app/models/checklist.rb
index 3bb1335..b5b2a02 100644
--- a/app/models/checklist.rb
+++ b/app/models/checklist.rb
@@ -2,5 +2,7 @@ class Checklist < ApplicationRecord
has_many :checklist_entries, -> { order(position: :asc) }, dependent: :destroy, inverse_of: :checklist
has_many :checks, through: :checklist_entries
- accepts_nested_attributes_for :checklist_entries
+ has_rich_text :description_html
+
+ accepts_nested_attributes_for :checklist_entries, reject_if: :all_blank, allow_destroy: true
end
diff --git a/app/models/element.rb b/app/models/element.rb
index eabfad8..afa8796 100644
--- a/app/models/element.rb
+++ b/app/models/element.rb
@@ -1,6 +1,8 @@
class Element < ApplicationRecord
attr_accessor :checklist_id
+ has_rich_text :description_html
+
belongs_to :report
has_many :success_criteria, dependent: :destroy
end
diff --git a/app/models/report.rb b/app/models/report.rb
index 3c752ea..d2a3e60 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -1,3 +1,5 @@
class Report < ApplicationRecord
has_many :elements, dependent: :destroy
+
+ has_rich_text :comment_html
end
diff --git a/app/models/success_criterion.rb b/app/models/success_criterion.rb
index 34c3b8a..524baa3 100644
--- a/app/models/success_criterion.rb
+++ b/app/models/success_criterion.rb
@@ -1,4 +1,8 @@
class SuccessCriterion < ApplicationRecord
enum :result, %i[passed failed not_applicable]
+
+ has_rich_text :comment_html
+ has_rich_text :description_html
+
belongs_to :element
end
diff --git a/app/views/active_storage/blobs/_blob.html.erb b/app/views/active_storage/blobs/_blob.html.erb
new file mode 100644
index 0000000..49ba357
--- /dev/null
+++ b/app/views/active_storage/blobs/_blob.html.erb
@@ -0,0 +1,14 @@
+ attachment--<%= blob.filename.extension %>">
+ <% if blob.representable? %>
+ <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
+ <% end %>
+
+
+ <% if caption = blob.try(:caption) %>
+ <%= caption %>
+ <% else %>
+ <%= blob.filename %>
+ <%= number_to_human_size blob.byte_size %>
+ <% end %>
+
+
diff --git a/app/views/checklist_entries/_checklist_entry.html.erb b/app/views/checklist_entries/_checklist_entry.html.erb
new file mode 100644
index 0000000..ab9404e
--- /dev/null
+++ b/app/views/checklist_entries/_checklist_entry.html.erb
@@ -0,0 +1,8 @@
+
+
+ <%= 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" }) %>
+
+
diff --git a/app/views/checklist_entries/_checklist_entry.json.jbuilder b/app/views/checklist_entries/_checklist_entry.json.jbuilder
new file mode 100644
index 0000000..ef3eaed
--- /dev/null
+++ b/app/views/checklist_entries/_checklist_entry.json.jbuilder
@@ -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)
diff --git a/app/views/checklist_entries/_form.html.erb b/app/views/checklist_entries/_form.html.erb
new file mode 100644
index 0000000..3f5a7e7
--- /dev/null
+++ b/app/views/checklist_entries/_form.html.erb
@@ -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 %>
\ No newline at end of file
diff --git a/app/views/checklist_entries/edit.html.erb b/app/views/checklist_entries/edit.html.erb
new file mode 100644
index 0000000..25e960f
--- /dev/null
+++ b/app/views/checklist_entries/edit.html.erb
@@ -0,0 +1,11 @@
+<%= t("scaffold.pagetitle_edit", model: ChecklistEntry.model_name.human) %>
+
+<%= turbo_frame_tag dom_id(@checklist_entry, :frame) do %>
+ <%= render "form", checklist_entry: @checklist_entry %>
+ <%= link_to "cancel", @checklist_entry %>
+<% end %>
+
+
+ <%= 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 %>
+
diff --git a/app/views/checklist_entries/index.html.erb b/app/views/checklist_entries/index.html.erb
new file mode 100644
index 0000000..d2cffb6
--- /dev/null
+++ b/app/views/checklist_entries/index.html.erb
@@ -0,0 +1,33 @@
+<%= t("scaffold.pagetitle_index", model: ChecklistEntry.model_name.human(count: 2)) %>
+
+
+
+
+ <%= ChecklistEntry.human_attribute_name(:id) %>
+
+ <%= ChecklistEntry.human_attribute_name(:checklist_id) %>
+
+ <%= ChecklistEntry.human_attribute_name(:check_id) %>
+
+ <%= ChecklistEntry.human_attribute_name(:position) %>
+
+
+
+ <% @checklist_entries.each do |checklist_entry| %>
+
+ <%= link_to(checklist_entry.id, url_for(checklist_entry)) %>
+
+ <%= link_to(checklist_entry.checklist_id, url_for(checklist_entry)) %>
+
+ <%= link_to(checklist_entry.check_id, url_for(checklist_entry)) %>
+
+ <%= link_to(checklist_entry.position, url_for(checklist_entry)) %>
+
+
+ <% end %>
+
+
+
+
+ <%= link_to t("scaffold.link_new", model: ChecklistEntry.model_name.human), new_checklist_entry_path %>
+
\ No newline at end of file
diff --git a/app/views/checklist_entries/index.json.jbuilder b/app/views/checklist_entries/index.json.jbuilder
new file mode 100644
index 0000000..be6f6df
--- /dev/null
+++ b/app/views/checklist_entries/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @checklist_entries, partial: "checklist_entries/checklist_entry", as: :checklist_entry
diff --git a/app/views/checklist_entries/new.html.erb b/app/views/checklist_entries/new.html.erb
new file mode 100644
index 0000000..7fedce1
--- /dev/null
+++ b/app/views/checklist_entries/new.html.erb
@@ -0,0 +1,9 @@
+<%= t("scaffold.pagetitle_new", model: ChecklistEntry.model_name.human) %>
+
+<%= turbo_frame_tag "new_checklist_entry" do %>
+ <%= render "form", checklist_entry: @checklist_entry %>
+<% end %>
+
+
+ <%= link_to t("scaffold.link_index", model: ChecklistEntry.model_name.human(count: 2)), checklist_entries_path %>
+
diff --git a/app/views/checklist_entries/show.html.erb b/app/views/checklist_entries/show.html.erb
new file mode 100644
index 0000000..55b7a1c
--- /dev/null
+++ b/app/views/checklist_entries/show.html.erb
@@ -0,0 +1,11 @@
+<%= t("scaffold.pagetitle_show", model: @checklist_entry.class.model_name.human) %>
+
+<%= turbo_frame_tag dom_id(@checklist_entry, :frame) do %>
+ <%= render @checklist_entry %>
+<% end %>
+
+
+ <%= 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" %>
+
diff --git a/app/views/checklist_entries/show.json.jbuilder b/app/views/checklist_entries/show.json.jbuilder
new file mode 100644
index 0000000..f479642
--- /dev/null
+++ b/app/views/checklist_entries/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "checklist_entries/checklist_entry", checklist_entry: @checklist_entry
diff --git a/app/views/checklists/_checklist.html.erb b/app/views/checklists/_checklist.html.erb
index 527b498..70e1a96 100644
--- a/app/views/checklists/_checklist.html.erb
+++ b/app/views/checklists/_checklist.html.erb
@@ -10,8 +10,8 @@
- Description:
- <%= checklist.description %>
+ Description (formatted):
+ <%= checklist.description_html %>
diff --git a/app/views/checklists/_checklist.json.jbuilder b/app/views/checklists/_checklist.json.jbuilder
index bc0abb5..d3ffcaa 100644
--- a/app/views/checklists/_checklist.json.jbuilder
+++ b/app/views/checklists/_checklist.json.jbuilder
@@ -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)
diff --git a/app/views/checklists/_form.html.erb b/app/views/checklists/_form.html.erb
index bc5117d..55696ca 100644
--- a/app/views/checklists/_form.html.erb
+++ b/app/views/checklists/_form.html.erb
@@ -1,13 +1,6 @@
<%= bootstrap_form_with(model: checklist) do |form| %>
<%= form.text_field :code %>
<%= form.text_field :name %>
- <%= form.text_area :description %>
-
Checks
- <% 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 %>
\ No newline at end of file
diff --git a/app/views/checklists/edit.html.erb b/app/views/checklists/edit.html.erb
index a334aff..7ffb0eb 100644
--- a/app/views/checklists/edit.html.erb
+++ b/app/views/checklists/edit.html.erb
@@ -1,6 +1,24 @@
<%= t("scaffold.pagetitle_edit", model: Checklist.model_name.human) %>
-<%= render "form", checklist: @checklist %>
+
+
+
+ <%= render "form", checklist: @checklist %>
+
+
+
Checks
+
+ <%= 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 %>
+
+ <% @checklist.checklist_entries.each do |entry| %>
+ <%= turbo_frame_tag dom_id(entry, :frame) do %>
+ <%= render entry %>
+ <% end %>
+ <% end %>
+
+
<%= link_to t("scaffold.link_show", model: Checklist.model_name.human), @checklist %>
diff --git a/app/views/checklists/index.html.erb b/app/views/checklists/index.html.erb
index 746ac4b..89d5781 100644
--- a/app/views/checklists/index.html.erb
+++ b/app/views/checklists/index.html.erb
@@ -9,7 +9,7 @@
<%= Checklist.human_attribute_name(:name) %>
-
<%= Checklist.human_attribute_name(:description) %>
+
<%= Checklist.human_attribute_name(:description_html) %>
@@ -21,8 +21,7 @@
<%= link_to(checklist.name, url_for(checklist)) %>
- <%= link_to(checklist.description, url_for(checklist)) %>
-
+ <%= link_to(truncate(strip_tags(checklist.description_html.to_s)), url_for(checklist)) %>
<% end %>
diff --git a/app/views/checklists/show.html.erb b/app/views/checklists/show.html.erb
index b8cfe07..165fd7d 100644
--- a/app/views/checklists/show.html.erb
+++ b/app/views/checklists/show.html.erb
@@ -1,9 +1,11 @@
<%= t("scaffold.pagetitle_show", model: @checklist.class.model_name.human) %>
<%= render @checklist %>
-
+
Dashboard
+ is
+ sidebar
<%= 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" %>
diff --git a/app/views/checks/_check.html.erb b/app/views/checks/_check.html.erb
index 2e866b9..0df1c67 100644
--- a/app/views/checks/_check.html.erb
+++ b/app/views/checks/_check.html.erb
@@ -10,8 +10,8 @@
- <%= Check.human_attribute_name(:success_criterion) %>:
- <%= check.success_criterion %>
+ <%= Check.human_attribute_name(:success_criterion_html) %>:
+ <%= check.success_criterion_html %>
diff --git a/app/views/checks/_check.json.jbuilder b/app/views/checks/_check.json.jbuilder
index b8ecfaa..128c258 100644
--- a/app/views/checks/_check.json.jbuilder
+++ b/app/views/checks/_check.json.jbuilder
@@ -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)
diff --git a/app/views/checks/_form.html.erb b/app/views/checks/_form.html.erb
index f1eb076..ab0d482 100644
--- a/app/views/checks/_form.html.erb
+++ b/app/views/checks/_form.html.erb
@@ -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 %>
diff --git a/app/views/checks/index.html.erb b/app/views/checks/index.html.erb
index 38b462f..bf029ef 100644
--- a/app/views/checks/index.html.erb
+++ b/app/views/checks/index.html.erb
@@ -6,7 +6,7 @@
<%= Check.human_attribute_name(:id) %>
<%= Check.human_attribute_name(:level) %>
<%= Check.human_attribute_name(:name) %>
-
<%= Check.human_attribute_name(:success_criterion) %>
+
<%= Check.human_attribute_name(:success_criterion_html) %>
<% @checks.each do |check| %>
@@ -14,7 +14,7 @@
<%= check.id %>
<%= check.level %>
<%= link_to(check.name, url_for(check)) %>
- <%= link_to(truncate(check.success_criterion), url_for(check)) %>
+ <%= link_to(truncate(strip_tags(check.success_criterion_html.to_s)), url_for(check)) %>
<% end %>
diff --git a/app/views/checks/show.html.erb b/app/views/checks/show.html.erb
index 06be642..e15c1b1 100644
--- a/app/views/checks/show.html.erb
+++ b/app/views/checks/show.html.erb
@@ -5,5 +5,5 @@
<%= 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" %>
diff --git a/app/views/elements/_element.html.erb b/app/views/elements/_element.html.erb
index 1555037..579fdb2 100644
--- a/app/views/elements/_element.html.erb
+++ b/app/views/elements/_element.html.erb
@@ -6,7 +6,11 @@
<%= element.path %>
+ <%= element.description_html %>
+
<% element.success_criteria.each do |sc| %>
- <%= render sc %>
+ <%= turbo_frame_tag(dom_id(sc, :frame)) do %>
+ <%= render sc %>
+ <% end %>
<% end %>
diff --git a/app/views/elements/_element.json.jbuilder b/app/views/elements/_element.json.jbuilder
index 903afbc..1656599 100644
--- a/app/views/elements/_element.json.jbuilder
+++ b/app/views/elements/_element.json.jbuilder
@@ -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)
diff --git a/app/views/elements/_form.html.erb b/app/views/elements/_form.html.erb
index 2e3bcc3..f3fa56e 100644
--- a/app/views/elements/_form.html.erb
+++ b/app/views/elements/_form.html.erb
@@ -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 %>
diff --git a/app/views/elements/index.html.erb b/app/views/elements/index.html.erb
index c377143..2b6b800 100644
--- a/app/views/elements/index.html.erb
+++ b/app/views/elements/index.html.erb
@@ -11,7 +11,7 @@
<%= Element.human_attribute_name(:title) %>
- <%= Element.human_attribute_name(:description) %>
+ <%= Element.human_attribute_name(:description_html) %>
@@ -25,7 +25,7 @@
<%= link_to(element.title, url_for(element)) %>
- <%= link_to(element.description, url_for(element)) %>
+ <%= link_to(truncate(strip_tags(element.description_html)), url_for(element)) %>
<% end %>
diff --git a/app/views/elements/new.html.erb b/app/views/elements/new.html.erb
index 12ac16d..32cb059 100644
--- a/app/views/elements/new.html.erb
+++ b/app/views/elements/new.html.erb
@@ -1,6 +1,9 @@
<%= t("scaffold.pagetitle_new", model: Element.model_name.human) %>
-<%= render "form", element: @element %>
+<%= turbo_frame_tag "new_element_frame" do %>
+ Element hinzufügen
+ <%= render "form", element: @element %>
+<% end %>
<%= link_to t("scaffold.link_index", model: Element.model_name.human(count: 2)), elements_path %>
diff --git a/app/views/elements/show.html.erb b/app/views/elements/show.html.erb
index 75299c7..36ba6d6 100644
--- a/app/views/elements/show.html.erb
+++ b/app/views/elements/show.html.erb
@@ -5,5 +5,5 @@
<%= 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" %>
diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb
index 6868dd0..b2993c1 100644
--- a/app/views/home/show.html.erb
+++ b/app/views/home/show.html.erb
@@ -1,5 +1,4 @@
Dashboard
-
Data
<%= Report.count %>
@@ -11,7 +10,7 @@
<%= link_to Checklist.model_name.human(count: Checklist.count), :checklists %>
-
+
<%= Check.count %>
<%= link_to Check.model_name.human(count: Check.count), :checks %>
\ No newline at end of file
diff --git a/app/views/layouts/_navigation.html.erb b/app/views/layouts/_navigation.html.erb
index bdbbfbe..ceff512 100644
--- a/app/views/layouts/_navigation.html.erb
+++ b/app/views/layouts/_navigation.html.erb
@@ -1,6 +1,6 @@
-
A11Yist
+
A11yist
diff --git a/app/views/layouts/action_text/contents/_content.html.erb b/app/views/layouts/action_text/contents/_content.html.erb
new file mode 100644
index 0000000..9e3c0d0
--- /dev/null
+++ b/app/views/layouts/action_text/contents/_content.html.erb
@@ -0,0 +1,3 @@
+
+ <%= yield -%>
+
diff --git a/app/views/reports/_form.html.erb b/app/views/reports/_form.html.erb
index 93ffe4e..19db8fc 100644
--- a/app/views/reports/_form.html.erb
+++ b/app/views/reports/_form.html.erb
@@ -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 %>
diff --git a/app/views/reports/_report.html.erb b/app/views/reports/_report.html.erb
index 9bbbdb0..b29f11f 100644
--- a/app/views/reports/_report.html.erb
+++ b/app/views/reports/_report.html.erb
@@ -6,7 +6,7 @@
Comment:
- <%= report.comment %>
+ <%= report.comment_html %>
diff --git a/app/views/reports/_report.json.jbuilder b/app/views/reports/_report.json.jbuilder
index c3313d0..5012ee9 100644
--- a/app/views/reports/_report.json.jbuilder
+++ b/app/views/reports/_report.json.jbuilder
@@ -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)
diff --git a/app/views/reports/index.html.erb b/app/views/reports/index.html.erb
index bcab331..7190010 100644
--- a/app/views/reports/index.html.erb
+++ b/app/views/reports/index.html.erb
@@ -7,17 +7,17 @@
<%= Report.human_attribute_name(:name) %>
- <%= Report.human_attribute_name(:comment) %>
+ <%= Report.human_attribute_name(:comment_html) %>
<% @reports.each do |report| %>
- <%= link_to(report.id, url_for([:work, report])) %>
+ <%= link_to(report.id, url_for(report)) %>
- <%= link_to(report.name, url_for([:work, report])) %>
+ <%= link_to(report.name, url_for(report)) %>
- <%= link_to(report.comment, url_for([:work, report])) %>
+ <%= link_to(truncate(strip_tags(report.comment)), url_for(report)) if report.comment %>
<% end %>
diff --git a/app/views/reports/show.html.erb b/app/views/reports/show.html.erb
index 8522f7a..6fdd6ae 100644
--- a/app/views/reports/show.html.erb
+++ b/app/views/reports/show.html.erb
@@ -1,9 +1,24 @@
-<%= t("scaffold.pagetitle_show", model: @report.class.model_name.human) %>
+
+
<%= @report.name %>
-<%= render @report %>
+ <%= @report.comment_html %>
-
- <%= 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" %>
-
+
+ <%= 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 %>
+
+
+ <% @report.elements.each do |element| %>
+ <%= turbo_frame_tag dom_id(element, :frame) do %>
+ <%= render element %>
+ <% end %>
+ <% end %>
+
+
+
+ <%= 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" %>
+
+
\ No newline at end of file
diff --git a/app/views/reports/show.pdf.prawn b/app/views/reports/show.pdf.prawn
new file mode 100644
index 0000000..4202127
--- /dev/null
+++ b/app/views/reports/show.pdf.prawn
@@ -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
diff --git a/app/views/reports/work.html.erb b/app/views/reports/work.html.erb
index 8ecddb5..e69de29 100644
--- a/app/views/reports/work.html.erb
+++ b/app/views/reports/work.html.erb
@@ -1,21 +0,0 @@
-
-
<%= @report.name %>
-
-<% @report.elements.each do |element| %>
- <%= render element %>
-<% end %>
-
-
Element hinzufügen
-<%= 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 %>
-
-
- <%= 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" %>
-
-
\ No newline at end of file
diff --git a/app/views/success_criteria/_form.html.erb b/app/views/success_criteria/_form.html.erb
index b685e5b..8893712 100644
--- a/app/views/success_criteria/_form.html.erb
+++ b/app/views/success_criteria/_form.html.erb
@@ -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 %>
+
+
+
+
+ <%= 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 %>
+
+ <%# <%= link_to "edit", url_for([:edit, success_criterion]) %>
+
diff --git a/app/views/success_criteria/_success_criterion.html.erb b/app/views/success_criteria/_success_criterion.html.erb
index c55bc04..8905c9c 100644
--- a/app/views/success_criteria/_success_criterion.html.erb
+++ b/app/views/success_criteria/_success_criterion.html.erb
@@ -1,15 +1,19 @@
-
- <%= success_criterion.description %>
-
- <%= 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 %>
+
+ Level : <%= success_criterion.level %>
+
+
+ Resultat : <%= success_criterion.result %>
+
+ <% if success_criterion.comment_html.present? %>
+
Kommentar
+ <%= success_criterion.comment_html %>
+ <% end %>
diff --git a/app/views/success_criteria/_success_criterion.json.jbuilder b/app/views/success_criteria/_success_criterion.json.jbuilder
index 67c8fe5..81d1a20 100644
--- a/app/views/success_criteria/_success_criterion.json.jbuilder
+++ b/app/views/success_criteria/_success_criterion.json.jbuilder
@@ -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)
diff --git a/app/views/success_criteria/edit.html.erb b/app/views/success_criteria/edit.html.erb
index abd63f6..13ddad4 100644
--- a/app/views/success_criteria/edit.html.erb
+++ b/app/views/success_criteria/edit.html.erb
@@ -1,6 +1,8 @@
<%= t("scaffold.pagetitle_edit", model: SuccessCriterion.model_name.human) %>
-<%= render "form", success_criterion: @success_criterion %>
+<%= turbo_frame_tag(dom_id(@success_criterion, :frame)) do %>
+ <%= render "form", success_criterion: @success_criterion %>
+<% end %>
<%= link_to t("scaffold.link_show", model: SuccessCriterion.model_name.human), @success_criterion %>
diff --git a/app/views/success_criteria/index.html.erb b/app/views/success_criteria/index.html.erb
index 3d33757..84368f4 100644
--- a/app/views/success_criteria/index.html.erb
+++ b/app/views/success_criteria/index.html.erb
@@ -9,13 +9,13 @@
<%= SuccessCriterion.human_attribute_name(:title) %>
-
<%= SuccessCriterion.human_attribute_name(:description) %>
+
<%= SuccessCriterion.human_attribute_name(:description_html) %>
<%= SuccessCriterion.human_attribute_name(:level) %>
<%= SuccessCriterion.human_attribute_name(:result) %>
-
<%= SuccessCriterion.human_attribute_name(:comment) %>
+
<%= SuccessCriterion.human_attribute_name(:comment_html) %>
@@ -27,13 +27,13 @@
<%= link_to(success_criterion.title, url_for(success_criterion)) %>
- <%= link_to(success_criterion.description, url_for(success_criterion)) %>
+ <%= link_to(truncate(strip_tags(success_criterion.description_html)), url_for(success_criterion)) %>
<%= link_to(success_criterion.level, url_for(success_criterion)) %>
<%= link_to(success_criterion.result, url_for(success_criterion)) %>
- <%= link_to(success_criterion.comment, url_for(success_criterion)) %>
+ <%= link_to(truncate(strip_tags(success_criterion.comment_html)), url_for(success_criterion)) %>
<% end %>
diff --git a/app/views/success_criteria/show.html.erb b/app/views/success_criteria/show.html.erb
index 107b453..d23a7e3 100644
--- a/app/views/success_criteria/show.html.erb
+++ b/app/views/success_criteria/show.html.erb
@@ -1,9 +1,11 @@
<%= t("scaffold.pagetitle_show", model: @success_criterion.class.model_name.human) %>
-<%= render @success_criterion %>
+<%= turbo_frame_tag(dom_id(@success_criterion, :frame)) do %>
+ <% render @success_criterion %>
+<% end %>
<%= 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" %>
diff --git a/config/locales/activerecord.yml b/config/locales/activerecord.yml
index 991cc7a..b9bab26 100644
--- a/config/locales/activerecord.yml
+++ b/config/locales/activerecord.yml
@@ -5,7 +5,7 @@ de-CH:
id: ID
level: Stufe
position: Position
- success_criterion: Erfolgskriterium
+ success_criterion_html: Erfolgskriterium
models:
check:
one: Check
diff --git a/config/routes.rb b/config/routes.rb
index 2035362..bfd0427 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,15 +1,14 @@
+# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
Rails.application.routes.draw do
- resources :success_criteria
- resources :elements
- resources :reports do
- member do
- get :work
- end
- end
+ resources :reports
resources :checklists
resources :checks
+
+ resources :checklist_entries
+ resources :success_criteria
+ resources :elements
+
get 'home/show', as: :home
- # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
diff --git a/db/migrate/20240715123847_create_checks.rb b/db/migrate/20240715123847_create_checks.rb
index aff04f1..bf808f2 100644
--- a/db/migrate/20240715123847_create_checks.rb
+++ b/db/migrate/20240715123847_create_checks.rb
@@ -3,7 +3,6 @@ class CreateChecks < ActiveRecord::Migration[7.1]
create_table :checks do |t|
t.string :position
t.string :name
- t.text :success_criterion
t.integer :level
t.timestamps
diff --git a/db/migrate/20240715192449_create_checklists.rb b/db/migrate/20240715192449_create_checklists.rb
index 4899279..4dc7fb4 100644
--- a/db/migrate/20240715192449_create_checklists.rb
+++ b/db/migrate/20240715192449_create_checklists.rb
@@ -3,7 +3,6 @@ class CreateChecklists < ActiveRecord::Migration[7.1]
create_table :checklists do |t|
t.string :code
t.string :name
- t.text :description
t.timestamps
end
diff --git a/db/migrate/20240715203351_create_reports.rb b/db/migrate/20240715203351_create_reports.rb
index bc91285..615924f 100644
--- a/db/migrate/20240715203351_create_reports.rb
+++ b/db/migrate/20240715203351_create_reports.rb
@@ -2,7 +2,6 @@ class CreateReports < ActiveRecord::Migration[7.1]
def change
create_table :reports do |t|
t.string :name
- t.text :comment
t.timestamps
end
diff --git a/db/migrate/20240715210937_create_elements.rb b/db/migrate/20240715210937_create_elements.rb
index f15a203..2861d93 100644
--- a/db/migrate/20240715210937_create_elements.rb
+++ b/db/migrate/20240715210937_create_elements.rb
@@ -4,7 +4,6 @@ class CreateElements < ActiveRecord::Migration[7.1]
t.references :report, null: false, foreign_key: true
t.string :path
t.string :title
- t.text :description
t.timestamps
end
diff --git a/db/migrate/20240715211614_create_success_criteria.rb b/db/migrate/20240715211614_create_success_criteria.rb
index 911f667..e87cb96 100644
--- a/db/migrate/20240715211614_create_success_criteria.rb
+++ b/db/migrate/20240715211614_create_success_criteria.rb
@@ -3,10 +3,8 @@ class CreateSuccessCriteria < ActiveRecord::Migration[7.1]
create_table :success_criteria do |t|
t.references :element, null: false, foreign_key: true
t.string :title
- t.text :description
t.integer :level
t.integer :result
- t.text :comment
t.timestamps
end
diff --git a/db/migrate/20240716182332_create_active_storage_tables.active_storage.rb b/db/migrate/20240716182332_create_active_storage_tables.active_storage.rb
new file mode 100644
index 0000000..e4706aa
--- /dev/null
+++ b/db/migrate/20240716182332_create_active_storage_tables.active_storage.rb
@@ -0,0 +1,57 @@
+# This migration comes from active_storage (originally 20170806125915)
+class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
+ def change
+ # Use Active Record's configured type for primary and foreign keys
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
+
+ create_table :active_storage_blobs, id: primary_key_type do |t|
+ t.string :key, null: false
+ t.string :filename, null: false
+ t.string :content_type
+ t.text :metadata
+ t.string :service_name, null: false
+ t.bigint :byte_size, null: false
+ t.string :checksum
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :key ], unique: true
+ end
+
+ create_table :active_storage_attachments, id: primary_key_type do |t|
+ t.string :name, null: false
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
+ t.references :blob, null: false, type: foreign_key_type
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+
+ create_table :active_storage_variant_records, id: primary_key_type do |t|
+ t.belongs_to :blob, null: false, index: false, type: foreign_key_type
+ t.string :variation_digest, null: false
+
+ t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+ end
+
+ private
+ def primary_and_foreign_key_types
+ config = Rails.configuration.generators
+ setting = config.options[config.orm][:primary_key_type]
+ primary_key_type = setting || :primary_key
+ foreign_key_type = setting || :bigint
+ [primary_key_type, foreign_key_type]
+ end
+end
diff --git a/db/migrate/20240716182333_create_action_text_tables.action_text.rb b/db/migrate/20240716182333_create_action_text_tables.action_text.rb
new file mode 100644
index 0000000..1be48d7
--- /dev/null
+++ b/db/migrate/20240716182333_create_action_text_tables.action_text.rb
@@ -0,0 +1,26 @@
+# This migration comes from action_text (originally 20180528164100)
+class CreateActionTextTables < ActiveRecord::Migration[6.0]
+ def change
+ # Use Active Record's configured type for primary and foreign keys
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
+
+ create_table :action_text_rich_texts, id: primary_key_type do |t|
+ t.string :name, null: false
+ t.text :body, size: :long
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
+
+ t.timestamps
+
+ t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true
+ end
+ end
+
+ private
+ def primary_and_foreign_key_types
+ config = Rails.configuration.generators
+ setting = config.options[config.orm][:primary_key_type]
+ primary_key_type = setting || :primary_key
+ foreign_key_type = setting || :bigint
+ [primary_key_type, foreign_key_type]
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4423884..a84b6ee 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,45 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.1].define(version: 2024_07_15_211614) do
+ActiveRecord::Schema[7.1].define(version: 2024_07_16_182333) do
+ create_table "action_text_rich_texts", force: :cascade do |t|
+ t.string "name", null: false
+ t.text "body"
+ t.string "record_type", null: false
+ t.bigint "record_id", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
+ end
+
+ create_table "active_storage_attachments", force: :cascade do |t|
+ t.string "name", null: false
+ t.string "record_type", null: false
+ t.bigint "record_id", null: false
+ t.bigint "blob_id", null: false
+ t.datetime "created_at", null: false
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
+ end
+
+ create_table "active_storage_blobs", force: :cascade do |t|
+ t.string "key", null: false
+ t.string "filename", null: false
+ t.string "content_type"
+ t.text "metadata"
+ t.string "service_name", null: false
+ t.bigint "byte_size", null: false
+ t.string "checksum"
+ t.datetime "created_at", null: false
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
+ end
+
+ create_table "active_storage_variant_records", force: :cascade do |t|
+ t.bigint "blob_id", null: false
+ t.string "variation_digest", null: false
+ t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
+ end
+
create_table "checklist_entries", force: :cascade do |t|
t.integer "checklist_id", null: false
t.integer "check_id", null: false
@@ -67,6 +105,8 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_15_211614) do
t.index ["element_id"], name: "index_success_criteria_on_element_id"
end
+ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
+ add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "checklist_entries", "checklists"
add_foreign_key "checklist_entries", "checks"
add_foreign_key "elements", "reports"
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
new file mode 100644
index 0000000..44f95cf
--- /dev/null
+++ b/lib/tasks/import.rake
@@ -0,0 +1,54 @@
+namespace :import do
+ desc 'Import WCAG2.1 in german'
+ task wcag21de: :environment do
+ URL = 'https://outline-rocks.github.io/wcag/translations/WCAG21-de/'
+
+ doc = Nokogiri::HTML5(URI.open(URL))
+
+ # standard = Standard.find_or_create_by(url: URL)
+ # standard.name = 'WCAG 2.1'
+ # standard.description = doc.css('#abstract p').map(&:to_s).join
+ # standard.save!
+
+ doc.css('section.principle').each do |principle_node|
+ _principle_id = principle_node.attributes['id'].value
+ _principle_title = principle_node.css('h2').first.content
+ # principle = standard.principles.find_or_create_by(code: principle_id)
+ # principle.name = principle_title.scan(/\d+\. (.*)/).first.last
+ # principle.number = principle_title.scan(/(\d+)\..*/).first.last
+ # principle.save!
+
+ principle_node.css('section').each do |guideline_node|
+ next unless guideline_node.css('h3').first
+
+ guideline_title = guideline_node.css('h3').first.content
+ guideline_text = guideline_node.css('p').first
+
+ _guideline_number = guideline_title.scan(/Richtlinie \d+\.(\d+).*/).first.last
+ # guideline = principle.guidelines.find_or_create_by(number: guideline_number)
+ # guideline.title = guideline_title.scan(/Richtlinie \d+\.\d+(.*)/).first.last
+ # guideline.text = guideline_text
+
+ # guideline.save!
+
+ guideline_node.css('section').each do |sc|
+ sc_title = sc.css('h4').first.content.scan(/Erfolgskriterium \d+\.\d+\.\d+(.*)/).first.last
+ sc_level = sc.css('p').first.content.scan(/\(Stufe (A+)\)/).first.last
+ # sc_hints = sc.css('div p').map { ReverseMarkdown.convert(_1.to_s) }
+
+ # _sc_number = sc_title.scan(/Erfolgskriterium \d+\.\d+\.(\d+).*/).first.last
+
+ success_criterion = Check.find_or_create_by(name: sc_title)
+ success_criterion.name = sc_title
+ text = "#{guideline_text}
#{sc.css('p')[1]}"
+ text += "
#{sc.css('dl').first&.to_s}
" if sc.css('dl').first
+
+ success_criterion.success_criterion_html = "#{text}
".gsub('href="#', %(href="#{URL}#))
+ success_criterion.level = sc_level
+ success_criterion.save!
+ end
+ end
+ end
+ @output
+ end
+end
diff --git a/lib/templates/erb/scaffold/show.html.erb.tt b/lib/templates/erb/scaffold/show.html.erb.tt
index 2c9f5ce..d1b660a 100644
--- a/lib/templates/erb/scaffold/show.html.erb.tt
+++ b/lib/templates/erb/scaffold/show.html.erb.tt
@@ -5,5 +5,5 @@
<%%= link_to t("scaffold.link_edit", model: @<%= singular_table_name %>.model_name.human), <%= edit_helper(type: :path) %> %>
<%%= link_to t("scaffold.link_index", model: @<%= singular_table_name %>.model_name.human(count: 2)), <%= index_helper(type: :path) %> %>
- <%%= button_to t("scaffold.link_destroy", model: @<%= singular_table_name %>.model_name.human), <%= model_resource_name(prefix: "@") %>, method: :delete, class: "btn btn-warning" %>
+ <%%= button_to t("scaffold.link_destroy", model: @<%= singular_table_name %>.model_name.human), <%= model_resource_name(prefix: "@") %>, method: :delete, class: "btn btn-outline-danger" %>
diff --git a/package.json b/package.json
index f9b9b24..e3d2076 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo-rails": "^8.0.4",
"@popperjs/core": "^2.11.8",
+ "@rails/actiontext": "^7.1.3-4",
"autoprefixer": "^10.4.19",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
@@ -12,7 +13,8 @@
"nodemon": "^3.1.4",
"postcss": "^8.4.39",
"postcss-cli": "^11.0.0",
- "sass": "^1.77.8"
+ "sass": "^1.77.8",
+ "trix": "^2.1.3"
},
"scripts": {
"build": "esbuild app/javascript/*.* --bundle --sourcemap --format=esm --outdir=app/assets/builds --public-path=/assets",
@@ -24,4 +26,4 @@
"browserslist": [
"defaults"
]
-}
\ No newline at end of file
+}
diff --git a/test/controllers/checklist_entries_controller_test.rb b/test/controllers/checklist_entries_controller_test.rb
new file mode 100644
index 0000000..8b1ca82
--- /dev/null
+++ b/test/controllers/checklist_entries_controller_test.rb
@@ -0,0 +1,48 @@
+require "test_helper"
+
+class ChecklistEntriesControllerTest < ActionDispatch::IntegrationTest
+ setup do
+ @checklist_entry = checklist_entries(:one)
+ end
+
+ test "should get index" do
+ get checklist_entries_url
+ assert_response :success
+ end
+
+ test "should get new" do
+ get new_checklist_entry_url
+ assert_response :success
+ end
+
+ test "should create checklist_entry" do
+ assert_difference("ChecklistEntry.count") do
+ post checklist_entries_url, params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id, position: @checklist_entry.position } }
+ end
+
+ assert_redirected_to checklist_entry_url(ChecklistEntry.last)
+ end
+
+ test "should show checklist_entry" do
+ get checklist_entry_url(@checklist_entry)
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get edit_checklist_entry_url(@checklist_entry)
+ assert_response :success
+ end
+
+ test "should update checklist_entry" do
+ patch checklist_entry_url(@checklist_entry), params: { checklist_entry: { check_id: @checklist_entry.check_id, checklist_id: @checklist_entry.checklist_id, position: @checklist_entry.position } }
+ assert_redirected_to checklist_entry_url(@checklist_entry)
+ end
+
+ test "should destroy checklist_entry" do
+ assert_difference("ChecklistEntry.count", -1) do
+ delete checklist_entry_url(@checklist_entry)
+ end
+
+ assert_redirected_to checklist_entries_url
+ end
+end
diff --git a/test/fixtures/action_text/rich_texts.yml b/test/fixtures/action_text/rich_texts.yml
new file mode 100644
index 0000000..8b371ea
--- /dev/null
+++ b/test/fixtures/action_text/rich_texts.yml
@@ -0,0 +1,4 @@
+# one:
+# record: name_of_fixture (ClassOfFixture)
+# name: content
+# body: In a million stars!
diff --git a/test/system/checklist_entries_test.rb b/test/system/checklist_entries_test.rb
new file mode 100644
index 0000000..83fd3e7
--- /dev/null
+++ b/test/system/checklist_entries_test.rb
@@ -0,0 +1,45 @@
+require "application_system_test_case"
+
+class ChecklistEntriesTest < ApplicationSystemTestCase
+ setup do
+ @checklist_entry = checklist_entries(:one)
+ end
+
+ test "visiting the index" do
+ visit checklist_entries_url
+ assert_selector "h1", text: "Checklist entries"
+ end
+
+ test "should create checklist entry" do
+ visit checklist_entries_url
+ click_on "New checklist entry"
+
+ fill_in "Check", with: @checklist_entry.check_id
+ fill_in "Checklist", with: @checklist_entry.checklist_id
+ fill_in "Position", with: @checklist_entry.position
+ click_on "Create Checklist entry"
+
+ assert_text "Checklist entry was successfully created"
+ click_on "Back"
+ end
+
+ test "should update Checklist entry" do
+ visit checklist_entry_url(@checklist_entry)
+ click_on "Edit this checklist entry", match: :first
+
+ fill_in "Check", with: @checklist_entry.check_id
+ fill_in "Checklist", with: @checklist_entry.checklist_id
+ fill_in "Position", with: @checklist_entry.position
+ click_on "Update Checklist entry"
+
+ assert_text "Checklist entry was successfully updated"
+ click_on "Back"
+ end
+
+ test "should destroy Checklist entry" do
+ visit checklist_entry_url(@checklist_entry)
+ click_on "Destroy this checklist entry", match: :first
+
+ assert_text "Checklist entry was successfully destroyed"
+ end
+end
diff --git a/yarn.lock b/yarn.lock
index c1a6218..e745dc5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -171,6 +171,20 @@
resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.1.3.tgz#4db480347775aeecd4dde2405659eef74a458881"
integrity sha512-ojNvnoZtPN0pYvVFtlO7dyEN9Oml1B6IDM+whGKVak69MMYW99lC2NOWXWeE3bmwEydbP/nn6ERcpfjHVjYQjA==
+"@rails/actiontext@^7.1.3-4":
+ version "7.1.3-4"
+ resolved "https://registry.yarnpkg.com/@rails/actiontext/-/actiontext-7.1.3-4.tgz#6717c4cbe146e04677c1c403d144a4fd9e9227f9"
+ integrity sha512-Yt0aFwV4vmQDH0SPMKACF5WnZ88vn8KHpCbPJIGnFcj4likev+SkmdCLu/TpcHrFQwHWXt+GwKE924Ny92YXAg==
+ dependencies:
+ "@rails/activestorage" ">= 7.1.0-alpha"
+
+"@rails/activestorage@>= 7.1.0-alpha":
+ version "7.1.3"
+ resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-7.1.3.tgz#e83ece6c5fd94b3ddf30a8cf3b8f78cad049e596"
+ integrity sha512-B+RFYAU8vdTPFg0IJcRp2ey0Qw9hpcUOqHHcWqftDJ76ZMBi9+m/UUeMJlNsSd0l9eD+1HLlFSo1X//cY4yiDw==
+ dependencies:
+ spark-md5 "^3.0.1"
+
"@sindresorhus/merge-streams@^2.1.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz#719df7fb41766bc143369eaa0dd56d8dc87c9958"
@@ -703,6 +717,11 @@ slash@^5.0.0, slash@^5.1.0:
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af"
integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==
+spark-md5@^3.0.1:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.2.tgz#7952c4a30784347abcee73268e473b9c0167e3fc"
+ integrity sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==
+
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
@@ -743,6 +762,11 @@ touch@^3.1.0:
resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.1.tgz#097a23d7b161476435e5c1344a95c0f75b4a5694"
integrity sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==
+trix@^2.1.3:
+ version "2.1.3"
+ resolved "https://registry.yarnpkg.com/trix/-/trix-2.1.3.tgz#38c8725cd1864ca5e9784aed7d043fa11669ba81"
+ integrity sha512-LqMp67LiKMQytAHKqNL1Jgmfz69ViW+WBOQTPA2BlMIuxic1mw5vHgDtOE0bvvojUdjAxh0EJtLpJn6BC/2JKw==
+
undefsafe@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c"