mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-20 04:59:16 +00:00
12398: add slide-out animation
This commit is contained in:
@@ -37,14 +37,16 @@ module Admin
|
||||
{ id: params[:id] }
|
||||
).find_product
|
||||
|
||||
status = :ok
|
||||
if @record.destroy
|
||||
flash[:success] = I18n.t('admin.products_v3.delete_product.success')
|
||||
else
|
||||
flash[:error] = I18n.t('admin.products_v3.delete_product.error')
|
||||
status = :internal_server_error
|
||||
end
|
||||
|
||||
respond_with do |format|
|
||||
format.turbo_stream { render :destroy_product_variant }
|
||||
format.turbo_stream { render :destroy_product_variant, status: }
|
||||
end
|
||||
|
||||
# using flash with turbo stream doesn't clear it because the page is not refreshed.
|
||||
@@ -56,14 +58,16 @@ module Admin
|
||||
@record = Spree::Variant.active.find(params[:id])
|
||||
authorize! :delete, @record
|
||||
|
||||
status = :ok
|
||||
if VariantDeleter.new.delete(@record)
|
||||
flash[:success] = I18n.t('admin.products_v3.delete_variant.success')
|
||||
else
|
||||
flash[:error] = I18n.t('admin.products_v3.delete_variant.error')
|
||||
status = :internal_server_error
|
||||
end
|
||||
|
||||
respond_with do |format|
|
||||
format.turbo_stream { render :destroy_product_variant }
|
||||
format.turbo_stream { render :destroy_product_variant, status: }
|
||||
end
|
||||
|
||||
flash.discard
|
||||
|
||||
Reference in New Issue
Block a user