Class: Matestack::Ui::Bootstrap::Form::Select
- Inherits:
-
Core::Form::Select::Base
- Object
- Core::Form::Select::Base
- Matestack::Ui::Bootstrap::Form::Select
- Defined in:
- app/concepts/matestack/ui/bootstrap/form/select.rb
Instance Method Summary collapse
- #form_select_class ⇒ Object
- #input_error_class ⇒ Object
- #render_errors ⇒ Object
- #render_form_text ⇒ Object
- #response ⇒ Object
- #size_class ⇒ Object
Instance Method Details
#form_select_class ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 20 def form_select_class case variant when :lg ([:class] || "") << (" form-select form-select-lg") when :sm ([:class] || "") << (" form-select form-select-sm") else ([:class] || "") << (" form-select") end end |
#input_error_class ⇒ Object
43 44 45 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 43 def input_error_class 'is-invalid' end |
#render_errors ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 35 def render_errors unless @included_config[:errors] == false && (errors == false || errors.nil?) || errors == false div class: 'invalid-feedback', attributes: { 'v-for': "error in #{error_key}" } do plain '{{ error }}' end end end |
#render_form_text ⇒ Object
47 48 49 50 51 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 47 def render_form_text div id: "form_text_for_#{attr_key}", class: "form-text" do plain form_text end end |
#response ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 9 def response div class: "matestack-ui-bootstrap-form-select" do label for: attr_key, class: "form-label", text: input_label if input_label select select_attributes.merge({ id: ([:id] || attr_key), class: form_select_class, size: size_class }) do end render_errors render_form_text end end |
#size_class ⇒ Object
31 32 33 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 31 def size_class size end |