Class: Matestack::Ui::VueJs::Components::Form::NestedForm
- Inherits:
-
Form
- Object
- Vue
- Form
- Matestack::Ui::VueJs::Components::Form::NestedForm
show all
- Defined in:
- lib/matestack/ui/vue_js/components/form/nested_form.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Form
#attributes, #for_attribute, #for_object_primary_key, #for_option, #form_method, #multipart_option
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(html_tag = nil, text = nil, options = {}, &block) ⇒ NestedForm
setup form context to allow child components like inputs to access the form configuration
Instance Attribute Details
#prototype_template ⇒ Object
Returns the value of attribute prototype_template.
11
12
13
|
# File 'lib/matestack/ui/vue_js/components/form/nested_form.rb', line 11
def prototype_template
@prototype_template
end
|
Instance Method Details
#component_id ⇒ Object
25
26
27
|
# File 'lib/matestack/ui/vue_js/components/form/nested_form.rb', line 25
def component_id
"matestack-form-fields-for-#{context.fields_for}-#{SecureRandom.hex}"
end
|
44
45
46
|
# File 'lib/matestack/ui/vue_js/components/form/nested_form.rb', line 44
def is_nested_form?
true
end
|
#parent_form_context ⇒ Object
48
49
50
|
# File 'lib/matestack/ui/vue_js/components/form/nested_form.rb', line 48
def parent_form_context
@parent_form_context
end
|
#response ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/matestack/ui/vue_js/components/form/nested_form.rb', line 29
def response
div class: "matestack-form-fields-for", "v-show": "vc.hideNestedForm != true", id: options[:id] do
form_input key: context.for&.class&.primary_key, type: :hidden form_input key: :_destroy, type: :hidden, init: true if context.reject_blank == true
yield
end
end
|
#vue_props ⇒ Object
37
38
39
40
41
42
|
# File 'lib/matestack/ui/vue_js/components/form/nested_form.rb', line 37
def vue_props
super.merge({
fields_for: ctx.fields_for,
primary_key: for_object_primary_key
})
end
|