Class: Matestack::Ui::Bootstrap::Form::Select
- Inherits:
-
Core::Form::Select::Select
- Object
- Core::Form::Select::Select
- Matestack::Ui::Bootstrap::Form::Select
- Defined in:
- app/concepts/matestack/ui/bootstrap/form/select.rb
Instance Method Summary collapse
- #determine_init_value ⇒ Object
- #form_select_class ⇒ Object
- #input_error_class ⇒ Object
- #placeholder_value ⇒ Object
- #render_errors ⇒ Object
- #render_form_text ⇒ Object
- #size_class ⇒ Object
- #vue_attributes ⇒ Object
Instance Method Details
#determine_init_value ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 36 def determine_init_value if init_value init_value else if multiple [] else nil end end end |
#form_select_class ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 21 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
64 65 66 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 64 def input_error_class 'is-invalid' end |
#placeholder_value ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 48 def placeholder_value if multiple '[]' else 'null' end end |
#render_errors ⇒ Object
56 57 58 59 60 61 62 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 56 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
68 69 70 71 72 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 68 def render_form_text div id: "form_text_for_#{attr_key}", class: "form-text" do plain form_text end end |
#size_class ⇒ Object
32 33 34 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 32 def size_class size end |
#vue_attributes ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/concepts/matestack/ui/bootstrap/form/select.rb', line 7 def vue_attributes ([:attributes] || {}).merge({ "@change": change_event, ref: vue_ref, 'init-value': determine_init_value, 'v-bind:class': "{ '#{input_error_class}': #{error_key} }", 'value-type': value_type, 'class': form_select_class, 'size': size_class, 'id': attr_key, "#{v_model_type}": input_key, }) end |