2013-03-10 52 views
1

此:我如何設計由Simple_Form生成的每個複選框的「標籤」?

<%= f.input :accomplished_goal, label: "Accomplished goal this week?", collection: ["Yes", "No"], as: :check_boxes, label_html: { class: 'checkbox inline' } %> 

產地:

<div class="control-group check_boxes optional weekly_entry_accomplished_goal"> 
    <label class="check_boxes optional control-label checkbox inline">Accomplished goal this week?</label> 
    <div class="controls"> 
     <label class="checkbox"> 
      <input class="check_boxes optional" id="weekly_entry_accomplished_goal_yes" name="weekly_entry[accomplished_goal][]" type="checkbox" value="Yes" /> 
      Yes 
     </label> 
     <label class="checkbox"> 
      <input class="check_boxes optional" id="weekly_entry_accomplished_goal_no" name="weekly_entry[accomplished_goal][]" type="checkbox" value="No" /> 
       No 
     </label> 
      <input name="weekly_entry[accomplished_goal][]" type="hidden" value="" /> 
    </div> 
</div> 

理想情況下,我想風格inline添加到內label class="checkbox"

我該怎麼辦呢?

回答

1

這是我發現的作品:

<%= f.input :accomplished_goal, label: "Accomplished goal this week?", collection: ["Yes", "No"], as: :check_boxes, item_wrapper_class: 'inline' %> 

即使用屬性item_wrapper_class: 'inline'

添加類inline到內部<label class="checkbox inline">

相關問題