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