Class: Matestack::Ui::VueJs::Components::Form::Input
- Inherits:
-
Base
- Object
- Vue
- Base
- Matestack::Ui::VueJs::Components::Form::Input
show all
- Defined in:
- lib/matestack/ui/vue_js/components/form/input.rb
Instance Method Summary
collapse
Methods inherited from Base
#attribute_key, #attributes, #change_event, #component_attributes, #display_errors?, #error_class, #error_config, #error_key, #error_tag, #form_context, #get_from_error_config, #id, #init, #input_error_class, #input_key, #input_label, #key, #multiple, #name, #placeholder, #render_errors, #type, #v_model_type, #value_type, #wrapper_error_class, #wrapper_tag
Methods inherited from Vue
#base_vue_props, #component_attributes, #component_uid, #create_children, inherited, #matestack_ui_vuejs_ref, #vue_component, vue_name, #vue_name
Constructor Details
#initialize ⇒ Input
Returns a new instance of Input.
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/matestack/ui/vue_js/components/form/input.rb', line 9
def initialize(*)
super
if ctx.type.to_s == "file"
if !form_context.is_nested_form? && form_context.multipart_option != true
raise "File Upload requires `multipart: true` in Form Config"
end
if form_context.is_nested_form? && form_context.parent_form_context.multipart_option != true
raise "File Upload requires `multipart: true` in Form Config"
end
end
end
|
Instance Method Details
#component_id ⇒ Object
29
30
31
|
# File 'lib/matestack/ui/vue_js/components/form/input.rb', line 29
def component_id
"input-component-for-#{attribute_key}"
end
|
#init_value ⇒ Object
37
38
39
40
|
# File 'lib/matestack/ui/vue_js/components/form/input.rb', line 37
def init_value
return nil if ctx.type.to_s == "file"
super
end
|
33
34
35
|
# File 'lib/matestack/ui/vue_js/components/form/input.rb', line 33
def input_attributes
attributes
end
|
#response ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/matestack/ui/vue_js/components/form/input.rb', line 21
def response
div class: 'matestack-ui-core-form-input' do
label input_label, ":for": id if input_label
input input_attributes
render_errors
end
end
|
#vue_props ⇒ Object
42
43
44
45
46
47
|
# File 'lib/matestack/ui/vue_js/components/form/input.rb', line 42
def vue_props
{
init_value: init_value,
key: key,
}
end
|