Gui improvements and ideas

This commit is contained in:
david 2024-07-20 16:52:12 +02:00
parent 3f4c7d17bf
commit 2ae0b55e42
54 changed files with 639 additions and 237 deletions

View file

@ -1,8 +1,10 @@
<div id="<%= dom_id checklist_entry %>">
<p>
<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 "edit", edit_checklist_entry_path(checklist_entry), class: "float-end" %>
<%= checklist_entry.position %>
<%= link_to tag.i(class: "bi bi-pencil"), 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>
</div>

View file

@ -1,6 +1,7 @@
<%= bootstrap_form_with(model: checklist_entry, layout: :horizontal) do |form| %>
<%= link_to "Abbrechen", checklist_entry.persisted? ? checklist_entry : checklist_entry.checklist, class: "btn btn-outline-secondary float-end", data: { turbo_frame: "checklist_entries" } %>
<%= form.submit class: "btn btn-secondary float-end me-2" %>
<%= form.hidden_field :checklist_id %>
<%= form.collection_select :check_id, Check.all.order(:name), :id, :name %>
<%= form.number_field :position %>
<%= form.submit %>
<%# form.number_field :position %>
<% end %>

View file

@ -0,0 +1 @@
<%= turbo_stream.remove dom_id(@checklist_entry) %>

View file

@ -2,7 +2,7 @@
<%= 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">

View file

@ -1,32 +1,12 @@
<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>
<%= turbo_frame_tag "checklist_entries" do %>
<% @checklist_entries.each do |entry| %>
<%= turbo_frame_tag dom_id(entry, :frame) do %>
<%= render entry %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_new", model: ChecklistEntry.model_name.human), new_checklist_entry_path %>

View file

@ -1,7 +1,8 @@
<h1><%= t("scaffold.pagetitle_new", model: ChecklistEntry.model_name.human) %></h1>
<%= turbo_frame_tag "new_checklist_entry" do %>
<%= turbo_frame_tag "checklist_entries" do %>
<%= render "form", checklist_entry: @checklist_entry %>
<%= render @checklist_entry.checklist.checklist_entries.reject { _1 == @checklist_entry } %>
<% end %>
<div class="action-row">