我使用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