module FormtasticRebootstrap::Inputs::Base::Labelling

Public Instance Methods

label_class_with_col() click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/labelling.rb, line 32
def label_class_with_col
  ['col-md-3 form-label col-form-label'] <<  options.dig(:label_html, :class)&.split(' ')&.select do |c|
    c.match(/^col-(sm|md|lg|xl)?-?[0-9]{1,2}/)
  end
end
label_html() click to toggle source

def control_label_html

# File lib/formtastic_rebootstrap/inputs/base/labelling.rb, line 18
def label_html
  if render_label?
    template.content_tag(:span, :class => label_class_with_col) do
      builder.label(input_name, label_text, label_html_options)
    end
  else
    "".html_safe
  end
end
label_html_options() click to toggle source
Calls superclass method
# File lib/formtastic_rebootstrap/inputs/base/labelling.rb, line 8
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
layout_classes() click to toggle source
# File lib/formtastic_rebootstrap/inputs/base/labelling.rb, line 28
def layout_classes

end