From 6d85276a4e40dc5cf6c9da9ec18abc8fc74d19c2 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 27 Nov 2012 10:17:53 -0500 Subject: [PATCH] add cocoon wrapper --- lib/cocoon/view_helpers.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cocoon/view_helpers.rb b/lib/cocoon/view_helpers.rb index c059263..3309aad 100644 --- a/lib/cocoon/view_helpers.rb +++ b/lib/cocoon/view_helpers.rb @@ -100,6 +100,14 @@ module Cocoon partial ? partial : association.to_s.singularize + "_fields" end + def cocoon_wrapper(form_builder, &block) + content_tag(:div, :class => 'nested-fields') do + content_tag(:fieldset) do + capture(&block) << link_to_remove_association(t('.remove'), form_builder) + end + end + end + private def create_object_on_non_association(f, association)