Sha256: ce2fff1191c09cd2be699bd3bd9999d7a635abbdb1002a125ad78602396fce2e

Contents?: true

Size: 987 Bytes

Versions: 4

Compression:

Stored size: 987 Bytes

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

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
formtastic-bootstrap-2.1.3 lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb
formtastic-bootstrap-2.1.2 lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb
formtastic-bootstrap-2.1.1 lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb
formtastic-bootstrap-2.0.0 lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb