From d28fbaa101595fb63269a1797e3223c9ad73bd59 Mon Sep 17 00:00:00 2001 From: Justin Starner Date: Thu, 4 Dec 2025 21:47:05 -0500 Subject: [PATCH 1/4] Refactor card deletion to use custom modal Replaces the standard turbo_confirm attribute with a custom dialog modal for a better user experience. - Removes `button_to_delete_card` helper in favor of inline markup. - Implements `keydown.esc->dialog#close:stop` to prevent the Escape key from inadvertently closing selected card. --- app/helpers/cards_helper.rb | 8 -------- app/views/cards/_messages.html.erb | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/helpers/cards_helper.rb b/app/helpers/cards_helper.rb index 581adc1080..9b149b7078 100644 --- a/app/helpers/cards_helper.rb +++ b/app/helpers/cards_helper.rb @@ -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, diff --git a/app/views/cards/_messages.html.erb b/app/views/cards/_messages.html.erb index 402a39ec0d..d4f6a6400e 100644 --- a/app/views/cards/_messages.html.erb +++ b/app/views/cards/_messages.html.erb @@ -9,7 +9,22 @@ <% if Current.user.can_administer_card?(card) %> <% end %> <% end %> From fc3b63bb52a23fd4dcef2b8678defceb9bc876ad Mon Sep 17 00:00:00 2001 From: Justin Starner Date: Thu, 4 Dec 2025 21:49:28 -0500 Subject: [PATCH 2/4] Refactor board deletion to use custom modal Applies the custom dialog modal pattern to the board deletion workflow, matching the card deletion updates. --- app/views/boards/edit/_delete.html.erb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/views/boards/edit/_delete.html.erb b/app/views/boards/edit/_delete.html.erb index 94a85d63fd..47a7a3ed1d 100644 --- a/app/views/boards/edit/_delete.html.erb +++ b/app/views/boards/edit/_delete.html.erb @@ -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 %> +
+ + +

Delete this board?

+

Are you sure you want to permanently delete this board and all the cards on it? This can't be undone.

+
+ + <%= button_to board_path(board), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %> + Delete board + <% end %> +
+
+
From 5cc6bba04023ad46f0d5121a428ef69ad6e7f54f Mon Sep 17 00:00:00 2001 From: Justin Starner Date: Thu, 4 Dec 2025 22:23:21 -0500 Subject: [PATCH 3/4] Move card deletion button to partial. --- app/views/cards/_delete.html.erb | 16 ++++++++++++++++ app/views/cards/_messages.html.erb | 17 +---------------- 2 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 app/views/cards/_delete.html.erb diff --git a/app/views/cards/_delete.html.erb b/app/views/cards/_delete.html.erb new file mode 100644 index 0000000000..5e62794784 --- /dev/null +++ b/app/views/cards/_delete.html.erb @@ -0,0 +1,16 @@ +
+ + +

Delete this card?

+

Are you sure you want to permanently delete this card?

+
+ + <%= button_to card_path(card), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %> + Delete card + <% end %> +
+
+
diff --git a/app/views/cards/_messages.html.erb b/app/views/cards/_messages.html.erb index d4f6a6400e..a2784e72a6 100644 --- a/app/views/cards/_messages.html.erb +++ b/app/views/cards/_messages.html.erb @@ -9,22 +9,7 @@ <% if Current.user.can_administer_card?(card) %>

-
- - -

Delete this card?

-

Are you sure you want to permanently delete this card?

-
- - <%= button_to card_path(card), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %> - Delete card - <% end %> -
-
-
+ <%= render "cards/delete", card: card %>
<% end %> <% end %> From 330be4ec72d956d56a68baec7f16058024877ab3 Mon Sep 17 00:00:00 2001 From: Justin Starner Date: Fri, 5 Dec 2025 15:25:24 -0500 Subject: [PATCH 4/4] Position modal buttons using justify-center. --- app/views/boards/edit/_delete.html.erb | 2 +- app/views/cards/_delete.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/boards/edit/_delete.html.erb b/app/views/boards/edit/_delete.html.erb index 47a7a3ed1d..ec346f5908 100644 --- a/app/views/boards/edit/_delete.html.erb +++ b/app/views/boards/edit/_delete.html.erb @@ -6,7 +6,7 @@

Delete this board?

Are you sure you want to permanently delete this board and all the cards on it? This can't be undone.

-
+
<%= button_to board_path(board), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %> Delete board diff --git a/app/views/cards/_delete.html.erb b/app/views/cards/_delete.html.erb index 5e62794784..43afbbad22 100644 --- a/app/views/cards/_delete.html.erb +++ b/app/views/cards/_delete.html.erb @@ -6,7 +6,7 @@

Delete this card?

Are you sure you want to permanently delete this card?

-
+
<%= button_to card_path(card), method: :delete, class: "btn txt-negative", data: { turbo_frame: "_top" } do %> Delete card