@@ -219,6 +219,21 class Mailer < ActionMailer::Base | |||
|
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_text_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 |
@@ -8,6 +8,10 | |||
|
8 | 8 | <p><label><%= l(:setting_bcc_recipients) %></label> |
|
9 | 9 | <%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %> |
|
10 | 10 | <%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p> |
|
11 | ||
|
12 | <p><label><%= l(:setting_plain_text_mail) %></label> | |
|
13 | <%= check_box_tag 'settings[plain_text_mail]', 1, Setting.plain_text_mail? %> | |
|
14 | <%= hidden_field_tag 'settings[plain_text_mail]', 0 %></p> | |
|
11 | 15 | </div> |
|
12 | 16 | |
|
13 | 17 | <fieldset class="box" id="notified_events"><legend><%=l(:text_select_mail_notifications)%></legend> |
@@ -46,6 +46,8 mail_from: | |||
|
46 | 46 | default: redmine@example.net |
|
47 | 47 | bcc_recipients: |
|
48 | 48 | default: 1 |
|
49 | plain_text_mail: | |
|
50 | default: 0 | |
|
49 | 51 | text_formatting: |
|
50 | 52 | default: textile |
|
51 | 53 | wiki_compression: |
@@ -640,3 +640,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
640 | 640 | notice_unable_delete_version: Unable to delete version |
|
641 | 641 | label_renamed: renamed |
|
642 | 642 | label_copied: copied |
|
643 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 default_activity_development: Desenvolupament | |||
|
641 | 641 | enumeration_issue_priorities: Prioritat dels assumptes |
|
642 | 642 | enumeration_doc_categories: Categories del document |
|
643 | 643 | enumeration_activities: Activitats (seguidor de temps) |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -645,3 +645,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
645 | 645 | notice_unable_delete_version: Unable to delete version |
|
646 | 646 | label_renamed: renamed |
|
647 | 647 | label_copied: copied |
|
648 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 default_activity_development: Udvikling | |||
|
641 | 641 | enumeration_issue_priorities: Sagsprioriteter |
|
642 | 642 | enumeration_doc_categories: Dokumentkategorier |
|
643 | 643 | enumeration_activities: Aktiviteter (tidsregistrering) |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 default_activity_development: Entwicklung | |||
|
641 | 641 | enumeration_issue_priorities: Ticket-Prioritäten |
|
642 | 642 | enumeration_doc_categories: Dokumentenkategorien |
|
643 | 643 | enumeration_activities: Aktivitäten (Zeiterfassung) |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -195,6 +195,7 setting_attachment_max_size: Attachment max. size | |||
|
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_text_mail: plain text mail (no HTML) | |
|
198 | 199 | setting_host_name: Host name |
|
199 | 200 | setting_text_formatting: Text formatting |
|
200 | 201 | setting_wiki_compression: Wiki history compression |
@@ -643,3 +643,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
643 | 643 | notice_unable_delete_version: Unable to delete version |
|
644 | 644 | label_renamed: renamed |
|
645 | 645 | label_copied: copied |
|
646 | setting_plain_text_mail: plain text only (no HTML) |
@@ -640,3 +640,4 setting_commit_logs_encoding: Commit messages encoding | |||
|
640 | 640 | notice_unable_delete_version: Unable to delete version |
|
641 | 641 | label_renamed: renamed |
|
642 | 642 | label_copied: copied |
|
643 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 enumeration_issue_priorities: Priorités des demandes | |||
|
641 | 641 | enumeration_doc_categories: Catégories des documents |
|
642 | 642 | enumeration_activities: Activités (suivi du temps) |
|
643 | 643 | notice_unable_delete_version: Unable to delete version |
|
644 | setting_plain_text_mail: mail texte brut (non HTML) |
@@ -640,3 +640,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
640 | 640 | notice_unable_delete_version: Unable to delete version |
|
641 | 641 | label_renamed: renamed |
|
642 | 642 | label_copied: copied |
|
643 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 setting_sequential_project_identifiers: Szekvenciális projekt azonosítók gene | |||
|
641 | 641 | notice_unable_delete_version: A verziót nem lehet törölni |
|
642 | 642 | label_renamed: átnevezve |
|
643 | 643 | label_copied: lemásolva |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -640,3 +640,4 setting_sequential_project_identifiers: Genera progetti con identificativi in se | |||
|
640 | 640 | notice_unable_delete_version: Impossibile cancellare la versione |
|
641 | 641 | label_renamed: rinominato |
|
642 | 642 | label_copied: copiato |
|
643 | setting_plain_text_mail: plain text only (no HTML) |
@@ -552,6 +552,7 notice_account_pending: アカウントは作成済みで、管理者の承認 | |||
|
552 | 552 | field_time_zone: タイムゾーン |
|
553 | 553 | text_caracters_minimum: 最低%d文字の長さが必要です |
|
554 | 554 | setting_bcc_recipients: ブラインドカーボンコピーで受信(bcc) |
|
555 | setting_plain_text_mail: プレインテキストのみ(HTMLなし) | |
|
555 | 556 | button_annotate: 注釈 |
|
556 | 557 | label_issues_by: %s別のチケット |
|
557 | 558 | field_searchable: Searchable |
@@ -640,3 +640,4 setting_sequential_project_identifiers: 프로젝트 실별자를 순자적으 | |||
|
640 | 640 | notice_unable_delete_version: 삭제 할 수 없는 버전 입니다. |
|
641 | 641 | label_renamed: renamed |
|
642 | 642 | label_copied: copied |
|
643 | setting_plain_text_mail: plain text only (no HTML) |
@@ -642,3 +642,4 button_quote: Cituoti | |||
|
642 | 642 | notice_unable_delete_version: Neimanoma panaikinti versiją |
|
643 | 643 | label_renamed: pervardintas |
|
644 | 644 | label_copied: nukopijuotas |
|
645 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,4 +641,5 button_quote: Citaat | |||
|
641 | 641 | setting_sequential_project_identifiers: Genereer sequentiële projectidentiteiten |
|
642 | 642 | notice_unable_delete_version: Niet mogelijk om deze versie te verwijderen. |
|
643 | 643 | label_renamed: hernoemd |
|
644 | label_copied: gekopieerd No newline at end of file | |
|
644 | label_copied: gekopieerd | |
|
645 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
641 | 641 | notice_unable_delete_version: Unable to delete version |
|
642 | 642 | label_renamed: renamed |
|
643 | 643 | label_copied: copied |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -646,3 +646,4 label_renamed: przemianowano | |||
|
646 | 646 | label_copied: skopiowano |
|
647 | 647 | field_vf_watcher: Obserwator |
|
648 | 648 | field_vf_personnel: Personel |
|
649 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 enumeration_activities: Atividades (time tracking) | |||
|
641 | 641 | notice_unable_delete_version: Não foi possível excluir a versão |
|
642 | 642 | label_renamed: renomeado |
|
643 | 643 | label_copied: copiado |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -642,3 +642,4 default_activity_development: Desenvolvimento | |||
|
642 | 642 | enumeration_issue_priorities: Prioridade de tarefas |
|
643 | 643 | enumeration_doc_categories: Categorias de documentos |
|
644 | 644 | enumeration_activities: Actividades (Contagem de tempo) |
|
645 | setting_plain_text_mail: plain text only (no HTML) |
@@ -640,3 +640,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
640 | 640 | notice_unable_delete_version: Unable to delete version |
|
641 | 641 | label_renamed: renamed |
|
642 | 642 | label_copied: copied |
|
643 | setting_plain_text_mail: plain text only (no HTML) |
@@ -673,3 +673,4 text_user_wrote: '%s написал(а):' | |||
|
673 | 673 | text_wiki_destroy_confirmation: Вы уверены, что хотите удалить данную Wiki и все содержимое? |
|
674 | 674 | text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний |
|
675 | 675 | |
|
676 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
641 | 641 | notice_unable_delete_version: Unable to delete version |
|
642 | 642 | label_renamed: renamed |
|
643 | 643 | label_copied: copied |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
641 | 641 | notice_unable_delete_version: Unable to delete version |
|
642 | 642 | label_renamed: renamed |
|
643 | 643 | label_copied: copied |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -643,3 +643,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
643 | 643 | notice_unable_delete_version: Unable to delete version |
|
644 | 644 | label_renamed: renamed |
|
645 | 645 | label_copied: copied |
|
646 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 general_csv_decimal_separator: '.' | |||
|
641 | 641 | notice_unable_delete_version: Unable to delete version |
|
642 | 642 | label_renamed: renamed |
|
643 | 643 | label_copied: copied |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -642,3 +642,4 setting_sequential_project_identifiers: Generate sequential project identifiers | |||
|
642 | 642 | notice_unable_delete_version: Unable to delete version |
|
643 | 643 | label_renamed: renamed |
|
644 | 644 | label_copied: copied |
|
645 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 default_activity_development: 開發 | |||
|
641 | 641 | enumeration_issue_priorities: 項目優先權 |
|
642 | 642 | enumeration_doc_categories: 文件分類 |
|
643 | 643 | enumeration_activities: 活動 (時間追蹤) |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -641,3 +641,4 default_activity_development: 开发 | |||
|
641 | 641 | enumeration_issue_priorities: 问题优先级 |
|
642 | 642 | enumeration_doc_categories: 文档类别 |
|
643 | 643 | enumeration_activities: 活动(时间跟踪) |
|
644 | setting_plain_text_mail: plain text only (no HTML) |
@@ -32,12 +32,22 class MailerTest < Test::Unit::TestCase | |||
|
32 | 32 | assert_kind_of TMail::Mail, mail |
|
33 | 33 | # link to the main ticket |
|
34 | 34 | assert mail.body.include?('<a href="https://mydomain.foo/issues/show/1">Bug #1: Can\'t print recipes</a>') |
|
35 | ||
|
35 | ||
|
36 | 36 | # link to a referenced ticket |
|
37 | 37 | assert mail.body.include?('<a href="https://mydomain.foo/issues/show/2" class="issue" title="Add ingredients categories (Assigned)">#2</a>') |
|
38 | 38 | # link to a changeset |
|
39 | 39 | assert mail.body.include?('<a href="https://mydomain.foo/repositories/revision/ecookbook/2" class="changeset" title="This commit fixes #1, #2 and references #1 & #3">r2</a>') |
|
40 | 40 | end |
|
41 | ||
|
42 | def test_plain_text_mail | |
|
43 | Setting.plain_text_mail = 1 | |
|
44 | journal = Journal.find(2) | |
|
45 | Mailer.deliver_issue_edit(journal) | |
|
46 | mail = ActionMailer::Base.deliveries.last | |
|
47 | assert !mail.body.include?('<a href="https://mydomain.foo/issues/show/1">Bug #1: Can\'t print recipes</a>') | |
|
48 | end | |
|
49 | ||
|
50 | ||
|
41 | 51 | |
|
42 | 52 | # test mailer methods for each language |
|
43 | 53 | def test_issue_add |
General Comments 0
You need to be logged in to leave comments.
Login now