mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
12398: add destroy action with turbo stream
This commit is contained in:
@@ -31,6 +31,14 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
# will update this in further commits
|
||||
def destroy
|
||||
@product = Spree::Product.find(params[:id])
|
||||
respond_with do |format|
|
||||
format.turbo_stream
|
||||
end
|
||||
end
|
||||
|
||||
def index_url(params)
|
||||
"/admin/products?#{params.to_query}" # todo: fix routing so this can be automaticly generated
|
||||
end
|
||||
|
||||
1
app/views/admin/products_v3/destroy.turbo_stream.haml
Normal file
1
app/views/admin/products_v3/destroy.turbo_stream.haml
Normal file
@@ -0,0 +1 @@
|
||||
= turbo_stream.remove dom_id(@product)
|
||||
@@ -75,6 +75,8 @@ Openfoodnetwork::Application.routes.draw do
|
||||
# This might be easier to arrange once we rename the controller to plain old "products"
|
||||
post '/products/bulk_update', to: 'products_v3#bulk_update'
|
||||
get '/products', to: 'products_v3#index'
|
||||
# we already have DELETE admin/products/:id here
|
||||
delete 'products_v3/:id', to: 'products_v3#destroy', as: 'product_destroy'
|
||||
end
|
||||
|
||||
resources :variant_overrides do
|
||||
|
||||
Reference in New Issue
Block a user