Sha256: df2cb1075705ab0e66c7dc6797ed98d770fb24be2c6c0751ad1b8ac4fc217272

Contents?: true

Size: 922 Bytes

Versions: 3

Compression:

Stored size: 922 Bytes

Contents

# frozen_string_literal: true

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

    def index
      stock_locations = apply_search_to(
        Spree::StockLocation.order(id: :desc),
        param: :q,
      )

      set_page_and_extract_portion_from(stock_locations)

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

    def destroy
      @stock_locations = Spree::StockLocation.where(id: params[:id])

      Spree::StockLocation.transaction { @stock_locations.destroy_all }

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

    private

    def stock_location_params
      params.require(:stock_location).permit(:stock_location_id, permitted_stock_location_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/stock_locations_controller.rb
solidus_admin-0.3.1 app/controllers/solidus_admin/stock_locations_controller.rb
solidus_admin-0.3.0 app/controllers/solidus_admin/stock_locations_controller.rb