Some UX improvements

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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