Sha256: 74cec011e7bd2abcc780a247522596158781c71d8e8d658332bcc7110910bbf5
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
module FormtasticBootstrap module Helpers module FieldsetWrapper include Formtastic::Helpers::FieldsetWrapper protected def field_set_and_list_wrapping(*args, &block) #:nodoc: contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten html_options = args.extract_options! if block_given? contents = if template.respond_to?(:is_haml?) && template.is_haml? template.capture_haml(&block) else template.capture(&block) end end # Ruby 1.9: String#to_s behavior changed, need to make an explicit join. contents = contents.join if contents.respond_to?(:join) legend = field_set_legend(html_options) fieldset = template.content_tag(:fieldset, Formtastic::Util.html_safe(legend) << Formtastic::Util.html_safe(contents), html_options.except(:builder, :parent, :name) ) fieldset end def field_set_legend(html_options) legend = (html_options[:name] || '').to_s legend %= parent_child_index(html_options[:parent]) if html_options[:parent] legend = template.content_tag(:legend, Formtastic::Util.html_safe(legend)) unless legend.blank? legend end end end end
Version data entries
3 entries across 3 versions & 1 rubygems