Sha256: c97e6f6fc486ef9a92803f359f7c3350f5c9ebc1ec0bef3d0c186e3ca79b2277

Contents?: true

Size: 875 Bytes

Versions: 5

Compression:

Stored size: 875 Bytes

Contents

<% if field.nullable? %>
  <div class="btn-group" role="group">
    <% {'1': [true, 'btn-outline-success'], '0': [false, 'btn-outline-danger'], '': [nil, 'btn-outline-secondary']}.each do |text, (value, btn_class)| %>
      <%= form.radio_button field.method_name, text, field.html_attributes.reverse_merge({ checked: field.form_value == value, required: field.required, class: 'btn-check' }) %>
      <%= form.label "#{field.method_name}_#{text}", class: "#{field.css_classes[value]} btn #{btn_class}" do %>
        <%= field.labels[value].html_safe %>
      <% end %>
    <% end %>
  </div>
<% else %>
  <div class="col-form-label">
    <%= form.send field.view_helper, field.method_name, field.html_attributes.reverse_merge({ value: field.form_value, checked: field.form_value.in?([true, '1']), required: field.required, class: 'form-check-input' }) %>
  </div>
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_admin-3.3.0 app/views/rails_admin/main/_form_boolean.html.erb
rails_admin-3.2.1 app/views/rails_admin/main/_form_boolean.html.erb
rails_admin-3.2.0 app/views/rails_admin/main/_form_boolean.html.erb
rails_admin-3.2.0.rc app/views/rails_admin/main/_form_boolean.html.erb
rails_admin-3.2.0.beta app/views/rails_admin/main/_form_boolean.html.erb