Move card deletion button to partial.

This commit is contained in:
Justin Starner
2025-12-04 22:23:21 -05:00
parent fc3b63bb52
commit 5cc6bba040
2 changed files with 17 additions and 16 deletions
+16
View File
@@ -0,0 +1,16 @@
<div data-controller="dialog" data-dialog-modal-value="true" data-action="keydown.esc->dialog#close:stop">
<button type="button" class="btn txt-negative borderless txt-small" data-action="dialog#open">
<%= icon_tag "trash" %>
<span>Delete this card</span>
</button>
<dialog class="dialog panel fill-white shadow gap flex-column" style="max-width: 40ch" data-dialog-target="dialog">
<h3 class="txt-large txt-bold">Delete this card?</h3>
<p class="txt-medium margin-block-half">Are you sure you want to permanently delete this card?</p>
<div class="flex gap-half justify-end margin-block-start">
<button type="button" class="btn" data-action="dialog#close">Cancel</button>
<%= button_to card_path(card), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %>
<span>Delete card</span>
<% end %>
</div>
</dialog>
</div>
+1 -16
View File
@@ -9,22 +9,7 @@
<% if Current.user.can_administer_card?(card) %>
<footer class="delete-card txt-align-center full-width flex flex-column margin-block-start-double">
<hr class="separator--horizontal full-width margin-block" style="--border-color: var(--color-ink-lighter)">
<div data-controller="dialog" data-dialog-modal-value="true" data-action="keydown.esc->dialog#close:stop">
<button type="button" class="btn txt-negative borderless txt-small" data-action="dialog#open">
<%= icon_tag "trash" %>
<span>Delete this card</span>
</button>
<dialog class="dialog panel fill-white shadow gap flex-column" style="max-width: 40ch" data-dialog-target="dialog">
<h3 class="txt-large txt-bold">Delete this card?</h3>
<p class="txt-medium margin-block-half">Are you sure you want to permanently delete this card?</p>
<div class="flex gap-half justify-end margin-block-start">
<button type="button" class="btn" data-action="dialog#close">Cancel</button>
<%= button_to card_path(card), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %>
<span>Delete card</span>
<% end %>
</div>
</dialog>
</div>
<%= render "cards/delete", card: card %>
</footer>
<% end %>
<% end %>