Class: SimpleForm::HorizontalFormBuilder

Inherits:
DefaultFormBuilder show all
Defined in:
lib/simple_form/horizontal_form_builder.rb

Constant Summary collapse

CHECKBOX_WRAPPER =
:horizontal_checkbox
RADIO_WRAPPER =
:horizontal_radio

Instance Method Summary collapse

Methods inherited from DefaultFormBuilder

#checkbox, #input, #radio

Instance Method Details

#buttons(options = {}, &block) ⇒ Object

Raises:

  • (::ArgumentError)


6
7
8
9
10
11
12
13
14
# File 'lib/simple_form/horizontal_form_builder.rb', line 6

def buttons(options = {}, &block)
  raise ::ArgumentError unless block_given?
  options[:class] ||= 'col-sm-offset-3 col-sm-9 col-md-offset-3 col-md-9 col-lg-offset-2 col-lg-10'
  @template.(:div, class: 'form-group') do
    @template.(:div, class: options[:class]) do
      yield
    end
  end
end

#collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object



16
17
18
19
# File 'lib/simple_form/horizontal_form_builder.rb', line 16

def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
  options[:item_wrapper_class] ||= 'col-sm-offset-3 col-sm-9 col-md-offset-3 col-md-9 col-lg-offset-2 col-lg-10 checkbox'
  super
end

#collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block) ⇒ Object



21
22
23
24
# File 'lib/simple_form/horizontal_form_builder.rb', line 21

def collection_radio_buttons(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
  options[:item_wrapper_class] ||= 'col-sm-offset-3 col-sm-9 col-md-offset-3 col-md-9 col-lg-offset-2 col-lg-10 radio'
  super
end