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