add pagy, improve checks#index

This commit is contained in:
david 2024-07-21 00:33:38 +02:00
parent c44c9ccaba
commit 6d3a269231
11 changed files with 274 additions and 10 deletions

View file

@ -1,10 +1,17 @@
<div id="<%= dom_id checklist_entry %>" class="row hover-row py-1 p-1">
<div class="col">
<%= button_to tag.i(class: "bi bi-arrow-down"), checklist_entry_path(checklist_entry), method: :patch, class: "btn btn-link p-0 float-start", data: { turbo_frame: "checklist_entries" }, params: { checklist_entry: { position: checklist_entry.position + 1 }} %>
<%= button_to tag.i(class: "bi bi-arrow-up"), checklist_entry_path(checklist_entry), method: :patch, class: "btn btn-link p-0 pe-3 float-start", data: { turbo_frame: "checklist_entries" }, params: { checklist_entry: { position: checklist_entry.position - 1 }} %>
<%= 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 tag.i(class: "bi bi-pencil"), edit_checklist_entry_path(checklist_entry), class: "float-end" %>
<% is_first = checklist_entry == checklist_entry.checklist.checklist_entries.first %>
<% is_last = checklist_entry == checklist_entry.checklist.checklist_entries.last %>
<div id="<%= dom_id checklist_entry %>" class="hover-row py-1">
<div class="d-flex">
<div style="width: 56px">
<%= button_to tag.i(class: "bi bi-arrow-down"), checklist_entry_path(checklist_entry), method: :patch, class: "btn btn-link p-0 #{"pe-3" if is_last } float-start", data: { turbo_frame: "checklist_entries" }, params: { checklist_entry: { position: checklist_entry.position + 1 }} unless is_last %>
<%= button_to tag.i(class: "bi bi-arrow-up"), checklist_entry_path(checklist_entry), method: :patch, class: "btn btn-link p-0 pe-3 float-start", data: { turbo_frame: "checklist_entries" }, params: { checklist_entry: { position: checklist_entry.position - 1 }} unless is_first %>
</div>
<div class="d-inline-flex flex-grow-1">
<%# checklist_entry.position %>
<%= link_to(checklist_entry.check.name, checklist_entry.check, data: { turbo_frame: "_top" }) %>
</div>
<%= link_to(checklist_entry.check.name, checklist_entry.check, data: { turbo_frame: "_top" }, class: "flex-grow-1") %>
<%= button_to tag.i(class: "bi bi-trash"), checklist_entry_path(checklist_entry), method: :delete, class: "btn btn-link" %>
<%= link_to tag.i(class: "bi bi-pencil"), edit_checklist_entry_path(checklist_entry), class: "btn btn-link" %>
</div>
</div>
</div>