12398: add slide-out animation

This commit is contained in:
Ahmed Ejaz
2024-05-28 01:10:30 +05:00
committed by zanetagebka
parent 897596de5f
commit 52a5b5fb2b
10 changed files with 81 additions and 33 deletions

View File

@@ -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