Sha256: 13a2c247a7c9676fea5adaf42d692d1cb8e72580a6475abb7416ac2a0183743d
Contents?: true
Size: 779 Bytes
Versions: 3
Compression:
Stored size: 779 Bytes
Contents
module EtabliocmsCore module Admin module NestedFieldsHelper def link_to_add_fields(name, f, association, target, options = {}) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :builder => builder) end link_to_function(name, "Admin.addFields('#{target}', '#{escape_javascript(fields)}', '#{association}')", options).html_safe end def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "Admin.hideAndDestroyFields(this)") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems