Skip to content

Instantly share code, notes, and snippets.

@johnmcaliley
Created July 18, 2011 15:47
Show Gist options
  • Save johnmcaliley/1089909 to your computer and use it in GitHub Desktop.
Save johnmcaliley/1089909 to your computer and use it in GitHub Desktop.
module Formtastic
module Inputs
module Base
module Html
def extra_html
template.content_tag(:div, Formtastic::Util.html_safe(extra_html_text),:class => (options[:extra_html_class] || 'extra-html')) if extra_html?
end
def extra_html?
extra_html_text.present? && !extra_html_text.kind_of?(Hash)
end
def extra_html_text
localized_string(method, options[:extra_html], :extra_html)
end
def extra_html_position
options[:extra_html_position] ||= 1
end
end
module Wrapping
def input_wrapping(&block)
tag_content = [template.capture(&block), error_html, hint_html]
tag_content.insert(extra_html_position,extra_html)
template.content_tag(:li, tag_content.join("\n").html_safe, wrapper_html_options)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment