4

simple_form カスタム ラッパー内で、ラッパーとそれに対応するラベルなしで入力フィールドを生成できますか?

現在、私のカスタム ラッパーは次のようになっています。

config.wrappers :category_tab, tag: "ul", class: "inline-list" do |ul|                                                                                                                         
  ul.use :html5                                                                                                                                                                             
  ul.wrapper tag: "li" do |li|                                                                                                                                                              
    li.wrapper tag: "label", class: "faux-tab" do |label|                                                                                                                                     
      label.use :input, label: false                                                                                                                                                          
      label.use :label_text, wrap_with: { tag: "span", class: "label-text" }
    end    
  end                                                                                                                                                                                        
end

以下のHTML構造を出力しようとしています

<ul>
  <li>
    <label>
      <input type="radio"></input>
      <span></span>
    </label>
  </li>
</ul>

現在の出力は次のとおりです。

<ul class="inline-list radio_buttons optional search_category">
  <li>
    <label class="faux-tab">
      <span class="radio">
        <input checked="checked" class="radio_buttons optional" id="search_category_" name="search[category]" type="radio" value="">
        <label class="collection_radio_buttons" for="search_category_">All</label>
      </span>
      <span class="label-text">Category</span>
    </label>
  </li>
</ul>
4

2 に答える 2