Merged in latest changes from rails/master

This commit is contained in:
Mikel Lindsaar
2009-12-17 12:23:08 +11:00
parent 418639b4cf
commit 63b124b043
4 changed files with 24 additions and 3 deletions

View File

@@ -34,11 +34,12 @@ module ActionMailer
autoload :DeprecatedBody
autoload :Base
autoload :DeliveryMethod
autoload :MailHelper
autoload :Part
autoload :PartContainer
autoload :Quoting
autoload :TestCase
autoload :TestHelper
end
module Text

View File

@@ -258,7 +258,8 @@ module ActionMailer #:nodoc:
include AbstractController::Layouts
include AbstractController::Helpers
helper ActionMailer::MailHelper
if Object.const_defined?(:ActionController)
include ActionController::UrlWriter
end

View File

@@ -0,0 +1,19 @@
module ActionMailer
module MailHelper
# Uses Text::Format to take the text and format it, indented two spaces for
# each line, and wrapped at 72 columns.
def block_format(text)
formatted = text.split(/\n\r\n/).collect { |paragraph|
Text::Format.new(
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
).format
}.join("\n")
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted
end
end
end

View File

@@ -56,7 +56,7 @@ end
class MailerHelperTest < Test::Unit::TestCase
def new_mail( charset="utf-8" )
mail = Mail.new
mail.content_type(["text", "plain", { "charset" => charset }])
mail.set_content_type "text", "plain", { "charset" => charset } if charset
mail
end