Skip to content

Commit

Permalink
Merge pull request stouset#25 from derekprior/0ff570204452691d0fac49d…
Browse files Browse the repository at this point in the history
…19348d392351e4c77

Added inline_inputs builder method
  • Loading branch information
stouset committed Nov 15, 2011
2 parents 609807a + 0ff5702 commit baeef0e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/twitter_bootstrap_form_for/form_builder.rb
Expand Up @@ -64,6 +64,20 @@ def submit(value = nil, options = {})
super value, options
end

#
# Creates bootstrap wrapping before yielding a plain old rails builder
# to the supplied block.
#
def inline_inputs(label = nil)
template.content_tag(:div, :class => 'clearfix') do
template.concat template.content_tag(:label, label)
template.concat template.content_tag(:div, :class => "input") {
inline_options = @options.merge(:builder => ActionView::Helpers::FormBuilder)
yield(ActionView::Helpers::FormBuilder.new @object_name, @object, @template, inline_options, @proc) if block_given?
}
end
end

INPUTS.each do |input|
define_method input do |attribute, *args, &block|
options = args.extract_options!
Expand Down

0 comments on commit baeef0e

Please sign in to comment.