Class: SolidusAdmin::TaxonomiesController

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

Instance Method Summary collapse

Methods included from ComponentsHelper

#component

Instance Method Details

#destroyObject



30
31
32
33
34
35
36
37
# File 'app/controllers/solidus_admin/taxonomies_controller.rb', line 30

def destroy
  @taxonomies = Spree::Taxonomy.where(id: params[:id])

  Spree::Taxonomy.transaction { @taxonomies.destroy_all }

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

#indexObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/solidus_admin/taxonomies_controller.rb', line 9

def index
  taxonomies = apply_search_to(
    Spree::Taxonomy.all,
    param: :q,
  )

  set_page_and_extract_portion_from(taxonomies)

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

#moveObject



22
23
24
25
26
27
28
# File 'app/controllers/solidus_admin/taxonomies_controller.rb', line 22

def move
  @taxonomy.insert_at(params[:position].to_i)

  respond_to do |format|
    format.js { head :no_content }
  end
end