Sha256: cc0e1cb0a1a28665f4514445325993a73ab12634d133d5c7c6758787ae0f2668

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 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' too, so remove the
            # one that gets created by Formtastic.
            options[:class] = options[:class].reject { |c| c == 'label' }
            options[:class] << " control-label"
          end
        end

        # def control_label_html
        def label_html
          if render_label?
            template.content_tag(:span, :class => 'form-label') do
              builder.label(input_name, label_text, label_html_options)
            end
          else
            "".html_safe
          end
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formtastic-bootstrap-3.1.1 lib/formtastic-bootstrap/inputs/base/labelling.rb
formtastic-bootstrap-3.1.0 lib/formtastic-bootstrap/inputs/base/labelling.rb