1

これ:

<%= 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"

それ、どうやったら出来るの?

4

1 に答える 1

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">

于 2013-03-10T19:03:16.500 に答える