Add button and action to delete a bubble

This commit is contained in:
Jason Zimdars
2024-12-17 15:58:12 -06:00
parent 43ed808ecf
commit bd35da79c3
2 changed files with 14 additions and 1 deletions
+6 -1
View File
@@ -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
+8
View File
@@ -56,6 +56,14 @@
<%= image_tag "picture-double.svg", aria: { hidden: true }, size: 24 %>
<span>I've seen this</span>
</button>
<%= 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 %>
<span>Delete bubble</span>
<% end %>
</div>
</aside>