mardi 31 mars 2020

Formatting checkboxes with Bootstrap in Rails form erb?

I'm using multiple check boxes in my Rails views form. I'm using Bootstrap 4 for styling. If there is a Bootstrap style for checkboxes like:

<div class="input-group mb-3">
  <div class="input-group-prepend">
    <div class="input-group-text">
      <input type="checkbox" aria-label="Checkbox for following text input">
    </div>
  </div>
  <input type="text" class="form-control" aria-label="Text input with checkbox">
</div>

<div class="input-group">
  <div class="input-group-prepend">
    <div class="input-group-text">
      <input type="radio" aria-label="Radio button for following text input">
    </div>
  </div>
  <input type="text" class="form-control" aria-label="Text input with radio button">
</div>

how do I implement multiple class stylings into an erb object? Here is the code I'm trying to implement:

            <%= f.collection_check_boxes(:authorization_ids, Authorization.all, :id, :auth_name, { checked: @account.try { |a| a.authorization_ids.map(&:to_param) } }, multiple: true, # WOULD LIKE TO IMPLEMENT BOOTSTRAP CLASSES HERE ) %>
        <%= f.label :authorization_ids, 'Authorizations' %>




Aucun commentaire:

Enregistrer un commentaire