Created
October 2, 2014 03:23
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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