Update the Wrappers API

This commit is contained in:
Rafael Mendonça França 2012-02-16 12:07:46 -02:00
parent 20955a39c4
commit c8b6ec5204
2 changed files with 8 additions and 8 deletions

View File

@ -165,8 +165,8 @@ module SimpleForm
b.optional :readonly b.optional :readonly
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
## SETUP ## SETUP

View File

@ -35,22 +35,22 @@ module MiscHelpers
def custom_wrapper def custom_wrapper
SimpleForm.build :tag => :section, :class => "custom_wrapper", :pattern => false do |b| SimpleForm.build :tag => :section, :class => "custom_wrapper", :pattern => false do |b|
b.use :pattern b.use :pattern
b.use :another, :class => "another_wrapper" do |ba| b.wrapper :another, :class => "another_wrapper" do |ba|
ba.use :label ba.use :label
ba.use :input ba.use :input
end end
b.use :error_wrapper, :tag => :div, :class => "error_wrapper" do |be| b.wrapper :error_wrapper, :tag => :div, :class => "error_wrapper" do |be|
be.use :error, :tag => :span, :class => "omg_error" be.use :error, :wrap_with => { :tag => :span, :class => "omg_error" }
end end
b.use :hint, :tag => :span, :class => "omg_hint" b.use :hint, :wrap_with => { :tag => :span, :class => "omg_hint" }
end end
end end
def custom_wrapper_without_top_level def custom_wrapper_without_top_level
SimpleForm.build :tag => false, :class => 'custom_wrapper_without_top_level' do |b| SimpleForm.build :tag => false, :class => 'custom_wrapper_without_top_level' do |b|
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
end end