diff --git a/app/controllers/bubbles_controller.rb b/app/controllers/bubbles_controller.rb index 974c9aec9..920b8b181 100644 --- a/app/controllers/bubbles_controller.rb +++ b/app/controllers/bubbles_controller.rb @@ -4,7 +4,7 @@ class BubblesController < ApplicationController skip_before_action :set_bucket, only: :index before_action :set_filter, only: :index - before_action :set_bubble, only: %i[ show edit update ] + before_action :set_bubble, only: %i[ show edit update destroy ] def index @bubbles = @filter.bubbles @@ -22,6 +22,11 @@ class BubblesController < ApplicationController def edit end + def destroy + @bubble.destroy! + redirect_to bubbles_path, notice: "Bubble deleted" + end + def update @bubble.update! bubble_params redirect_to @bubble diff --git a/app/views/bubbles/show.html.erb b/app/views/bubbles/show.html.erb index 7f0f2793e..1b48b031b 100644 --- a/app/views/bubbles/show.html.erb +++ b/app/views/bubbles/show.html.erb @@ -56,6 +56,14 @@ <%= image_tag "picture-double.svg", aria: { hidden: true }, size: 24 %> I've seen this + + <%= button_to bucket_bubble_path(@bubble.bucket, @bubble), + method: :delete, + class: "btn full-width justify-start borderless", + data: { turbo_confirm: "Are you sure you want to delete this bubble?" } do %> + <%= image_tag "trash.svg", aria: { hidden: true }, size: 24 %> + Delete bubble + <% end %>