I would like to reproduce this html sequence of radio buttons using simple_form to make simple_form work with the http://semantic-ui.com/ syntax:
<div class="grouped inline fields"> <div class="field"> <div class="ui radio checkbox"> <input type="radio" name="fruit" checked=""> <label>Apples</label> </div> </div> <div class="field"> <div class="ui radio checkbox"> <input type="radio" name="fruit"> <label>Oranges</label> </div> </div> <div class="field"> <div class="ui radio checkbox"> <input type="radio" name="fruit"> <label>Pears</label> </div> </div> <div class="field"> <div class="ui radio checkbox"> <input type="radio" name="fruit"> <label>Grapefruit</label> </div> </div> </div>
So, I prepared a custom shell:
config.wrappers :semantic_radios, tag: 'div', class: "grouped fields", error_class: 'error', hint_class: 'with_hint' do |b| b.use :html5 b.use :label b.use :input end
Set a few options:
config.item_wrapper_tag = :div config.item_wrapper_class = 'ui radio checkbox'
And name this code in my form:
=f.input :child_care_type, collection: [["option 1", 1],["option 2", 2]], as: :radio_buttons, wrapper: :semantic_radios
I don't know where to set up the encapsulation of div.field:
<div class="field"> <div class="ui radio checkbox"> <input type="radio" name="fruit" checked=""> <label>Apples</label> </div> </div>
My code only visualizes this:
<div class="ui radio checkbox"> <input type="radio" name="fruit" checked=""> <label>Apples</label> </div>
Can you help me? I did not find any more shell settings for the collection: s
simple-form
alex
source share