diff --git a/app/assets/images/minus.svg b/app/assets/images/minus.svg new file mode 100644 index 000000000..4ad10bc76 --- /dev/null +++ b/app/assets/images/minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/controllers/bubbles_controller.rb b/app/controllers/bubbles_controller.rb index 796e4c03a..dc13cf0cd 100644 --- a/app/controllers/bubbles_controller.rb +++ b/app/controllers/bubbles_controller.rb @@ -19,6 +19,7 @@ class BubblesController < ApplicationController def update @bubble.update(bubble_params) + remove_image if params[:remove_image] == "true" redirect_to bubble_path(@bubble) end @@ -38,6 +39,10 @@ class BubblesController < ApplicationController end def bubble_params - params.require(:bubble).permit(:title, :body, :color, :image, tag_ids: []) + params.require(:bubble).permit(:title, :body, :color, :image, :remove_image, tag_ids: []) + end + + def remove_image + @bubble.image.purge end end diff --git a/app/views/bubbles/_bubble.html.erb b/app/views/bubbles/_bubble.html.erb index 1eba1ab7b..9d000af09 100644 --- a/app/views/bubbles/_bubble.html.erb +++ b/app/views/bubbles/_bubble.html.erb @@ -13,12 +13,21 @@ <%= form_with model: bubble, data: { controller: "form" } do | form | %>
<% end %>