From 82ee889301c89ed313df0502952db6e44374c0a5 Mon Sep 17 00:00:00 2001 From: arvind0143 Date: Mon, 20 May 2024 17:30:33 +0530 Subject: [PATCH] fixed cloud asset admin dashboard issue. --- app/controllers/spree/admin/clouds_controller.rb | 15 +++------------ .../spree/admin/clouds/create.turbo_stream.erb | 3 +++ 2 files changed, 6 insertions(+), 12 deletions(-) create mode 100644 app/views/spree/admin/clouds/create.turbo_stream.erb diff --git a/app/controllers/spree/admin/clouds_controller.rb b/app/controllers/spree/admin/clouds_controller.rb index b0d255e..90cd50d 100644 --- a/app/controllers/spree/admin/clouds_controller.rb +++ b/app/controllers/spree/admin/clouds_controller.rb @@ -29,23 +29,14 @@ def create @cloud_asset.user = spree_current_user if @cloud_asset.save - flash.now[:notice] = 'Cloud asset was successfully created.' - render turbo_stream: turbo_stream.replace('display-cloud-assets', partial: 'cloud_asset_table', locals: { collection: collection }) + flash[:success] = 'Cloud asset was successfully created.' + # render turbo_stream: turbo_stream.replace('display-cloud-assets', partial: 'cloud_asset_table', locals: { collection: collection }) + redirect_to spree.admin_clouds_path else render :index end end - def destroy - @cloud_asset = Spree::CloudAsset.find(params[:id]) - if @cloud_asset.destroy - flash.now[:notice] = 'Cloud asset was successfully deleted.' - else - flash.now[:error] = 'Failed to delete cloud asset.' - end - redirect_to spree.admin_clouds_path - end - private def cloud_asset_params diff --git a/app/views/spree/admin/clouds/create.turbo_stream.erb b/app/views/spree/admin/clouds/create.turbo_stream.erb new file mode 100644 index 0000000..e59784e --- /dev/null +++ b/app/views/spree/admin/clouds/create.turbo_stream.erb @@ -0,0 +1,3 @@ +<%= turbo_stream.update 'display-cloud-assets' do %> + <%= render partial: 'cloud_asset_table', locals: { collection: collection } %> +<% end %>