Sha256: 70602c1cc58a93254b4645a5bcb78066608fd68efdcd8cbc40c2b0d83c81d799

Contents?: true

Size: 936 Bytes

Versions: 3

Compression:

Stored size: 936 Bytes

Contents

# frozen_string_literal: true

module SolidusAdmin
  class ShippingMethodsController < SolidusAdmin::BaseController
    include SolidusAdmin::ControllerHelpers::Search

    def index
      shipping_methods = apply_search_to(
        Spree::ShippingMethod.order(id: :desc),
        param: :q,
      )

      set_page_and_extract_portion_from(shipping_methods)

      respond_to do |format|
        format.html { render component('shipping_methods/index').new(page: @page) }
      end
    end

    def destroy
      @shipping_methods = Spree::ShippingMethod.where(id: params[:id])

      Spree::ShippingMethod.transaction { @shipping_methods.destroy_all }

      flash[:notice] = t('.success')
      redirect_back_or_to shipping_methods_path, status: :see_other
    end

    private

    def shipping_method_params
      params.require(:shipping_method).permit(:shipping_method_id, permitted_shipping_method_attributes)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_admin-0.3.2 app/controllers/solidus_admin/shipping_methods_controller.rb
solidus_admin-0.3.1 app/controllers/solidus_admin/shipping_methods_controller.rb
solidus_admin-0.3.0 app/controllers/solidus_admin/shipping_methods_controller.rb