Some UX improvements
This commit is contained in:
parent
48c0067076
commit
8c81237501
81 changed files with 791 additions and 151 deletions
65
app/assets/stylesheets/actiontext.css
Normal file
65
app/assets/stylesheets/actiontext.css
Normal file
|
|
@ -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
|
||||
* <action-text-attachment> 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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";
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // 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);
|
||||
// }
|
||||
|
|
@ -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
|
||||
|
|
|
|||
59
app/controllers/checklist_entries_controller.rb
Normal file
59
app/controllers/checklist_entries_controller.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
2
app/helpers/checklist_entries_helper.rb
Normal file
2
app/helpers/checklist_entries_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module ChecklistEntriesHelper
|
||||
end
|
||||
|
|
@ -2,3 +2,6 @@
|
|||
import "@hotwired/turbo-rails"
|
||||
import "./controllers"
|
||||
import * as bootstrap from "bootstrap"
|
||||
|
||||
import "trix"
|
||||
import "@rails/actiontext"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
class Report < ApplicationRecord
|
||||
has_many :elements, dependent: :destroy
|
||||
|
||||
has_rich_text :comment_html
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
14
app/views/active_storage/blobs/_blob.html.erb
Normal file
14
app/views/active_storage/blobs/_blob.html.erb
Normal 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>
|
||||
8
app/views/checklist_entries/_checklist_entry.html.erb
Normal file
8
app/views/checklist_entries/_checklist_entry.html.erb
Normal 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>
|
||||
|
|
@ -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)
|
||||
6
app/views/checklist_entries/_form.html.erb
Normal file
6
app/views/checklist_entries/_form.html.erb
Normal 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 %>
|
||||
11
app/views/checklist_entries/edit.html.erb
Normal file
11
app/views/checklist_entries/edit.html.erb
Normal 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>
|
||||
33
app/views/checklist_entries/index.html.erb
Normal file
33
app/views/checklist_entries/index.html.erb
Normal 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>
|
||||
1
app/views/checklist_entries/index.json.jbuilder
Normal file
1
app/views/checklist_entries/index.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.array! @checklist_entries, partial: "checklist_entries/checklist_entry", as: :checklist_entry
|
||||
9
app/views/checklist_entries/new.html.erb
Normal file
9
app/views/checklist_entries/new.html.erb
Normal 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>
|
||||
11
app/views/checklist_entries/show.html.erb
Normal file
11
app/views/checklist_entries/show.html.erb
Normal 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>
|
||||
1
app/views/checklist_entries/show.json.jbuilder
Normal file
1
app/views/checklist_entries/show.json.jbuilder
Normal file
|
|
@ -0,0 +1 @@
|
|||
json.partial! "checklist_entries/checklist_entry", checklist_entry: @checklist_entry
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= checklist.description %>
|
||||
<strong>Description (formatted):</strong>
|
||||
<%= checklist.description_html %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
3
app/views/layouts/action_text/contents/_content.html.erb
Normal file
3
app/views/layouts/action_text/contents/_content.html.erb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div class="trix-content">
|
||||
<%= yield -%>
|
||||
</div>
|
||||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<p>
|
||||
<strong>Comment:</strong>
|
||||
<%= report.comment %>
|
||||
<%= report.comment_html %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
14
app/views/reports/show.pdf.prawn
Normal file
14
app/views/reports/show.pdf.prawn
Normal 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
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue