Sha256: fe190b30c3bfae9eda21c9f3b021edab2e16a342ba75129ebf4e2f5bb57ab734

Contents?: true

Size: 691 Bytes

Versions: 5

Compression:

Stored size: 691 Bytes

Contents

module SimpleForm
  class HorizontalFormBuilder < SimpleForm::DefaultFormBuilder
    def checkbox(attribute_name, options = {}, &block)
      options[:wrapper] ||= :horizontal_checkbox
      super
    end

    def radio(attribute_name, options = {}, &block)
      options[:wrapper] ||= :horizontal_radio
      super
    end

    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.content_tag(:div, class: 'form-group') do
        @template.content_tag(:div, class: options[:class]) do
          yield
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_form_bootstrap3-0.2.5 lib/simple_form/horizontal_form_builder.rb
simple_form_bootstrap3-0.2.4 lib/simple_form/horizontal_form_builder.rb
simple_form_bootstrap3-0.2.3 lib/simple_form/horizontal_form_builder.rb
simple_form_bootstrap3-0.2.2 lib/simple_form/horizontal_form_builder.rb
simple_form_bootstrap3-0.2.1 lib/simple_form/horizontal_form_builder.rb