Module: SortableElementForNestedSetHelper

Defined in:
lib/sortable_element_for_nested_set_helper.rb

Defined Under Namespace

Classes: OptsGenerator

Instance Method Summary collapse

Instance Method Details

#sortable_element_reporting_target(element_id, target_param_name, options = {}) ⇒ Object



25
26
27
# File 'lib/sortable_element_for_nested_set_helper.rb', line 25

def sortable_element_reporting_target(element_id, target_param_name, options = {}) 
  javascript_tag(sortable_element_reporting_target_js(element_id, target_param_name, options) )
end

#sortable_element_reporting_target_js(element_id, target_param_name, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/sortable_element_for_nested_set_helper.rb', line 29

def sortable_element_reporting_target_js(element_id, target_param_name, options = {}) 
  raise "target_param_name is required" if target_param_name.blank?
  
  [:onChange, :with].each do |key|
    raise "#{key} is set by this helper and is not allowed" if options.has_key? key  
  end
  opts_gen = OptsGenerator.new(element_id, target_param_name)
  
  sortable_element_js(element_id, options.merge(opts_gen.opts))
end