summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorNicolas Chuche <nicolas.chuche@barna.be>2008-10-15 23:50:33 +0000
committerNicolas Chuche <nicolas.chuche@barna.be>2008-10-15 23:50:33 +0000
commita4b07a36edb567948739324b515abc5b7c28b241 (patch)
treebff7931c28bd326838ec32b076abaf9857587c86 /app
parent1894bef48a04bec77b4531eff2654ace8e7453f4 (diff)
downloadredmine-a4b07a36edb567948739324b515abc5b7c28b241.tar.gz
redmine-a4b07a36edb567948739324b515abc5b7c28b241.zip
add plain text option for mail #2029
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1932 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/mailer.rb15
-rw-r--r--app/views/settings/_notifications.rhtml4
2 files changed, 19 insertions, 0 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index a2d9ddba5..60a5a827d 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -219,6 +219,21 @@ class Mailer < ActionMailer::Base
body[:content_for_layout] = render(:file => method_name, :body => body)
ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}", :use_full_path => true)
end
+
+ # for the case of plain text only
+ def body(*params)
+ value = super(*params)
+ if Setting.plain_text_mail?
+ templates = Dir.glob("#{template_path}/#{@template}.text.plain.{rhtml,erb}")
+ unless String === @body or templates.empty?
+ template = File.basename(templates.first)
+ @body[:content_for_layout] = render(:file => template, :body => @body)
+ @body = ActionView::Base.new(template_root, @body, self).render(:file => "mailer/layout.text.plain.rhtml", :use_full_path => true)
+ return @body
+ end
+ end
+ return value
+ end
# Makes partial rendering work with Rails 1.2 (retro-compatibility)
def self.controller_path
diff --git a/app/views/settings/_notifications.rhtml b/app/views/settings/_notifications.rhtml
index 36701463a..a9a5f4742 100644
--- a/app/views/settings/_notifications.rhtml
+++ b/app/views/settings/_notifications.rhtml
@@ -8,6 +8,10 @@
<p><label><%= l(:setting_bcc_recipients) %></label>
<%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %>
<%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p>
+
+<p><label><%= l(:setting_plain_text_mail) %></label>
+<%= check_box_tag 'settings[plain_text_mail]', 1, Setting.plain_text_mail? %>
+<%= hidden_field_tag 'settings[plain_text_mail]', 0 %></p>
</div>
<fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>