diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index fac7026..d5492e5 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -103,8 +103,9 @@ SimpleForm.setup do |config| # You can define the class to use on all labels. Default is nil. # config.label_class = nil - # You can define the class to use on all forms. Default is simple_form. - # config.form_class = :simple_form + # You can define the default class to be used on forms. Can be overriden + # with `html: { :class }`. Defaulting to none. + # config.default_form_class = nil # You can define which elements should obtain additional classes # config.generate_additional_classes_for = [:wrapper, :label, :input] diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb index d1cb6e2..ea4a63d 100644 --- a/config/initializers/simple_form_bootstrap.rb +++ b/config/initializers/simple_form_bootstrap.rb @@ -45,7 +45,8 @@ SimpleForm.setup do |config| config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| b.use :html5 b.optional :readonly - b.use :label_input + b.use :label, class: 'control-label' + b.use :input b.use :error, wrap_with: { tag: 'span', class: 'help-block' } b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } end @@ -107,13 +108,6 @@ SimpleForm.setup do |config| end end - config.wrappers :horizontal_submit, tag: 'div', class: 'form-group' do |b| - b.optional :readonly - b.wrapper tag: 'div', class: 'col-sm-offset-2 col-sm-10' do |ba| - ba.use :input - end - end - config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| b.use :html5 b.use :placeholder @@ -132,5 +126,11 @@ SimpleForm.setup do |config| # Check the Bootstrap docs (http://getbootstrap.com) # to learn about the different styles for forms and inputs, # buttons and other elements. - # config.default_wrapper = :vertical_form + config.default_wrapper = :vertical_form + config.wrapper_mappings = { + check_boxes: :vertical_radio_and_checkboxes, + radio_buttons: :vertical_radio_and_checkboxes, + file: :vertical_file_input, + boolean: :vertical_boolean, + } end