Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add 'disabled' attribute to <OPTION> separators used in time zone and…

… country selects. Closes #10354 [hasmanyjosh]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8267 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 112ed3031671476d6aee3d0f69affe6c113e711f 1 parent 9663f99
@technoweenie technoweenie authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Add 'disabled' attribute to <OPTION> separators used in time zone and country selects. Closes #10354 [hasmanyjosh]
+
* Added the same record identification guessing rules to fields_for as form_for has [DHH]
* Fixed that verification violations with no specified action didn't halt the chain (now they do with a 400 Bad Request) [DHH]
View
4 actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -249,7 +249,7 @@ def country_options_for_select(selected = nil, priority_countries = nil)
if priority_countries
country_options += options_for_select(priority_countries, selected)
- country_options += "<option value=\"\">-------------</option>\n"
+ country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
end
return country_options + options_for_select(COUNTRIES, selected)
@@ -280,7 +280,7 @@ def time_zone_options_for_select(selected = nil, priority_zones = nil, model = T
if priority_zones
zone_options += options_for_select(convert_zones[priority_zones], selected)
- zone_options += "<option value=\"\">-------------</option>\n"
+ zone_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
zones = zones.reject { |z| priority_zones.include?( z ) }
end
View
12 actionpack/test/template/form_options_helper_test.rb
@@ -187,7 +187,7 @@ def test_time_zone_options_with_priority_zones
opts = time_zone_options_for_select( nil, zones )
assert_dom_equal "<option value=\"B\">B</option>\n" +
"<option value=\"E\">E</option>" +
- "<option value=\"\">-------------</option>\n" +
+ "<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\">D</option>",
@@ -199,7 +199,7 @@ def test_time_zone_options_with_selected_priority_zones
opts = time_zone_options_for_select( "E", zones )
assert_dom_equal "<option value=\"B\">B</option>\n" +
"<option value=\"E\" selected=\"selected\">E</option>" +
- "<option value=\"\">-------------</option>\n" +
+ "<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"D\">D</option>",
@@ -211,7 +211,7 @@ def test_time_zone_options_with_unselected_priority_zones
opts = time_zone_options_for_select( "C", zones )
assert_dom_equal "<option value=\"B\">B</option>\n" +
"<option value=\"E\">E</option>" +
- "<option value=\"\">-------------</option>\n" +
+ "<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"A\">A</option>\n" +
"<option value=\"C\" selected=\"selected\">C</option>\n" +
"<option value=\"D\">D</option>",
@@ -663,7 +663,7 @@ def test_country_select_with_priority_countries
@post.origin = "Denmark"
expected_select = <<-COUNTRIES
<select id="post_origin" name="post[origin]"><option value="New Zealand">New Zealand</option>
-<option value="Nicaragua">Nicaragua</option><option value="">-------------</option>
+<option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Aland Islands">Aland Islands</option>
<option value="Albania">Albania</option>
@@ -919,7 +919,7 @@ def test_country_select_with_selected_priority_country
@post.origin = "New Zealand"
expected_select = <<-COUNTRIES
<select id="post_origin" name="post[origin]"><option selected="selected" value="New Zealand">New Zealand</option>
-<option value="Nicaragua">Nicaragua</option><option value="">-------------</option>
+<option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Aland Islands">Aland Islands</option>
<option value="Albania">Albania</option>
@@ -1289,7 +1289,7 @@ def test_time_zone_select_with_priority_zones
assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
"<option value=\"A\">A</option>\n" +
"<option value=\"D\" selected=\"selected\">D</option>" +
- "<option value=\"\">-------------</option>\n" +
+ "<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
"<option value=\"B\">B</option>\n" +
"<option value=\"C\">C</option>\n" +
"<option value=\"E\">E</option>" +
Please sign in to comment.
Something went wrong with that request. Please try again.