我正在使用 SimpleForm + Bootstrap。如何type="text"
使用 class = 向所有输入添加属性span12
?
输出类似这样的东西:
<div class="controls"><input autofocus="autofocus" class="string required span12" id="user_first_name" name="user[first_name]" required="required" size="50" type="text" value=""></div>
我试过玩config.wrappers
但是这个
ba.use :input, :wrap_with => { :class => 'span12' }
不起作用。它添加到包装器而不是修改输入标签。有什么想法吗?
SimpleForm.setup do |config|
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
config.default_wrapper = :bootstrap
end