a11yist/app/views/checklist_entries/_checklist_entry.html.erb
david 7acc0559ae
Some checks failed
/ Run tests (push) Failing after 15s
/ Run system tests (push) Failing after 14s
/ Build, push and deploy image (push) Has been skipped
Make checklist entries sortable by d&d
2024-10-27 22:37:11 +01:00

22 lines
1.5 KiB
Text

<% 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">
<i class="bi bi-grip-vertical text-secondary mt-2"></i>
<div style="">
<% 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 %>
<span class="flex-grow-1 mt-2">
<%= checklist_entry.check.display_label %>
</span>
<%= link_to(tag.id(class: "bi bi-search"), checklist_entry.check, data: { turbo_frame: "_top" }, class: "btn btn-link") %>
<%= 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>