Class: NestedSelectInput

Inherits:
Formtastic::Inputs::StringInput
  • Object
show all
Defined in:
app/inputs/nested_select_input.rb

Instance Method Summary collapse

Instance Method Details

#to_htmlObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/inputs/nested_select_input.rb', line 2

def to_html
  html_elems = []

  for_each_level do |level_data|
    a = level_data[:attribute]
    set_parent_value(level_data)
    html_elems << builder.text_field(a, select_html_options(level_data))
    html_elems << builder.label(a, translated_attribute(a))
  end

  input_wrapping do
    html_elems.reverse.join("\n").html_safe
  end
end