plain-text-mail.patch

Yuki Sonoda, 2008-10-14 12:37

Download (3.18 KB)

View differences:

app/models/mailer.rb
219 219
    body[:content_for_layout] = render(:file => method_name, :body => body)
220 220
    ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}", :use_full_path => true)
221 221
  end
222

  
223
  # for the case of plain text only
224
  def body(*params)
225
    value = super(*params)
226
    if Setting.plain_only_mail?
227
      templates = Dir.glob("#{template_path}/#{@template}.text.plain.{rhtml,erb}")
228
      unless String === @body or templates.empty?
229
        template = File.basename(templates.first)
230
        @body[:content_for_layout] = render(:file => template, :body => @body)
231
        @body = ActionView::Base.new(template_root, @body, self).render(:file => "mailer/layout.text.plain.rhtml", :use_full_path => true)
232
        return @body
233
      end
234
    end
235
    return value
236
  end
222 237
  
223 238
  # Makes partial rendering work with Rails 1.2 (retro-compatibility)
224 239
  def self.controller_path
app/views/settings/_notifications.rhtml
10 10
<%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p>
11 11
</div>
12 12

  
13
<div class="box tabular">
14
  <p><label><%= l(:setting_plain_only_mail) %></label>
15
  <%= check_box_tag 'settings[plain_only_mail]', 1, Setting.plain_only_mail? %>
16
  <%= hidden_field_tag 'settings[plain_only_mail]', 0 %></p>
17
</div>
18

  
13 19
<fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend>
14 20
<% @notifiables.each do |notifiable| %>
15 21
  <label><%= check_box_tag 'settings[notified_events][]', notifiable, Setting.notified_events.include?(notifiable) %>
config/settings.yml
46 46
  default: redmine@example.net
47 47
bcc_recipients:
48 48
  default: 1
49
plain_only_mail:
50
  default: 0
49 51
text_formatting:
50 52
  default: textile
51 53
wiki_compression:
lang/en.yml
195 195
setting_issues_export_limit: Issues export limit
196 196
setting_mail_from: Emission email address
197 197
setting_bcc_recipients: Blind carbon copy recipients (bcc)
198
setting_plain_only_mail: plain text only (no HTML)
198 199
setting_host_name: Host name
199 200
setting_text_formatting: Text formatting
200 201
setting_wiki_compression: Wiki history compression
lang/ja.yml
552 552
field_time_zone: タイムゾーン
553 553
text_caracters_minimum: 最低%d文字の長さが必要です
554 554
setting_bcc_recipients: ブラインドカーボンコピーで受信(bcc)
555
setting_plain_only_mail: プレインテキストのみ(HTMLなし)
555 556
button_annotate: 注釈
556 557
label_issues_by: %s別のチケット
557 558
field_searchable: Searchable