summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario "Kuroir" Ricalde <kuroir@gmail.com>2013-02-13 04:11:17 -0600
committerMario "Kuroir" Ricalde <kuroir@gmail.com>2013-02-13 04:11:17 -0600
commit7d507dcc1bbbf5244b8d75f40c7cb6bc15906b33 (patch)
tree93401b6aadf4f89f307541b64e97be2b352b497a
parent964c81fc615b35c9ee909a47901f307be6ce2c3a (diff)
Implements Fixes to TB for simple_form
-rw-r--r--app/assets/stylesheets/gemeinschaft-generic.css.scss10
-rw-r--r--config/initializers/simple_form.rb20
2 files changed, 27 insertions, 3 deletions
diff --git a/app/assets/stylesheets/gemeinschaft-generic.css.scss b/app/assets/stylesheets/gemeinschaft-generic.css.scss
index 044b87b..fbeaa1f 100644
--- a/app/assets/stylesheets/gemeinschaft-generic.css.scss
+++ b/app/assets/stylesheets/gemeinschaft-generic.css.scss
@@ -17,6 +17,16 @@ li.display {
}
}
+// SimpleForm Inline Checkbox Fix
+.simple-checkbox .checkbox {
+ text-align: left;
+ width: auto;
+ float: none;
+}
+input, textarea, .uneditable-input {
+ width: 500px;
+}
+
@media (max-width: 979px) {
body {
padding-top: 0px;
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