Module: FormtasticRebootstrap::Inputs::Base::Labelling
- Includes:
- Formtastic::Inputs::Base::Labelling
- Included in:
- FormtasticRebootstrap::Inputs::Base
- Defined in:
- lib/formtastic_rebootstrap/inputs/base/labelling.rb
Instance Method Summary collapse
- #label_class_with_col ⇒ Object
-
#label_html ⇒ Object
def control_label_html.
- #label_html_options ⇒ Object
- #layout_classes ⇒ Object
Instance Method Details
#label_class_with_col ⇒ Object
32 33 34 35 36 |
# File 'lib/formtastic_rebootstrap/inputs/base/labelling.rb', line 32 def label_class_with_col ['col-md-3 form-label col-form-label'] << .dig(:label_html, :class)&.split(' ')&.select do |c| c.match(/^col-(sm|md|lg|xl)?-?[0-9]{1,2}/) end end |
#label_html ⇒ Object
def control_label_html
18 19 20 21 22 23 24 25 26 |
# 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, ) end else "".html_safe end end |
#label_html_options ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/formtastic_rebootstrap/inputs/base/labelling.rb', line 8 def super.tap do || # Bootstrap defines class 'label' too, so remove the # one that gets created by Formtastic. [:class] = [:class].reject { |c| c == 'label' } [:class] << "control-label" end end |
#layout_classes ⇒ Object
28 29 30 |
# File 'lib/formtastic_rebootstrap/inputs/base/labelling.rb', line 28 def layout_classes end |