From 7d507dcc1bbbf5244b8d75f40c7cb6bc15906b33 Mon Sep 17 00:00:00 2001 From: "Mario \"Kuroir\" Ricalde" Date: Wed, 13 Feb 2013 04:11:17 -0600 Subject: Implements Fixes to TB for simple_form --- config/initializers/simple_form.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'config') diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 572d58f..062f823 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -82,6 +82,20 @@ SimpleForm.setup do |config| end end + config.wrappers :checkbox, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b| + b.use :html5 + b.use :placeholder + b.wrapper :tag => 'div', :class => 'controls' do |input| + input.wrapper :tag => 'div', :class => 'simple-checkbox' do |prepend| + prepend.use :label_input + end + input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' } + input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' } + end + end + + config.wrapper_mappings = { :boolean => :checkbox } + # Wrappers for forms and inputs using the Twitter Bootstrap toolkit. # Check the Bootstrap docs (http://twitter.github.com/bootstrap) # to learn about the different styles for forms and inputs, @@ -95,7 +109,7 @@ SimpleForm.setup do |config| config.boolean_style = :nested # Default class for buttons - config.button_class = 'btn btn-primary' + config.button_class = 'btn' # Method used to tidy up errors. # config.error_method = :first @@ -136,7 +150,7 @@ SimpleForm.setup do |config| config.label_class = 'control-label' # You can define the class to use on all forms. Default is simple_form. - # config.form_class = :simple_form + config.form_class = 'simple_form form-horizontal' # You can define which elements should obtain additional classes # config.generate_additional_classes_for = [:wrapper, :label, :input] @@ -163,7 +177,7 @@ SimpleForm.setup do |config| # config.country_priority = nil # Default size for text inputs. - # config.default_input_size = 50 + config.default_input_size = 150 # When false, do not use translations for labels. # config.translate_labels = true -- cgit v1.2.3