From 003229a5587f28b84317f9f82757c93c7edc9a6b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 10 Dec 2012 20:47:26 -0500 Subject: [PATCH] input html options --- lib/cocoon/formtastic/cocoon_input.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/cocoon/formtastic/cocoon_input.rb b/lib/cocoon/formtastic/cocoon_input.rb index e9160d7..1ee1c81 100644 --- a/lib/cocoon/formtastic/cocoon_input.rb +++ b/lib/cocoon/formtastic/cocoon_input.rb @@ -4,11 +4,17 @@ class CocoonInput include ::Formtastic::Inputs::Base def to_html - output = label_html << wrapped_semantic_fields << links + wrap_output(output) + end + def wrap_output(output) template.content_tag(:li, output.html_safe, wrapper_html_options) end + def output + label_html << wrapped_semantic_fields << links + end + def wrapper_html_options data = super.merge(:class => 'input cocoon') if options[:ordered_by] @@ -32,10 +38,14 @@ class CocoonInput def links template.content_tag(:div, :class => 'links') do - template.link_to_add_association template.t(".add_#{singular_method}"), builder, method, input_html_options + template.link_to_add_association template.t(".add_#{singular_method}"), builder, method, add_association_input_html_options end end + def add_association_input_html_options + input_html_options + end + def input_html_options super.merge( 'data-association-insertion-node' => '.forms',