Sha256: ed75002445b967c9dfab3e3a447918688dbedb0c6abfd8e3abc95a66993ba174

Contents?: true

Size: 984 Bytes

Versions: 2

Compression:

Stored size: 984 Bytes

Contents

module FormtasticRebootstrap
  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

2 entries across 2 versions & 1 rubygems

Version Path
formtastic_rebootstrap-0.0.2 lib/formtastic_rebootstrap/helpers/fieldset_wrapper.rb
formtastic_rebootstrap-0.0.1 lib/formtastic_rebootstrap/helpers/fieldset_wrapper.rb