我使用simple_form 2.0和twitter bootstrap。使用Twitter Bootstrap和Simple Form 2.0在单行上输入多个输入
我试图确定什么是为了得到类似的适当的封装格式 [城市] [状态] [邮编]
我相信我的形式必须是
<div class="control-group">
<%= f.input :city,:wrapper => :small, :placeholder => "City", :input_html => { :class=>"span2", :maxlength => 10},:label => false %>
<%= f.input :region, :wrapper => :small , :placeholder => "Region", :input_html => { :class=>"span1", :maxlength => 5}, :label => false %>
<%= f.input :postal_code, :wrapper => :small, :placeholder => "Postal Code",:input_html => { :class=>"span2", :maxlength => 10},:label => false %>
</div>
我尝试这种包装
config.wrappers :small, :tag => 'div', :class => 'controls inline-inputs', :error_class => 'error' do |b|
b.use :placeholder
b.use :label_input
end
我相信我会需要定义CSS为好,但在此之前我下去我想到了一个兔子洞,我会问,如果这是建立在somewher即
谢谢!这使我指出了正确的方向。因为我只需要城市标签,所以我最终做了相当于第一行的<%= form.input:city do%>'。 'input_html'似乎没有真正进入输出,并且包装类在我的情况下似乎没有视觉问题。可能取决于你的Bootstrap版本等等。而我用“input-mini”等代替“span1”。只是指出可能会简化。 – 2013-09-03 10:55:58