Skip to content

Commit

Permalink
buttons inherit structure option
Browse files Browse the repository at this point in the history
  • Loading branch information
linojon committed Apr 15, 2010
1 parent 26caf26 commit 82c0b05
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/formtastic.rb
Expand Up @@ -282,12 +282,8 @@ def inputs(*args, &block)
html_options = args.extract_options!
html_options[:class] ||= "inputs"
html_options[:name] = title
save_structure = @structure #push
if html_options[:structure]
@structure = html_options.delete(:structure)
end

ret = if html_options[:for] # Nested form
if html_options[:for] # Nested form
inputs_for_nested_attributes(*(args << html_options), &block)
elsif block_given?
field_set_and_list_wrapping(*(args << html_options), &block)
Expand All @@ -304,8 +300,6 @@ def inputs(*args, &block)

field_set_and_list_wrapping(*((args << html_options) << contents))
end
@structure = save_structure #pop
ret
end
alias :input_field_set :inputs

Expand Down Expand Up @@ -1327,7 +1321,11 @@ def required_or_optional_string(required) #:nodoc:
def field_set_and_list_wrapping(*args, &block) #:nodoc:
contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten
options = args.extract_options!
html_options = options.except(:builder, :parent, :structure, :partial) #is there a better way to remove render-specific options?
save_structure = @structure #push
if options[:structure]
@structure = options.delete(:structure)
end
html_options = options.except(:builder, :parent, :partial) #is there a better way to remove render-specific options?
legend = options[:name].to_s
legend %= parent_child_index(options[:parent]) if options[:parent]

Expand All @@ -1347,6 +1345,8 @@ def field_set_and_list_wrapping(*args, &block) #:nodoc:
:structure => @structure
})

@structure = save_structure #pop

template.concat(fieldset) if block_given?
fieldset
end
Expand Down

0 comments on commit 82c0b05

Please sign in to comment.