Add button and action to delete a bubble
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user