Class: Spree::Admin::TaxonsController

Inherits:
ResourceController show all
Includes:
TagsHelper, TaxonsHelper
Defined in:
app/controllers/spree/admin/taxons_controller.rb

Instance Method Summary collapse

Methods included from TagsHelper

#tags_json_array, #tags_scope, #user_tags_json_array, #user_tags_scope

Methods included from TaxonsHelper

#taxon_sort_options_for_select, #taxons_options_json_array, #taxons_scope

Methods inherited from ResourceController

belongs_to, #create, #destroy, #edit, #index, #new, #update

Methods included from TableConcern

#apply_table_sort, #custom_sort_active?, #process_table_query_state, #table, #table_key, #table_registered?

Methods included from BreadcrumbConcern

#add_breadcrumb_icon_instance_var

Instance Method Details

#repositionObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/spree/admin/taxons_controller.rb', line 32

def reposition
  authorize! :update, @taxon

  new_parent = @taxonomy.taxons.find(params.dig(:taxon, :new_parent_id))
  new_index = params.dig(:taxon, :new_position_idx).to_i

  if @taxon.move_to_child_with_index(new_parent, new_index)
    head :ok
  else
    head :unprocessable_content
  end
end

#select_optionsObject



28
29
30
# File 'app/controllers/spree/admin/taxons_controller.rb', line 28

def select_options
  render json: taxons_options_json_array(with_automatic: params[:with_automatic].to_b)
end

#showObject



24
25
26
# File 'app/controllers/spree/admin/taxons_controller.rb', line 24

def show
  redirect_to location_after_save
end