Class: Matestack::Ui::VueJs::Components::Form::FieldsForAddItem

Inherits:
Vue
  • Object
show all
Defined in:
lib/matestack/ui/vue_js/components/form/fields_for_add_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Vue

#base_vue_props, #component_attributes, #component_id, #component_uid, inherited, #initialize, #matestack_ui_vuejs_ref, #vue_component, vue_name, #vue_name, #vue_props

Constructor Details

This class inherits a constructor from Matestack::Ui::VueJs::Vue

Instance Attribute Details

#prototype_template_jsonObject

Returns the value of attribute prototype_template_json.



12
13
14
# File 'lib/matestack/ui/vue_js/components/form/fields_for_add_item.rb', line 12

def prototype_template_json
  @prototype_template_json
end

Instance Method Details

#create_children(&block) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/matestack/ui/vue_js/components/form/fields_for_add_item.rb', line 14

def create_children(&block)
  # first render prototype_template_json
  self.prototype_template_json = context.prototype.call().to_json
  # delete from children in order not to render the prototype
  self.children.shift
  super
end

#responseObject



22
23
24
25
26
27
28
# File 'lib/matestack/ui/vue_js/components/form/fields_for_add_item.rb', line 22

def response
  div id: "prototype-template-for-#{context.key}", "v-pre": true, data: { ":template":  self.prototype_template_json }
  Matestack::Ui::Core::Base.new('matestack-ui-core-runtime-render', ':template': "vc.parentNestedFormRuntimeTemplates['#{context.key}']", ':vc': 'vc')
  a class: 'matestack-ui-core-form-fields-for-add-item', "@click.prevent": "vc.addItem('#{context.key}')" do
    yield if block_given?
  end
end