Skip to content

Instantly share code, notes, and snippets.

@apraditya
Created October 2, 2014 03:23
Show Gist options
  • Save apraditya/0164fce6469e7ae7c109 to your computer and use it in GitHub Desktop.
Save apraditya/0164fce6469e7ae7c109 to your computer and use it in GitHub Desktop.
Display checkboxes by splitting into 3 columns in a Bootstrap vertical form using simple_form gem
// app/assets/stylesheets/components.css.scss
label.label-block {
display: block;
}
.checkboxes_in_column {
@extend .row;
span.checkbox {
@extend .col-sm-4;
margin-top: 5px;
}
}
# config/initializers/simple_form_bootstrap.rb
SimpleForm.setup do |config|
config.wrappers :vertical_radio_and_checkboxes_in_columns, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :label, class: 'label-block'
b.wrapper tag: 'div', class: 'checkboxes_in_column' do |ba|
ba.use :input
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment