在新的twitter gem ( 2.0.0 )中,有一个simple_form的包装器。但我更喜欢使用zurb-foundation。所以我试着创建这个包装器。
有人对创建包装器有什么建议吗?
发布于 2012-10-21 04:14:31
您需要在/config/initializers/simple_form.rb中更改以下行:
config.wrappers :default, :class => :input,
:hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
...
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
b.use :error, :wrap_with => { :tag => :span, :class => :error }
...
config.error_notification_class = 'alert alert-error'为
config.wrappers :default, :class => :input,
:hint_class => :field_with_hint, :error_class => :errors do |b|
...
b.use :error, :wrap_with => { :tag => :small }
...
# delete hint
config.error_notification_class = 'alert-box alert'您可以看到diff here。
发布于 2012-02-23 01:07:08
这个wiki entry让你离得很近。然后,您可以编辑按钮类和error类以匹配simple_form的类结构。
https://stackoverflow.com/questions/9397809
复制相似问题