Class: SolidusAdmin::StoresController

Inherits:
BaseController
  • Object
show all
Includes:
ControllerHelpers::Search
Defined in:
app/controllers/solidus_admin/stores_controller.rb

Instance Method Summary collapse

Methods included from ComponentsHelper

#component

Instance Method Details

#destroyObject



20
21
22
23
24
25
26
27
# File 'app/controllers/solidus_admin/stores_controller.rb', line 20

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

#indexObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/solidus_admin/stores_controller.rb', line 7

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