Permalink
Browse files

Fixes error validation state.

This adds necessary classes for both form and form field errors. These
had changed between Bootstrap 2 and 3.
  • Loading branch information...
1 parent 6758345 commit 6fbe0cabb63a2d867f1e5d946c783e72cbce6294 @mjbellantoni committed Nov 27, 2013
@@ -53,9 +53,9 @@ def semantic_errors(*args)
return nil if full_errors.blank?
if html_options[:class].blank?
- html_options[:class] = "alert alert-error"
+ html_options[:class] = "alert alert-danger"
else
- html_options[:class] = "alert alert-error " + html_options[:class]
+ html_options[:class] = "alert alert-danger " + html_options[:class]
end
template.content_tag(:div, html_options) do
@@ -10,6 +10,7 @@ def label_html_options
# Bootstrap defines class 'label' too, so remove the
# one that gets created by Formtastic.
options[:class] = options[:class].reject { |c| c == 'label' }
+ options[:class] << " control-label"
end
end
@@ -46,6 +46,7 @@ def form_group_wrapping(&block)
def wrapper_html_options
super.tap do |options|
options[:class] << " form-group"
+ options[:class] << " has-error" if errors?
end
end

0 comments on commit 6fbe0ca

Please sign in to comment.