mercredi 7 octobre 2015

Simple_Form : how to display checkboxes (from association) in a table / grid format

I'm using simple_form to create a form that shows a bunch of checkboxes. These checkboxes come from an "association" (i.e. pulled from the database: their number can vary).

Simple_form outputs them in a column format (one per line). I'd like to distribute them over 3 columns (3 per line, nicely aligned).

Here is my code:

<div class="row">
    <div class="col-xs-2 col-xs-offset-5">
            <%= simple_form_for @user_profile, url: wizard_path, method: :put do |f| %>
                <%= f.association :yoga_styles, as: :check_boxes, label: false%>
                </BR>
                <%= f.button :submit, "Continue" %>
            <% end %>
    </div>
</div>

And just to be clear, I'm currently getting the following output: ()checkbox 1 ()checkbox 2 ()checkbox 3 ()checkbox 4 ()checkbox 5 ()checkbox 6

and I'd like to get ()checkbox 1 ()checkbox 2 ()checkbox 3 ()checkbox 4 ()checkbox 5 ()checkbox 6

I'on Rails 4.2.3 and Bootstrap 3.

Thanks




Aucun commentaire:

Enregistrer un commentaire