Update the Wrappers API in the generator

This commit is contained in:
Rafael Mendonça França 2012-02-16 12:12:45 -02:00
parent c8b6ec5204
commit b2ffbc18a2
1 changed files with 16 additions and 16 deletions

View File

@ -41,41 +41,41 @@ SimpleForm.setup do |config|
## Inputs ## Inputs
b.use :label_input b.use :label_input
b.use :hint, :tag => :span, :class => :hint b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
b.use :error, :tag => :span, :class => :error b.use :error, :wrap_with => { :tag => :span, :class => :error }
end end
<% if options.bootstrap? %> <% if options.bootstrap? %>
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b| config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
b.use :placeholder b.use :placeholder
b.use :label, :class => 'control-label' b.use :label, :wrap_with => { :class => 'control-label' }
b.use :tag => 'div', :class => 'controls' do |ba| b.wrapper :tag => 'div', :class => 'controls' do |ba|
ba.use :input ba.use :input
ba.use :error, :tag => 'span', :class => 'help-inline' ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
ba.use :hint, :tag => 'p', :class => 'help-block' ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end end
end end
config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b| config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
b.use :placeholder b.use :placeholder
b.use :label, :class => 'control-label' b.use :label, :wrap_with => { :class => 'control-label' }
b.use :tag => 'div', :class => 'controls' do |input| b.wrapper :tag => 'div', :class => 'controls' do |input|
input.use :tag => 'div', :class => 'input-prepend' do |prepend| input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
prepend.use :input prepend.use :input
end end
input.use :hint, :tag => 'span', :class => 'help-block' input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
input.use :error, :tag => 'span', :class => 'help-inline' input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
end end
end end
config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b| config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
b.use :placeholder b.use :placeholder
b.use :label, :class => 'control-label' b.use :label, :wrap_with => { :class => 'control-label' }
b.use :tag => 'div', :class => 'controls' do |input| b.wrapper :tag => 'div', :class => 'controls' do |input|
input.use :tag => 'div', :class => 'input-append' do |append| input.wrapper :tag => 'div', :class => 'input-append' do |append|
append.use :input append.use :input
end end
input.use :hint, :tag => 'span', :class => 'help-block' input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
input.use :error, :tag => 'span', :class => 'help-inline' input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
end end
end end