Sha256: 5294f8f05fb4cfdf4c7271c76f76ab750e24ce42152c7c7bd48fbe7c658d69bd
Contents?: true
Size: 762 Bytes
Versions: 10
Compression:
Stored size: 762 Bytes
Contents
module Components module Lolita module ConfigurationComponent def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to(name, '#', onclick: 'remove_fields(this); return false;') end def link_to_add_fields(name, f, nested_form) new_object = nested_form.klass.new fields_content = '' f.fields_for(nested_form.name, new_object, child_index: "new_#{nested_form.name}") do |builder| current_form(builder) do fields_content = render_component(nested_form, :"fields") end end link_to(name, '', class: 'pointer', onclick: "add_fields(this, \"#{nested_form.name}\", \"#{escape_javascript(fields_content)}\"); return false;") end end end end
Version data entries
10 entries across 10 versions & 1 rubygems