I'm trying to make a star rating form with radio collection using FontAwesome, for this I actually need to change the label classes of the collection_radio_button input generated by simple_form but can't find any obvious solution.
So far I use:
form_for @user do |f|
f.collection_radio_buttons :rating, [[1, 'Bad'] ,[2, 'Ok'], [3, 'Great']],
:first, :last, { item_wrapper_tag: false }
end
Which generates:
<input id="review_rating_1" name="review[rating]" type="radio" value="1" />
<label class="collection_radio_buttons" for="review_rating_1">Bad</label>
<input id="review_rating_2" name="review[rating]" type="radio" value="2" />
<label class="collection_radio_buttons" for="review_rating_2">Ok</label>
<input id="review_rating_3" name="user[options]" type="radio" value="3" />
<label class="collection_radio_buttons" for="review_rating_3">Great</label>
But I'd like the labels to have an extra class, like:
<input id="review_rating_3" name="user[options]" type="radio" value="3" />
<label class="collection_radio_buttons icon-star" for="review_rating_3">Great</label>
UPDATE: This class is defined statically at: https://github.com/plataformatec/simple_form/blob/master/lib/simple_form/tags.rb#L43
label_html: { class: 'icon-star' }
as an option