diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-02 06:46:41 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-02 06:46:41 +0000 |
commit | a53372c273a06681c3e4e51faa5b0f7757d35d0b (patch) | |
tree | 3e01a29582ab4b85d10e67dc1e98722ff380f840 /actionpack/lib/action_view | |
parent | 3553b59d3c27ed06dfa9bb5a2265e101d2f3c2f6 (diff) | |
download | rails-a53372c273a06681c3e4e51faa5b0f7757d35d0b.tar.gz rails-a53372c273a06681c3e4e51faa5b0f7757d35d0b.tar.bz2 rails-a53372c273a06681c3e4e51faa5b0f7757d35d0b.zip |
Added that UrlHelper#mail_to will now also encode the default link title #749 [f.svehla@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1601 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/active_record_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index deb3effb1c..3cf7ad0d4f 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -31,7 +31,7 @@ module ActionView # </p> # <p> # <label for="post_body">Body</label><br /> - # <textarea cols="40" id="post_body" name="post[body]" rows="20" wrap="virtual"> + # <textarea cols="40" id="post_body" name="post[body]" rows="20"> # Back to the hill and over it again! # </textarea> # </p> diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 44f5ece273..43a2c96226 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -187,6 +187,10 @@ module ActionView extras << "subject=#{CGI.escape(subject).gsub("+", "%20")}&" unless subject.nil? extras = "?" << extras.gsub!(/&?$/,"") unless extras.empty? + email_address_obfuscated = email_address.dup + email_address_obfuscated.gsub!(/@/, html_options.delete("replace_at")) if html_options.has_key?("replace_at") + email_address_obfuscated.gsub!(/\./, html_options.delete("replace_dot")) if html_options.has_key?("replace_dot") + if encode == 'javascript' tmp = "document.write('#{content_tag("a", name || email_address, html_options.merge({ "href" => "mailto:"+email_address.to_s+extras }))}');" for i in 0...tmp.length @@ -201,9 +205,9 @@ module ActionView string << email_address[i,1] end end - content_tag "a", name || email_address, html_options.merge({ "href" => "mailto:#{string}#{extras}" }) + content_tag "a", name || email_address_obfuscated, html_options.merge({ "href" => "mailto:#{string}#{extras}" }) else - content_tag "a", name || email_address, html_options.merge({ "href" => "mailto:#{email_address}#{extras}" }) + content_tag "a", name || email_address_obfuscated, html_options.merge({ "href" => "mailto:#{email_address}#{extras}" }) end end |