Class: Matestack::Ui::Bootstrap::Form::Select
- Inherits:
-
VueJs::Components::Form::Select
- Object
- VueJs::Components::Form::Select
- Matestack::Ui::Bootstrap::Form::Select
- Defined in:
- lib/matestack/ui/bootstrap/form/select.rb
Instance Method Summary collapse
- #bootstrap_select_attributes ⇒ Object
- #form_select_class ⇒ Object
- #input_error_class ⇒ Object
- #render_errors ⇒ Object
- #render_form_text ⇒ Object
- #response ⇒ Object
- #size_class ⇒ Object
Instance Method Details
#bootstrap_select_attributes ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/matestack/ui/bootstrap/form/select.rb', line 20 def bootstrap_select_attributes { class: form_select_class, size: size_class, disabled: context.disabled } end |
#form_select_class ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/matestack/ui/bootstrap/form/select.rb', line 28 def form_select_class case context.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
51 52 53 |
# File 'lib/matestack/ui/bootstrap/form/select.rb', line 51 def input_error_class 'is-invalid' end |
#render_errors ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/matestack/ui/bootstrap/form/select.rb', line 43 def render_errors if display_errors? div class: 'invalid-feedback', 'v-for': "error in #{error_key}" do plain '{{ error }}' end end end |
#render_form_text ⇒ Object
55 56 57 58 59 |
# File 'lib/matestack/ui/bootstrap/form/select.rb', line 55 def render_form_text div class: "form-text form-text-for-#{attribute_key}" do plain context.form_text end end |
#response ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/matestack/ui/bootstrap/form/select.rb', line 9 def response div class: "matestack-ui-bootstrap-form-select" do label input_label, ":for": id, class: "form-label" if input_label select select_attributes.merge(bootstrap_select_attributes) do end render_errors render_form_text end end |
#size_class ⇒ Object
39 40 41 |
# File 'lib/matestack/ui/bootstrap/form/select.rb', line 39 def size_class context.size end |