From bb15e5aba1a6185ce08b2a32fc79a119de8add3c Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Wed, 27 Aug 2025 14:48:20 -0500 Subject: [PATCH] Prevent deleting the last collection --- app/views/collections/edit/_delete.html.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/collections/edit/_delete.html.erb b/app/views/collections/edit/_delete.html.erb index 28952d515..a3d6eab5a 100644 --- a/app/views/collections/edit/_delete.html.erb +++ b/app/views/collections/edit/_delete.html.erb @@ -1,6 +1,8 @@ -<%= form_with model: collection, 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 Collection?" } do %> - <%= icon_tag "trash" %> - Delete this Collection +<% if Current.user.collections.many? %> + <%= form_with model: collection, 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 Collection?" } do %> + <%= icon_tag "trash" %> + Delete this Collection + <% end %> <% end %> <% end %>