![](/img/trans.png)
[英]rails-bootstrap-toggle-buttons in simple_form bootstrap not working
[英]Rails simple_form + Bootstrap not working
在我的Rails項目中,我安裝了bootstrap-sass(3.3.6,3.3.4.1)。 我還添加了@import "bootstrap";
到我的application.css.scss
。
現在,我可以在項目中使用Bootstrap類了。
現在,我想在所有表單上默認使用Bootstrap。 所以我添加了gem並安裝了simple_form
rails generate simple_form:install --bootstrap
據我了解,此表單現在應該以Bootstrap樣式顯示,但它不
<section class="content">
<div class="box">
<div class="box-body">
<%= simple_form_for :ride, url: order_path do |f| %>
<p>
<%= f.label :client %><br>
<%= f.text_field :client %>
</p>
<p>
<%= f.submit 'Adicionar', :class => 'btn btn-primary' %>
</p>
<% end %>
</div>
</div>
</section>
自從我手動添加類以來,按鈕的樣式已設置,但輸入字段未設置。 我添加了包裝此表單的代碼,以確保完整。
有人知道我在做什么錯嗎?
默認版本的simple_form可能無法完全與Bootstrap 3配合使用。嘗試將simple_form gem更改為
gem 'simple_form', '~> 3.1.0.rc1', github: 'plataformatec/simple_form', branch: 'master'
要么
gem 'simple_form', '~> 3.2', '>= 3.2.1'
然后重新啟動Rails服務器,看看它是否有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.