Class: Matestack::Ui::Bootstrap::Form::Date
- Inherits:
-
Core::Component::Dynamic
- Object
- Core::Component::Dynamic
- Matestack::Ui::Bootstrap::Form::Date
- Includes:
- Core::Form::HasErrors, Core::Form::HasInputHtmlAttributes, Core::Form::Utils
- Defined in:
- app/concepts/matestack/ui/bootstrap/form/date.rb
Instance Method Summary collapse
- #attr_key ⇒ Object
- #change_event ⇒ Object
- #custom_options_validation ⇒ Object
- #error_key ⇒ Object
- #input_key ⇒ Object
- #response ⇒ Object
- #setup ⇒ Object
- #vue_attributes ⇒ Object
Instance Method Details
#attr_key ⇒ Object
59 60 61 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 59 def attr_key super end |
#change_event ⇒ Object
51 52 53 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 51 def change_event "$parent.inputChanged('#{attr_key}');".strip end |
#custom_options_validation ⇒ Object
55 56 57 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 55 def raise "included form config is missing, please add ':include' to parent form component" if @included_config.nil? end |
#error_key ⇒ Object
22 23 24 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 22 def error_key "$parent.errors[\"#{key}\"]" end |
#input_key ⇒ Object
18 19 20 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 18 def input_key "$parent.data[\"#{key}\"]" end |
#response ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 31 def response div do label for: attr_key, class: "form-label", text: input_label if input_label input html_attributes.merge(attributes: vue_attributes).merge(bootstrap_input_attributes) render_errors render_form_text if form_text end end |
#setup ⇒ Object
26 27 28 29 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 26 def setup @component_config[:init_value] = init_value @component_config[:with_time] = with_time end |
#vue_attributes ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'app/concepts/matestack/ui/bootstrap/form/date.rb', line 40 def vue_attributes ([:attributes] || {}).merge({ id: attr_key, "@change": change_event, ref: "input.#{attr_key}", 'init-value': init_value, 'v-bind:class': "{ '#{input_error_class}': #{error_key} }", "aria-describedby": attr_key }).merge({ "v-model": input_key }) end |