0

Simpleform是否支持Bootstrap3單選按鈕?Simpleform Bootstrap 3單選按鈕

我試着用下面的配置自定義包裝,但這似乎不工作得很好。

config.wrappers :radio_buttons, tag: 'div', class: "form-group", error_class: "has-error" do |b| 
    b.use :html5 
    b.use :label, { class: "control-label col-lg-4" } 
    b.wrapper :tag => 'div', class: "col-lg-8" do |ba| 
     ba.wrapper :tag => 'div', class: 'checkbox' do |bb| 
     bb.use :input, { class: 'uniform', label: false } 
     bb.use :label_text { label: false } 
     end 
    end 
    b.use :hint, wrap_with: { tag: :p, class: "help-block" } 
    b.use :error, wrap_with: { tag: :span, class: "help-block text-danger" } 
    end 

什麼能在此代碼來支持類似下面的變化?

<div class="col-lg-8"> 
          <div class="checkbox"> 
           <label> 
            <div class="radio"><span class="checked"><input class="uniform" type="radio" name="optionsRadios" value="option1" checked=""></span></div>Checked 
            radio 
           </label> 
          </div> 
          <!-- /.checkbox --> 
          <div class="checkbox"> 
           <label> 
            <div class="radio"><span><input class="uniform" type="radio" name="optionsRadios" value="option2"></span></div>Unchecked 
            radio 
           </label> 
          </div> 
          <!-- /.checkbox --> 
          <div class="checkbox"> 
           <label> 
            <div class="radio disabled"><span class="checked"><input class="uniform" type="radio" name="optionsRadios2" value="option3" checked="" disabled=""></span></div> 
            Disabled checked radio 
           </label> 
          </div> 
          <!-- /.checkbox --> 
          <div class="checkbox"> 
           <label> 
            <div class="radio disabled"><span><input class="uniform" type="radio" name="optionsRadios2" value="option4" disabled=""></span></div> 
            Disabled unchecked radio 
           </label> 
          </div> 
          <!-- /.checkbox --> 
         </div> 

回答

0

所以我真的不認爲你應該把一個收音機類放入複選框類。你爲什麼混合複選框和廣播課?如果你看一下bootstrap css example,你會看到這一點:

<div class="radio"> 
    <label> 
    <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2"> 
    Option two can be something else and selecting it will deselect option one 
    </label> 
</div> 

但無論如何,這應該只是回落到CSS。你的application.css(或application.scss)文件是什麼樣的?你是否在導入/需要引導程序作爲你的默認css?此外,你的表單本身是什麼樣的?