From 3384ee24adb1ac38fdadbb755523ffb9f6bda9cc Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sat, 10 Mar 2012 23:30:39 +1300 Subject: Fixes #5324 by removing default size options from input:text and default cols and rows options from textarea. --- actionpack/lib/action_view/helpers/form_helper.rb | 30 +- actionpack/lib/action_view/helpers/tags/base.rb | 2 - .../lib/action_view/helpers/tags/text_area.rb | 4 +- .../lib/action_view/helpers/tags/text_field.rb | 3 +- .../test/template/active_model_helper_test.rb | 6 +- actionpack/test/template/form_helper_test.rb | 324 ++++++++++----------- .../guides/source/action_view_overview.textile | 10 +- railties/guides/source/form_helpers.textile | 22 +- railties/guides/source/nested_model_forms.textile | 12 +- 9 files changed, 204 insertions(+), 209 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 7492ef56c6..0970ad96d1 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -45,10 +45,10 @@ module ActionView # # # : - #
+ #
# # : - #
+ #
# # # @@ -76,10 +76,10 @@ module ActionView # # # : - #
+ #
# # : - #
+ #
# # # @@ -757,7 +757,7 @@ module ActionView # # # # text_area(:application, :notes, :cols => 40, :rows => 15, :class => 'app_input') - # # => # @@ -860,20 +860,20 @@ module ActionView # ==== Examples # # search_field(:user, :name) - # # => + # # => # search_field(:user, :name, :autosave => false) - # # => + # # => # search_field(:user, :name, :results => 3) - # # => + # # => # # Assume request.host returns "www.example.com" # search_field(:user, :name, :autosave => true) - # # => + # # => # search_field(:user, :name, :onsearch => true) - # # => + # # => # search_field(:user, :name, :autosave => false, :onsearch => true) - # # => + # # => # search_field(:user, :name, :autosave => true, :onsearch => true) - # # => + # # => # def search_field(object_name, method, options = {}) Tags::SearchField.new(object_name, method, self, options).render @@ -882,7 +882,7 @@ module ActionView # Returns a text_field of type "tel". # # telephone_field("user", "phone") - # # => + # # => # def telephone_field(object_name, method, options = {}) Tags::TelField.new(object_name, method, self, options).render @@ -910,7 +910,7 @@ module ActionView # Returns a text_field of type "url". # # url_field("user", "homepage") - # # => + # # => # def url_field(object_name, method, options = {}) Tags::UrlField.new(object_name, method, self, options).render @@ -919,7 +919,7 @@ module ActionView # Returns a text_field of type "email". # # email_field("user", "address") - # # => + # # => # def email_field(object_name, method, options = {}) Tags::EmailField.new(object_name, method, self, options).render diff --git a/actionpack/lib/action_view/helpers/tags/base.rb b/actionpack/lib/action_view/helpers/tags/base.rb index 22c16de057..14323a3891 100644 --- a/actionpack/lib/action_view/helpers/tags/base.rb +++ b/actionpack/lib/action_view/helpers/tags/base.rb @@ -5,8 +5,6 @@ module ActionView include Helpers::ActiveModelInstanceTag, Helpers::TagHelper, Helpers::FormTagHelper include FormOptionsHelper - DEFAULT_FIELD_OPTIONS = { "size" => 30 } - attr_reader :object def initialize(object_name, method_name, template_object, options = {}) diff --git a/actionpack/lib/action_view/helpers/tags/text_area.rb b/actionpack/lib/action_view/helpers/tags/text_area.rb index 461a049fc2..2e48850d5c 100644 --- a/actionpack/lib/action_view/helpers/tags/text_area.rb +++ b/actionpack/lib/action_view/helpers/tags/text_area.rb @@ -2,10 +2,8 @@ module ActionView module Helpers module Tags class TextArea < Base #:nodoc: - DEFAULT_TEXT_AREA_OPTIONS = { "cols" => 40, "rows" => 20 } - def render - options = DEFAULT_TEXT_AREA_OPTIONS.merge(@options.stringify_keys) + options = @options.stringify_keys add_default_name_and_id(options) if size = options.delete("size") diff --git a/actionpack/lib/action_view/helpers/tags/text_field.rb b/actionpack/lib/action_view/helpers/tags/text_field.rb index ce5182d20f..024a1a8af2 100644 --- a/actionpack/lib/action_view/helpers/tags/text_field.rb +++ b/actionpack/lib/action_view/helpers/tags/text_field.rb @@ -4,8 +4,7 @@ module ActionView class TextField < Base #:nodoc: def render options = @options.stringify_keys - options["size"] = options["maxlength"] || DEFAULT_FIELD_OPTIONS["size"] unless options.key?("size") - options = DEFAULT_FIELD_OPTIONS.merge(options) + options["size"] = options["maxlength"] unless options.key?("size") options["type"] ||= field_type options["value"] = options.fetch("value"){ value_before_type_cast(object) } unless field_type == "file" options["value"] &&= ERB::Util.html_escape(options["value"]) diff --git a/actionpack/test/template/active_model_helper_test.rb b/actionpack/test/template/active_model_helper_test.rb index 66a7bce71e..18468ee91a 100644 --- a/actionpack/test/template/active_model_helper_test.rb +++ b/actionpack/test/template/active_model_helper_test.rb @@ -29,14 +29,14 @@ class ActiveModelHelperTest < ActionView::TestCase def test_text_area_with_errors assert_dom_equal( - %(
), + %(
), text_area("post", "body") ) end def test_text_field_with_errors assert_dom_equal( - %(
), + %(
), text_field("post", "author_name") ) end @@ -76,7 +76,7 @@ class ActiveModelHelperTest < ActionView::TestCase end assert_dom_equal( - %(
can't be empty
), + %(
can't be empty
), text_field("post", "author_name") ) ensure diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 4eed5615f6..bc42e14b8a 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -249,35 +249,35 @@ class FormHelperTest < ActionView::TestCase end def test_label_with_block_in_erb - assert_equal "", view.render("test/label_with_block") + assert_equal "", view.render("test/label_with_block") end def test_text_field assert_dom_equal( - '', text_field("post", "title") + '', text_field("post", "title") ) assert_dom_equal( - '', password_field("post", "title") + '', password_field("post", "title") ) assert_dom_equal( - '', password_field("post", "title", :value => @post.title) + '', password_field("post", "title", :value => @post.title) ) assert_dom_equal( - '', password_field("person", "name") + '', password_field("person", "name") ) end def test_text_field_with_escapes @post.title = "Hello World" assert_dom_equal( - '', text_field("post", "title") + '', text_field("post", "title") ) end def test_text_field_with_html_entities @post.title = "The HTML Entity for & is &" assert_dom_equal( - '', + '', text_field("post", "title") ) end @@ -301,18 +301,18 @@ class FormHelperTest < ActionView::TestCase end def test_text_field_with_nil_value - expected = '' + expected = '' assert_dom_equal expected, text_field("post", "title", :value => nil) end def test_text_field_with_nil_name - expected = '' + expected = '' assert_dom_equal expected, text_field("post", "title", :name => nil) end def test_text_field_doesnt_change_param_values object_name = 'post[]' - expected = '' + expected = '' assert_equal expected, text_field(object_name, "title") assert_equal object_name, "post[]" end @@ -346,7 +346,7 @@ class FormHelperTest < ActionView::TestCase end def test_text_field_with_custom_type - assert_dom_equal '', + assert_dom_equal '', text_field("user", "email", :type => "email") end @@ -474,7 +474,7 @@ class FormHelperTest < ActionView::TestCase def test_text_area assert_dom_equal( - %{}, + %{}, text_area("post", "body") ) end @@ -482,14 +482,14 @@ class FormHelperTest < ActionView::TestCase def test_text_area_with_escapes @post.body = "Back to the hill and over it again!" assert_dom_equal( - %{}, + %{}, text_area("post", "body") ) end def test_text_area_with_alternate_value assert_dom_equal( - %{}, + %{}, text_area("post", "body", :value => 'Testing alternate values.') ) end @@ -497,7 +497,7 @@ class FormHelperTest < ActionView::TestCase def test_text_area_with_html_entities @post.body = "The HTML Entity for & is &" assert_dom_equal( - %{}, + %{}, text_area("post", "body") ) end @@ -510,12 +510,12 @@ class FormHelperTest < ActionView::TestCase end def test_search_field - expected = %{} + expected = %{} assert_dom_equal(expected, search_field("contact", "notes_query")) end def test_telephone_field - expected = %{} + expected = %{} assert_dom_equal(expected, telephone_field("user", "cell")) end @@ -546,12 +546,12 @@ class FormHelperTest < ActionView::TestCase end def test_url_field - expected = %{} + expected = %{} assert_dom_equal(expected, url_field("user", "homepage")) end def test_email_field - expected = %{} + expected = %{} assert_dom_equal(expected, email_field("user", "address")) end @@ -571,10 +571,10 @@ class FormHelperTest < ActionView::TestCase def test_explicit_name assert_dom_equal( - '', text_field("post", "title", "name" => "dont guess") + '', text_field("post", "title", "name" => "dont guess") ) assert_dom_equal( - %{}, + %{}, text_area("post", "body", "name" => "really!") ) assert_dom_equal( @@ -591,10 +591,10 @@ class FormHelperTest < ActionView::TestCase def test_explicit_id assert_dom_equal( - '', text_field("post", "title", "id" => "dont guess") + '', text_field("post", "title", "id" => "dont guess") ) assert_dom_equal( - %{}, + %{}, text_area("post", "body", "id" => "really!") ) assert_dom_equal( @@ -611,10 +611,10 @@ class FormHelperTest < ActionView::TestCase def test_nil_id assert_dom_equal( - '', text_field("post", "title", "id" => nil) + '', text_field("post", "title", "id" => nil) ) assert_dom_equal( - %{}, + %{}, text_area("post", "body", "id" => nil) ) assert_dom_equal( @@ -641,11 +641,11 @@ class FormHelperTest < ActionView::TestCase def test_index assert_dom_equal( - '', + '', text_field("post", "title", "index" => 5) ) assert_dom_equal( - %{}, + %{}, text_area("post", "body", "index" => 5) ) assert_dom_equal( @@ -668,11 +668,11 @@ class FormHelperTest < ActionView::TestCase def test_index_with_nil_id assert_dom_equal( - '', + '', text_field("post", "title", "index" => 5, 'id' => nil) ) assert_dom_equal( - %{}, + %{}, text_area("post", "body", "index" => 5, 'id' => nil) ) assert_dom_equal( @@ -700,10 +700,10 @@ class FormHelperTest < ActionView::TestCase label("post[]", "title") ) assert_dom_equal( - "", text_field("post[]","title") + "", text_field("post[]","title") ) assert_dom_equal( - "", + "", text_area("post[]", "body") ) assert_dom_equal( @@ -722,11 +722,11 @@ class FormHelperTest < ActionView::TestCase def test_auto_index_with_nil_id pid = 123 assert_dom_equal( - "", + "", text_field("post[]","title", :id => nil) ) assert_dom_equal( - "", + "", text_area("post[]", "body", :id => nil) ) assert_dom_equal( @@ -760,8 +760,8 @@ class FormHelperTest < ActionView::TestCase expected = whole_form("/posts/123", "create-post" , "edit_post", :method => 'patch') do "" + - "" + - "" + + "" + + "" + "" + "" + "" + @@ -859,7 +859,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/posts/44", "edit_post_44" , "edit_post", :method => 'patch') do - "" + + "" + "" end @@ -877,8 +877,8 @@ class FormHelperTest < ActionView::TestCase expected = whole_form("/posts/123", "create-post", "edit_other_name", :method => 'patch') do "" + - "" + - "" + + "" + + "" + "" + "" + "" @@ -895,8 +895,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/", "create-post", "edit_post", "delete") do - "" + - "" + + "" + + "" + "" + "" end @@ -912,8 +912,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/", "create-post", "edit_post", "delete") do - "" + - "" + + "" + + "" + "" + "" end @@ -929,7 +929,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/search", "search-post", "new_post", "get") do - "" + "" end assert_dom_equal expected, output_buffer @@ -943,8 +943,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/", "create-post", "edit_post", :method => 'patch', :remote => true) do - "" + - "" + + "" + + "" + "" + "" end @@ -960,8 +960,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/", "create-post", "edit_post", :method => 'patch', :remote => true) do - "" + - "" + + "" + + "" + "" + "" end @@ -979,8 +979,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/posts", 'new_post', 'new_post', :remote => true) do - "" + - "" + + "" + + "" + "" + "" end @@ -996,8 +996,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form("/", "create-post") do - "" + - "" + + "" + + "" + "" + "" end @@ -1015,8 +1015,8 @@ class FormHelperTest < ActionView::TestCase expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do "" + - "" + - "" + + "" + + "" + "" + "" end @@ -1032,8 +1032,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do - "" + - "" + + "" + + "" + "" + "" end @@ -1049,8 +1049,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', 'patch') do - "" + - "" + + "" + + "" + "" + "" end @@ -1066,7 +1066,7 @@ class FormHelperTest < ActionView::TestCase expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', 'patch') do "" + - "" + "" end assert_dom_equal expected, output_buffer @@ -1080,7 +1080,7 @@ class FormHelperTest < ActionView::TestCase expected_1 = whole_form('/posts/123', 'namespace_1_edit_post_123', 'edit_post', 'patch') do "" + - "" + "" end assert_dom_equal expected_1, output_buffer @@ -1092,7 +1092,7 @@ class FormHelperTest < ActionView::TestCase expected_2 = whole_form('/posts/123', 'namespace_2_edit_post_123', 'edit_post', 'patch') do "" + - "" + "" end assert_dom_equal expected_2, output_buffer @@ -1109,9 +1109,9 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', 'patch') do - "" + - "" + - "" + "" + + "" + + "" end assert_dom_equal expected, output_buffer @@ -1192,7 +1192,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - "" + "" end assert_dom_equal expected, output_buffer @@ -1207,8 +1207,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do - "" + - "" + "" + + "" end assert_dom_equal expected, output_buffer @@ -1223,8 +1223,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do - "" + - "" + "" + + "" end assert_dom_equal expected, output_buffer @@ -1238,7 +1238,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do - "" + "" end assert_dom_equal expected, output_buffer @@ -1252,7 +1252,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do - "" + "" end assert_dom_equal expected, output_buffer @@ -1266,7 +1266,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do - "" + "" end assert_dom_equal expected, output_buffer @@ -1294,7 +1294,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do - "" + "" end assert_dom_equal expected, output_buffer @@ -1314,9 +1314,9 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do - "" + "" end + whole_form('/posts/123', 'edit_post', 'edit_post', 'patch') do - "" + "" end assert_dom_equal expected, output_buffer @@ -1333,8 +1333,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + '' + + '' end assert_dom_equal expected, output_buffer @@ -1360,8 +1360,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' end @@ -1379,8 +1379,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' end @@ -1398,8 +1398,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + '' + + '' end assert_dom_equal expected, output_buffer @@ -1416,8 +1416,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + '' + + '' end assert_dom_equal expected, output_buffer @@ -1434,8 +1434,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' end @@ -1454,9 +1454,9 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + + '' + '' + - '' + '' end assert_dom_equal expected, output_buffer @@ -1475,10 +1475,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + + '' + '' end @@ -1502,11 +1502,11 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + - '' + '' + + '' end assert_dom_equal expected, output_buffer @@ -1529,10 +1529,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + - '' + - '' + '' + + '' + + '' + + '' end assert_dom_equal expected, output_buffer @@ -1555,11 +1555,11 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + - '' + '' + + '' end assert_dom_equal expected, output_buffer @@ -1578,10 +1578,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + + '' + '' end @@ -1602,11 +1602,11 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + + '' + '' + - '' + + '' + '' + - '' + '' end assert_dom_equal expected, output_buffer @@ -1625,9 +1625,9 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + - '' + '' + + '' + + '' end assert_dom_equal expected, output_buffer @@ -1646,10 +1646,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + '' end assert_dom_equal expected, output_buffer @@ -1664,7 +1664,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + '' end assert_dom_equal expected, output_buffer @@ -1681,10 +1681,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + + '' + '' end @@ -1702,10 +1702,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + + '' + '' end @@ -1724,10 +1724,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + + '' + '' end @@ -1747,10 +1747,10 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + - '' + '' end assert_dom_equal expected, output_buffer @@ -1767,7 +1767,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + + '' + '' end @@ -1803,16 +1803,16 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + - '' + + '' + + '' + '' + '' + - '' + - '' + + '' + + '' + '' + '' + - '' + - '' + + '' + + '' + '' + '' end @@ -1830,7 +1830,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - '' + '' end assert_dom_equal expected, output_buffer @@ -1844,8 +1844,8 @@ class FormHelperTest < ActionView::TestCase end expected = - "" + - "" + + "" + + "" + "" + "" @@ -1860,8 +1860,8 @@ class FormHelperTest < ActionView::TestCase end expected = - "" + - "" + + "" + + "" + "" + "" @@ -1876,8 +1876,8 @@ class FormHelperTest < ActionView::TestCase end expected = - "" + - "" + + "" + + "" + "" + "" @@ -1892,8 +1892,8 @@ class FormHelperTest < ActionView::TestCase end expected = - "" + - "" + + "" + + "" + "" + "" @@ -1908,8 +1908,8 @@ class FormHelperTest < ActionView::TestCase end expected = - "" + - "" + + "" + + "" + "" + "" @@ -1924,8 +1924,8 @@ class FormHelperTest < ActionView::TestCase end expected = - "" + - "" + + "" + + "" + "" + "" @@ -1939,7 +1939,7 @@ class FormHelperTest < ActionView::TestCase end assert_dom_equal "" + - "", + "", output_buffer end @@ -1950,7 +1950,7 @@ class FormHelperTest < ActionView::TestCase end assert_dom_equal "" + - "", + "", output_buffer end @@ -1969,8 +1969,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'create-post', 'edit_post', :method => 'patch') do - "" + - "" + + "" + + "" + "" + "" end @@ -1989,9 +1989,9 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'create-post', 'edit_post', :method => 'patch') do - "" + - "" + - "" + "" + + "" + + "" end assert_dom_equal expected, output_buffer @@ -2005,7 +2005,7 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do - "" + "" end assert_dom_equal expected, output_buffer @@ -2029,8 +2029,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - "
" + - "
" + + "
" + + "
" + "
" end @@ -2048,8 +2048,8 @@ class FormHelperTest < ActionView::TestCase end expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do - "
" + - "
" + + "
" + + "
" + "
" end @@ -2066,8 +2066,8 @@ class FormHelperTest < ActionView::TestCase end expected = - "
" + - "
" + + "
" + + "
" + "
" assert_dom_equal expected, output_buffer diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index f007629207..42120e9bad 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -431,11 +431,11 @@ form("post")


- +


- +

@@ -451,7 +451,7 @@ For example, if +@post+ has an attribute +title+ mapped to a +String+ column tha input("post", "title") # => - + h4. RecordTagHelper @@ -987,8 +987,8 @@ The HTML generated for this would be:
- - + +
diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index a696e4f8ae..6d9cd5440b 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -169,11 +169,11 @@ Output: - - + + - - + + Hidden inputs are not shown to the user but instead hold data like any textual input. Values inside them can be changed with JavaScript. @@ -239,7 +239,7 @@ The resulting HTML is:
- +
@@ -264,8 +264,8 @@ which produces the following output:
- - + +
@@ -714,9 +714,9 @@ Assuming the person had two addresses, with ids 23 and 45 this would create outp
- - - + + +
@@ -739,7 +739,7 @@ To create more intricate nestings, you can specify the first part of the input n will create inputs like - + As a general rule the final input name is the concatenation of the name given to +fields_for+/+form_for+, the index value and the name of the attribute. You can also pass an +:index+ option directly to helpers such as +text_field+, but it is usually less repetitive to specify this at the form builder level rather than on individual input controls. diff --git a/railties/guides/source/nested_model_forms.textile b/railties/guides/source/nested_model_forms.textile index 4b1fd2e0ac..82c9ab9d36 100644 --- a/railties/guides/source/nested_model_forms.textile +++ b/railties/guides/source/nested_model_forms.textile @@ -131,7 +131,7 @@ This will generate the following html:
- +
@@ -153,9 +153,9 @@ This generates:
- + - +
@@ -194,10 +194,10 @@ Which generates:
- + - - + +
-- cgit v1.2.3 From 8b5198a41704b333f56204e185fe0e8d832b2509 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 12 Mar 2012 10:33:47 +1300 Subject: Fix unintended removal of 'cols' from a text_area example. --- actionpack/lib/action_view/helpers/form_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 0970ad96d1..835111eb95 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -757,7 +757,7 @@ module ActionView # # # # text_area(:application, :notes, :cols => 40, :rows => 15, :class => 'app_input') - # # => # -- cgit v1.2.3 From f12f071ece7c15ec91d96dd92e897eb68d4d355a Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 12 Mar 2012 10:39:45 +1300 Subject: Documented the removal of size from text_field based helpers and cols, rows from text_area helper. --- actionpack/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 7565060668..c50cb5e927 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,5 +1,9 @@ ## Rails 4.0.0 (unreleased) ## +* Removed default `size` option from the `text_field`, `search_field`, `telephone_field`, `url_field`, `email_field` helpers. *Philip Arndt* + +* Removed default `cols` and `rows` options from the `text_area` helper. *Philip Arndt* + * Adds support for layouts when rendering a partial with a given collection. *serabe* * Allows the route helper `root` to take a string argument. For example, `root 'pages#main'`. *bcardarella* -- cgit v1.2.3