Class: MultiValueInput

Inherits:
SimpleForm::Inputs::CollectionInput
  • Object
show all
Defined in:
app/inputs/multi_value_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/inputs/multi_value_input.rb', line 2

def input(wrapper_options)
  @rendered_first_element = false
  input_html_classes.unshift("string")
  #input_html_options[:type] ||= 'text'
  input_html_options[:name] ||= "#{object_name}[#{attribute_name}][]"
  markup = "\n\n      <ul class=\"listing\">\n  HTML\n\n  collection.each_with_index do |value, i|\n    unless value.to_s.strip.blank?\n      markup << <<-HTML\n        <li class=\"field-wrapper\">\n          \#{build_text_field(value)}\n        </li>\n      HTML\n    end\n  end\n\n  markup << <<-HTML\n        <li class=\"field-wrapper\">\n          \#{build_text_field('')}\n        </li>\n      </ul>\n\n  HTML\nend\n"