Some UX improvements

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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