4

在新的 simple_form gem ( 2.0.0 ) 中,有一个 twitter 包装器。但我更喜欢使用 zurb-foundation。所以我尝试创建这个包装器。

任何人都有一些输入来创建包装器?

4

2 回答 2

4

您需要更改以下行/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'

你可以在这里看到差异

于 2012-10-20T20:14:30.650 回答
3

这个wiki 条目让你接近。然后您可以编辑按钮类和错误类以匹配 simple_form 的类结构。

于 2012-02-22T17:07:07.520 回答