Class: RepeaterInput

Inherits:
SimpleForm::Inputs::TextInput
  • Object
show all
Defined in:
app/inputs/repeater_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



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

def input(wrapper_options = nil)
  merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)

  content = ActiveSupport::SafeBuffer.new
  content << '<div class="repeater__group-wrapper">'.html_safe
  content << repeater_group_fields(options)
  content << '</div>'.html_safe
  content << (:div, "Add #{attribute_name.to_s.humanize.downcase}", class: 'repeater__add-item-button btn btn-default')
  content << (:div, '', class: 'repeater__template', data: { template: repeater_group_fields(as_template: true) })
  content
end