Class: SolidusAdmin::OptionTypesController

Inherits:
BaseController
  • Object
show all
Includes:
ControllerHelpers::Search
Defined in:
app/controllers/solidus_admin/option_types_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/option_types_controller.rb', line 30

def destroy
  @option_types = Spree::OptionType.where(id: params[:id])

  Spree::OptionType.transaction { @option_types.destroy_all }

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

#indexObject



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

def index
  option_types = apply_search_to(
    Spree::OptionType.all,
    param: :q,
  )

  set_page_and_extract_portion_from(option_types)

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

#moveObject



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

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

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