Class: RenderNestedOptionsHelper::Render

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/render_nested_options_helper.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.hObject

Returns the value of attribute h.



4
5
6
# File 'app/helpers/render_nested_options_helper.rb', line 4

def h
  @h
end

.optionsObject

Returns the value of attribute options.



4
5
6
# File 'app/helpers/render_nested_options_helper.rb', line 4

def options
  @options
end

Class Method Details

.render_node(h, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/render_nested_options_helper.rb', line 6

def render_node(h, options)
  @h, @options = h, options

  node = options[:node]

  this_node      = options[:selected] == node
  selected_class = this_node ? ' selected' : nil
  selected       = this_node ? " selected='selected'" : nil

  "
  <option value='#{node[:id]}' class='l_#{ options[:level] }#{selected_class}' #{selected}>#{ node.send(options[:title]) }</option>
  #{ options[:children] }
  "
end