Rename fieldWithErrors style to field_with_errors. Remove unused alert style.
This commit is contained in:
parent
2538ef0d09
commit
72a3e4b77b
@ -1,5 +1,7 @@
|
||||
*Rails 3.0.0 [beta 4/release candidate] (unreleased)*
|
||||
|
||||
* Renamed the field error CSS class from fieldWithErrors to field_with_errors for consistency. [Jeremy Kemper]
|
||||
|
||||
* Add support for shorthand routes like /projects/status(.:format) #4423 [Diego Carrion]
|
||||
|
||||
* Changed translate helper so that it doesn’t mark every translation as safe HTML. Only keys with a "_html" suffix and keys named "html" are considered to be safe HTML. All other translations are left untouched. [Craig Davey]
|
||||
|
@ -6,7 +6,7 @@
|
||||
module ActionView
|
||||
ActiveSupport.on_load(:action_view) do
|
||||
class ActionView::Base
|
||||
@@field_error_proc = Proc.new{ |html_tag, instance| "<div class=\"fieldWithErrors\">#{html_tag}</div>".html_safe }
|
||||
@@field_error_proc = Proc.new{ |html_tag, instance| "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe }
|
||||
cattr_accessor :field_error_proc
|
||||
end
|
||||
end
|
||||
|
@ -27,14 +27,14 @@ def setup
|
||||
|
||||
def test_text_area_with_errors
|
||||
assert_dom_equal(
|
||||
%(<div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div>),
|
||||
%(<div class="field_with_errors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div>),
|
||||
text_area("post", "body")
|
||||
)
|
||||
end
|
||||
|
||||
def test_text_field_with_errors
|
||||
assert_dom_equal(
|
||||
%(<div class="fieldWithErrors"><input id="post_author_name" name="post[author_name]" size="30" type="text" value="" /></div>),
|
||||
%(<div class="field_with_errors"><input id="post_author_name" name="post[author_name]" size="30" type="text" value="" /></div>),
|
||||
text_field("post", "author_name")
|
||||
)
|
||||
end
|
||||
@ -42,11 +42,11 @@ def test_text_field_with_errors
|
||||
def test_field_error_proc
|
||||
old_proc = ActionView::Base.field_error_proc
|
||||
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
|
||||
%(<div class=\"fieldWithErrors\">#{html_tag} <span class="error">#{[instance.error_message].join(', ')}</span></div>).html_safe
|
||||
%(<div class=\"field_with_errors\">#{html_tag} <span class="error">#{[instance.error_message].join(', ')}</span></div>).html_safe
|
||||
end
|
||||
|
||||
assert_dom_equal(
|
||||
%(<div class="fieldWithErrors"><input id="post_author_name" name="post[author_name]" size="30" type="text" value="" /> <span class="error">can't be empty</span></div>),
|
||||
%(<div class="field_with_errors"><input id="post_author_name" name="post[author_name]" size="30" type="text" value="" /> <span class="error">can't be empty</span></div>),
|
||||
text_field("post", "author_name")
|
||||
)
|
||||
ensure
|
||||
|
@ -1,4 +1,4 @@
|
||||
<p class="notice"><%%= notice %></p>
|
||||
<p id="notice"><%%= notice %></p>
|
||||
|
||||
<% for attribute in attributes -%>
|
||||
<p>
|
||||
|
@ -20,15 +20,11 @@ div.field, div.actions {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.notice {
|
||||
#notice {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.alert {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.fieldWithErrors {
|
||||
.field_with_errors {
|
||||
padding: 2px;
|
||||
background-color: red;
|
||||
display: table;
|
||||
|
Loading…
Reference in New Issue
Block a user