class Matestack::Ui::VueJs::Components::Form::FieldsForAddItem

Attributes

prototype_template_json[RW]

Public Instance Methods

create_children(&block) click to toggle source
Calls superclass method
# 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
response() { || ... } click to toggle source
# 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('v-runtime-template', ':template': "nestedFormRuntimeTemplates['#{context.key}']")
  a class: 'matestack-ui-core-form-fields-for-add-item', "@click.prevent": "addItem('#{context.key}')" do
    yield if block_given?
  end
end