module Storefront class Form class Fieldset < Storefront::Form::Base attr_reader :builder def initialize(options = {}) super @label = localize(:titles, options[:label], nil, (attributes[:locale_options] || {}).merge(:allow_blank => true)) if options[:label].present? merge_class! attributes, *[ config.fieldset_class ] attributes[:id] ||= label.underscore.strip.gsub(/[_\s]+/, config.separator) if label.present? attributes.delete(:index) attributes.delete(:parent_index) attributes.delete(:label) @builder = Storefront::Form::Builder.new( :template => template, :model => model, :attribute => attribute, :index => index, :parent_index => parent_index ) end # form.inputs :basic_info, :locale_options => {:count => 1, :past => true} def render(&block) template.capture_haml do template.haml_tag :fieldset, attributes do template.haml_tag :legend, :class => config.legend_class do template.haml_tag :span, label end if label.present? template.haml_tag config.field_list_tag, :class => config.list_class do builder.render(&block) end end end end end end end