Skip to content

Instantly share code, notes, and snippets.

@sgringwe
Created July 28, 2013 04:37
Show Gist options
  • Save sgringwe/6097423 to your computer and use it in GitHub Desktop.
Save sgringwe/6097423 to your computer and use it in GitHub Desktop.
Using simple_form with twitter bootstrap 3.0. These are the changes I made when upgrading.
SimpleForm.setup do |config|
config.wrappers :bootstrap, :tag => 'div', :class => 'form-group', :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.wrapper :tag => 'div', :class=> 'col-lg-10' do |ba|
ba.use :input # , :class => ['form-control']
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
end
config.default_wrapper = :bootstrap
config.label_class = 'control-label col-lg-2'
end
# In each simple_form_for call
defaults: { input_html: { class: "form-control" } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment