Class: Kadmin::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
app/components/kadmin/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#inverted_check_box(method, options = {}) ⇒ ActiveSupport::SafeBuffer

Creates a checkbox where the value is 0 when checked, 1 when unchecked.

Returns:

  • (ActiveSupport::SafeBuffer)

    see Kadmin::Forms::InvertedCheckBoxTag



5
6
7
# File 'app/components/kadmin/form_builder.rb', line 5

def inverted_check_box(method, options = {})
  Kadmin::FormTags::InvertedCheckBox.new(@object_name, method, @template, '0', '1', objectify_options(options)).render
end

#select2(method, choices, options = {}, html_options = {}, &block) ⇒ ActiveSupport::SafeBuffer

Creates a Select2 enabled tag, along with the necessary Javascript NOTE: Meant to be used with a Finder object in the controller

Returns:

  • (ActiveSupport::SafeBuffer)


12
13
14
15
# File 'app/components/kadmin/form_builder.rb', line 12

def select2(method, choices, options = {}, html_options = {}, &block)
  options, html_options = Kadmin::Select2.prepare_form_tag_options(options.dup, html_options.dup)
  return ActionView::Helpers::Tags::Select.new(@object_name, method, @template, choices, options, html_options, &block).render
end