有人知道如何将simple_form类从“控件”更改为“form-control”.这是Bootstrap 3中的一个变化.我知道config / initializers / simple_form.rb和config / initializers / simple_form_bootstrap.rb中有很多选项,但是我找不到我需要的.
@H_502_2@config.wrappers :bootstrap,:tag => 'div',:class => 'control-group',:error_ class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.wrapper :tag => 'div',:class => 'controls' do |ba|
ba.use :input
ba.use :error,:wrap_with => { :tag => 'span',:class => 'help-inline' }
ba.use :hint,:wrap_with => { :tag => 'p',:class => 'help-block' }
end
end
在上面你可以将’control-group’换成’form-group’,但是我看不到改变输入标签的类.
解决方法
在较新的simple_form版本中,您可以使用一个全新的全局配置:
@H_502_2@config.input_class = "form-control"
您需要宝石版本> 3.0.0,这取决于rails> 4.0.0或即将发布的2.2版本.现在可以在github上使用v2.2分支.
见https://github.com/plataformatec/simple_form/blob/v2.2/CHANGELOG.md