Sha256: bdb38d13d261cf3470a4b38cfd5f14fc49b7ee59c8ad7486599c71acfdf865cc

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

module FormtasticBootstrap
  module Inputs
    module Base
      module Choices

        def input_div_wrapping(&block)
          template.content_tag(:div, choices_wrapping_html_options) do
            [yield, error_html(:block), hint_html(:block)].join("\n").html_safe
          end
        end

        def choices_wrapping_html_options
          new_class = [super[:class], "controls"].compact.join(" ")
          super.merge(:class => new_class)
        end

        #def choices_group_wrapping(&block)
        #  template.content_tag(:ul,
        #    template.capture(&block),
        #    choices_group_wrapping_html_options
        #  )
        #end

        # This is actually a label in Bootstrap.
        def legend_html
          template.content_tag(:label, control_label_html_options) do
            render_label? ? label_text : "".html_safe
          end
        end

        def control_label_html_options
          super.merge(:for => nil)
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
speedo-formstrap-1.2.9 lib/formtastic-bootstrap/inputs/base/choices.rb
speedo-formstrap-1.2.8 lib/formtastic-bootstrap/inputs/base/choices.rb
speedo-formstrap-1.2.0 lib/formtastic-bootstrap/inputs/base/choices.rb