mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
rename destroy.turbo_stream to make it more generic
This commit is contained in:
@@ -32,19 +32,19 @@ module Admin
|
||||
end
|
||||
|
||||
def destroy
|
||||
@product = ProductScopeQuery.new(
|
||||
@record = ProductScopeQuery.new(
|
||||
spree_current_user,
|
||||
{ id: params[:id] }
|
||||
).find_product
|
||||
|
||||
if @product.destroy
|
||||
if @record.destroy
|
||||
flash[:success] = I18n.t('admin.products_v3.delete_product.success')
|
||||
else
|
||||
flash[:error] = I18n.t('admin.products_v3.delete_product.error')
|
||||
end
|
||||
|
||||
respond_with do |format|
|
||||
format.turbo_stream
|
||||
format.turbo_stream { render :destroy_product_variant }
|
||||
end
|
||||
|
||||
# using flash with turbo stream doesn't clear it because the page is not refreshed.
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
= turbo_stream.remove dom_id(@product)
|
||||
= render partial: "admin/shared/flashes", locals: { flashes: flash } if defined? flash
|
||||
Reference in New Issue
Block a user