|
26 | 26 | <div data-accordion-target="content" class="rounded-xl">
|
27 | 27 | <div class="field mt-5">
|
28 | 28 | <%= form_with(url: event_donation_tiers_path(event), local: true, method: :patch) do |form| %>
|
29 |
| - <% event.donation_tiers.each do |tier| %> |
30 |
| - <div class="card shadow-none border bg-gray-50 flex items-start gap-2 mb-2"> |
31 |
| - <div class="flex-1"> |
32 |
| - <div class="flex gap-2 w-full"> |
33 |
| - <input type="text" class="flex-1 !max-w-full" placeholder="Tier name" name="tiers[<%= tier.id %>][name]" value="<%= tier.name %>" required> |
34 |
| - <div class="flex items-center gap-2 border rounded-md px-3 input min-w-0 p-0 max-w-[200px]"> |
35 |
| - $ |
36 |
| - <input type="text" class="!border-none !px-0" style="max-width: 95px" placeholder="Monthly cost" name="tiers[<%= tier.id %>][amount_cents]" value="<%= tier.amount_cents / 100 %>" required> |
37 |
| - /month |
| 29 | + <ul |
| 30 | + class="list-none p-0 m-0 flex flex-col gap-2" |
| 31 | + data-controller="sortable event-sort" |
| 32 | + data-sortable-append-to-value="body" |
| 33 | + data-sortable-handle-value=".draggable-handle" |
| 34 | + data-event-sort-organizer-positions-value="<%= event.donation_tiers.pluck(:id).to_json %>" |
| 35 | + data-action="sortable:stop->event-sort#sort"> |
| 36 | + <% event.donation_tiers.each do |tier| %> |
| 37 | + <div class="draggable card shadow-none border bg-gray-50 flex items-start gap-2 mb-2 transition-none"> |
| 38 | + <div class="flex-1"> |
| 39 | + <div class="flex gap-2 w-full"> |
| 40 | + <input type="text" class="flex-1 !max-w-full" placeholder="Tier name" name="tiers[<%= tier.id %>][name]" value="<%= tier.name %>" required> |
| 41 | + <div class="flex items-center gap-2 border rounded-md px-3 input min-w-0 p-0 max-w-[200px]"> |
| 42 | + $ |
| 43 | + <input type="text" class="!border-none !px-0" style="max-width: 95px" placeholder="Monthly cost" name="tiers[<%= tier.id %>][amount_cents]" value="<%= tier.amount_cents / 100 %>" required> |
| 44 | + /month |
| 45 | + </div> |
38 | 46 | </div>
|
| 47 | + <textarea class="w-100 max-w-full mt-1" placeholder="Description" name="tiers[<%= tier.id %>][description]"><%= tier.description %></textarea> |
39 | 48 | </div>
|
40 |
| - <textarea class="w-100 max-w-full mt-1" placeholder="Description" name="tiers[<%= tier.id %>][description]"><%= tier.description %></textarea> |
41 |
| - </div> |
42 | 49 |
|
43 |
| - <div class="flex flex-col gap-1"> |
44 |
| - <%= pop_icon_to "drag-indicator", "#" %> |
45 |
| - <%= pop_icon_to "delete", event_donation_tiers_path(event, tier), method: :delete, data: { turbo_confirm: "Are you sure?" } %> |
| 50 | + <div class="flex flex-col gap-1"> |
| 51 | + <%= pop_icon_to "drag-indicator", "#", class: "draggable-handle cursor-move" %> |
| 52 | + <%= pop_icon_to "delete", event_donation_tiers_path(event, tier), method: :delete, data: { turbo_confirm: "Are you sure?" } %> |
| 53 | + </div> |
46 | 54 | </div>
|
47 |
| - </div> |
48 |
| - <% end %> |
| 55 | + <% end %> |
| 56 | + </ul> |
49 | 57 |
|
50 | 58 | <div class="flex gap-3 mt-4">
|
51 | 59 | <button type="button" class="btn bg-muted flex-1 gap-2" onclick="document.getElementById('createTier').requestSubmit();">
|
|
0 commit comments