Module: FormtasticRebootstrap::Inputs::Base::Html
- Includes:
- Formtastic::Inputs::Base::Html
- Included in:
- FormtasticRebootstrap::Inputs::Base
- Defined in:
- lib/formtastic_rebootstrap/inputs/base/html.rb
Instance Method Summary collapse
- #form_control_input_html_options ⇒ Object
- #input_class_without_col ⇒ Object
- #input_html_options ⇒ Object
- #original_classes ⇒ Object
Instance Method Details
#form_control_input_html_options ⇒ Object
8 9 10 11 |
# File 'lib/formtastic_rebootstrap/inputs/base/html.rb', line 8 def new_classes = input_class_without_col&.compact&.join(" ") .merge(:class => new_classes) end |
#input_class_without_col ⇒ Object
17 18 19 20 21 |
# File 'lib/formtastic_rebootstrap/inputs/base/html.rb', line 17 def input_class_without_col ['form-control'] << original_classes&.reject do |c| c.match(/^col-(sm|md|lg|xl)?-?[0-9]{1,2}/) end&.join(' ') end |
#input_html_options ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/formtastic_rebootstrap/inputs/base/html.rb', line 23 def if errors? { :class => "error" }.merge(super) else super end end |
#original_classes ⇒ Object
13 14 15 |
# File 'lib/formtastic_rebootstrap/inputs/base/html.rb', line 13 def original_classes [:class]&.split(' ')&.flatten end |