Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/helpers/cards_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ def card_article_tag(card, id: dom_id(card, :article), data: {}, **options, &blo
&block
end

def button_to_delete_card(card)
button_to card_path(card),
method: :delete, class: "btn txt-negative borderless txt-small", data: { turbo_frame: "_top", turbo_confirm: "Are you sure you want to permanently delete this card?" } do
concat(icon_tag("trash"))
concat(tag.span("Delete this card"))
end
end

def card_title_tag(card)
title = [
card.title,
Expand Down
19 changes: 14 additions & 5 deletions app/views/boards/edit/_delete.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<%= form_with model: board, class: "txt-align-center margin-block-start-auto", method: :delete do |form| %>
<%= form.button class: "btn txt-negative borderless txt-small", data: { turbo_confirm: "Are you sure you want to permanently delete this board and all the cards on it? This can't be undone." } do %>
<div class="txt-align-center margin-block-start-auto" 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 board</span>
<% end %>
<% end %>

</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 board?</h3>
<p class="txt-medium margin-block-half">Are you sure you want to permanently delete this board and all the cards on it? This can't be undone.</p>
<div class="flex gap-half justify-end margin-block-start">
<button type="button" class="btn" data-action="dialog#close">Cancel</button>
<%= button_to board_path(board), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %>
<span>Delete board</span>
<% end %>
</div>
</dialog>
</div>
16 changes: 16 additions & 0 deletions app/views/cards/_delete.html.erb
Original file line number Diff line number Diff line change
@@ -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>
2 changes: 1 addition & 1 deletion app/views/cards/_messages.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +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)">
<%= button_to_delete_card(card) %>
<%= render "cards/delete", card: card %>
</footer>
<% end %>
<% end %>