Sha256: 6e023430c810119e9591c9ca37269077477f9729a7049c64c7571ab8ee6968c8

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

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

    def index
      stores = apply_search_to(
        Spree::Store.order(id: :desc),
        param: :q
      )

      set_page_and_extract_portion_from(stores)

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

    def destroy
      @stores = Spree::Store.where(id: params[:id])

      Spree::Store.transaction { @stores.destroy_all }

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

    private

    def store_params
      params.require(:store).permit(:store_id, permitted_store_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/stores_controller.rb
solidus_admin-0.3.1 app/controllers/solidus_admin/stores_controller.rb
solidus_admin-0.3.0 app/controllers/solidus_admin/stores_controller.rb