Sha256: aab1fd99329361e8affdeaf8a764a7704e7b9d188c2970f107e137a382f5f9f4

Contents?: true

Size: 741 Bytes

Versions: 4

Compression:

Stored size: 741 Bytes

Contents

module FormtasticBootstrap
  module Inputs
    module Base
      module Labelling

        include Formtastic::Inputs::Base::Labelling

        def label_html_options
          super.tap do |options|
            # Bootstrap defines class 'label'
            options[:class] = options[:class].reject { |c| c == 'label' }
            # options[:class] << "control-label"
          end
        end
        
        def control_label_html_options
          label_html_options.tap do |options|
            options[:class] << "control-label"
          end
        end

        def control_label_html
          render_label? ? builder.label(input_name, label_text, control_label_html_options) : "".html_safe
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
formtastic-bootstrap-2.1.3 lib/formtastic-bootstrap/inputs/base/labelling.rb
formtastic-bootstrap-2.1.2 lib/formtastic-bootstrap/inputs/base/labelling.rb
formtastic-bootstrap-2.1.1 lib/formtastic-bootstrap/inputs/base/labelling.rb
formtastic-bootstrap-2.0.0 lib/formtastic-bootstrap/inputs/base/labelling.rb