diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-03-27 14:16:04 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-03-27 14:16:04 -0700 |
commit | 33164c8f1479b826a044ab90f4cc2439666e4b16 (patch) | |
tree | a6e67b7535b6b4e9e9c94ef2800b987dc45149c8 /actionpack/lib | |
parent | 2fa7ccf7aee3696e99f1b528db848aff5a671f77 (diff) | |
parent | 1438e0eb062ef92ec3544be6896e2853dd0df07b (diff) | |
download | rails-33164c8f1479b826a044ab90f4cc2439666e4b16.tar.gz rails-33164c8f1479b826a044ab90f4cc2439666e4b16.tar.bz2 rails-33164c8f1479b826a044ab90f4cc2439666e4b16.zip |
Merge pull request #5620 from jcoleman/textarea-newline-fix-breaks-haml-master
Don't break Haml with textarea newline fix. (master)
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/tag_helper.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/tags/text_area.rb | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index ecd26891d6..71be2955a8 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -17,6 +17,10 @@ module ActionView autofocus novalidate formnovalidate open pubdate).to_set BOOLEAN_ATTRIBUTES.merge(BOOLEAN_ATTRIBUTES.map {|attribute| attribute.to_sym }) + PRE_CONTENT_STRINGS = { + :textarea => "\n" + } + # Returns an empty HTML tag of type +name+ which by default is XHTML # compliant. Set +open+ to true to create an open tag compatible # with HTML 4.0 and below. Add HTML attributes by passing an attributes @@ -126,7 +130,7 @@ module ActionView def content_tag_string(name, content, options, escape = true) tag_options = tag_options(options, escape) if options content = ERB::Util.h(content) if escape - "<#{name}#{tag_options}>#{content}</#{name}>".html_safe + "<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name.to_sym]}#{content}</#{name}>".html_safe end def tag_options(options, escape = true) diff --git a/actionpack/lib/action_view/helpers/tags/text_area.rb b/actionpack/lib/action_view/helpers/tags/text_area.rb index 2e48850d5c..f74652c5e7 100644 --- a/actionpack/lib/action_view/helpers/tags/text_area.rb +++ b/actionpack/lib/action_view/helpers/tags/text_area.rb @@ -10,7 +10,7 @@ module ActionView options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split) end - content_tag("textarea", "\n#{options.delete('value') || value_before_type_cast(object)}", options) + content_tag("textarea", options.delete('value') || value_before_type_cast(object), options) end end end |