input html options

This commit is contained in:
John Bintz 2012-12-10 20:47:26 -05:00
parent 83beb92d4a
commit 003229a558
1 changed files with 12 additions and 2 deletions

View File

@ -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',