diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-03-27 14:16:15 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-03-27 14:16:15 -0700 |
commit | d82e4c80a820280c8bb9957bd86453d8fea49384 (patch) | |
tree | 06c8bca75c7468a4bddb263c28d4ebfa273bf805 /actionpack/lib | |
parent | 24208d9a8662e2e35afc9c64695c600b2e960418 (diff) | |
parent | a7a422ec9726d3e4f4380b7406be30a4ed9d6187 (diff) | |
download | rails-d82e4c80a820280c8bb9957bd86453d8fea49384.tar.gz rails-d82e4c80a820280c8bb9957bd86453d8fea49384.tar.bz2 rails-d82e4c80a820280c8bb9957bd86453d8fea49384.zip |
Merge pull request #5619 from jcoleman/textarea-newline-fix-breaks-haml
Textarea newline fix breaks haml (3-2-stable)
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/tag_helper.rb | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 2267f3c185..edca950638 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1072,7 +1072,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 def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0") diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index 8c33ef09fa..2b0dd96435 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 @@ -125,7 +129,7 @@ module ActionView def content_tag_string(name, content, options, escape = true) tag_options = tag_options(options, escape) if options - "<#{name}#{tag_options}>#{escape ? ERB::Util.h(content) : content}</#{name}>".html_safe + "<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name.to_sym]}#{escape ? ERB::Util.h(content) : content}</#{name}>".html_safe end def tag_options(options, escape = true) |