Module: BootstrapForm::Helpers::Bootstrap4

Defined in:
lib/bootstrap_form/helpers/bootstrap4.rb

Instance Method Summary collapse

Instance Method Details

#prepend_and_append_input(name, options, &block) ⇒ Object

TODO check upstream - append tag options



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bootstrap_form/helpers/bootstrap4.rb', line 12

def prepend_and_append_input(name, options, &block)
  options = options.extract!(:prepend, :append, :input_group_class, :append_tag, :input_group)
  input_group_class = ["input-group", options[:input_group_class]].compact.join(' ')

  input = capture(&block) || "".html_safe

  input = (:div, input_group_content(options[:prepend]), class: 'input-group-prepend') + input if options[:prepend]
  input << (:div, input_group_content(options[:append]), (options[:append_tag] || {}).merge(class: 'input-group-append')) if options[:append]
  input << generate_error(name)
  input = (:div, input, (options[:input_group] || {}).merge(class: input_group_class)) unless options.empty?
  input
end

#submit(name = nil, options = {}) ⇒ Object



5
6
7
8
# File 'lib/bootstrap_form/helpers/bootstrap4.rb', line 5

def submit(name = nil, options = {})
  options.reverse_merge! class: 'btn btn-secondary'
  super(name, options)
end