Sha256: 3dd97299dce91ff394ef41aa10a71cc51b04491801eb77830a9d086c123e1a7a
Contents?: true
Size: 728 Bytes
Versions: 22
Compression:
Stored size: 728 Bytes
Contents
module Components module Lolita module ConfigurationComponent def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)") end def link_to_add_fields(name, f, nested_form) new_object = nested_form.klass.new fields_content = "" fields = f.fields_for(nested_form.name, new_object, :child_index => "new_#{nested_form.name}") do |builder| self.current_form(builder) do fields_content = render_component(nested_form, :"fields") end end link_to_function(name, "add_fields(this, \"#{nested_form.name}\", \"#{escape_javascript(fields_content)}\")") end end end end
Version data entries
22 entries across 22 versions & 1 rubygems