From a200e97667a7367945389b5b6934c4a04d33f750 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 21 Oct 2007 14:10:07 +0000 Subject: [PATCH] * Emails footer can now be customized from the admin interface (Admin -> Email notifications). * Added html part to all email templates. git-svn-id: http://redmine.rubyforge.org/svn/trunk@858 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/admin_controller.rb | 1 + app/views/admin/mail_options.rhtml | 11 +++++++---- app/views/mailer/account_information.rhtml | 3 +++ app/views/mailer/account_information_fr.rhtml | 3 +++ app/views/mailer/account_information_pl.rhtml | 3 +++ app/views/mailer/attachments_added.text.html.rhtml | 2 ++ app/views/mailer/attachments_added.text.plain.rhtml | 2 ++ app/views/mailer/document_added.text.html.rhtml | 2 ++ app/views/mailer/document_added.text.plain.rhtml | 2 ++ app/views/mailer/issue_add.text.html.rhtml | 2 ++ app/views/mailer/issue_add.text.plain.rhtml | 2 ++ app/views/mailer/issue_edit.text.html.rhtml | 2 ++ app/views/mailer/issue_edit.text.plain.rhtml | 2 ++ app/views/mailer/lost_password.rhtml | 3 +++ app/views/mailer/message_posted.text.html.rhtml | 6 ++++++ ...e_posted.rhtml => message_posted.text.plain.rhtml} | 4 +++- app/views/mailer/news_added.text.html.rhtml | 2 ++ app/views/mailer/news_added.text.plain.rhtml | 2 ++ app/views/mailer/register.rhtml | 3 +++ app/views/mailer/test.text.html.rhtml | 5 +++++ .../mailer/{test.rhtml => test.text.plain.rhtml} | 4 +++- config/settings.yml | 4 ++++ lang/bg.yml | 1 + lang/cs.yml | 1 + lang/de.yml | 1 + lang/en.yml | 1 + lang/es.yml | 1 + lang/fr.yml | 1 + lang/he.yml | 1 + lang/it.yml | 1 + lang/ja.yml | 1 + lang/nl.yml | 1 + lang/pl.yml | 1 + lang/pt-br.yml | 1 + lang/pt.yml | 1 + lang/ro.yml | 1 + lang/sv.yml | 1 + lang/zh.yml | 1 + 38 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 app/views/mailer/message_posted.text.html.rhtml rename app/views/mailer/{message_posted.rhtml => message_posted.text.plain.rhtml} (65%) create mode 100644 app/views/mailer/test.text.html.rhtml rename app/views/mailer/{test.rhtml => test.text.plain.rhtml} (66%) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index bceab361..b448affc 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -49,6 +49,7 @@ class AdminController < ApplicationController @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted) if request.post? Setting.notified_events = (params[:notified_events] || []) + Setting.emails_footer = params[:emails_footer] if params[:emails_footer] flash[:notice] = l(:notice_successful_update) redirect_to :controller => 'admin', :action => 'mail_options' end diff --git a/app/views/admin/mail_options.rhtml b/app/views/admin/mail_options.rhtml index 2f61af4f..5f1fd9bb 100644 --- a/app/views/admin/mail_options.rhtml +++ b/app/views/admin/mail_options.rhtml @@ -8,12 +8,15 @@
<%=l(:text_select_mail_notifications)%> <% @notifiables.each do |notifiable| %> -

+
<% end %> -
+

<%= check_all_links('mail-options-form') %>

+
+ +
Emails footer +<%= text_area_tag 'emails_footer', Setting.emails_footer, :class => 'wiki-edit', :rows => 5 %>
-

<%= check_all_links('mail-options-form') %>

<%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/mailer/account_information.rhtml b/app/views/mailer/account_information.rhtml index 058d5fc4..98b2916a 100644 --- a/app/views/mailer/account_information.rhtml +++ b/app/views/mailer/account_information.rhtml @@ -7,3 +7,6 @@ Log in: <%= url_for :only_path => false, :host => Setting.host_name, :controller <% unless @user.auth_source %> You can change your password here: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'my', :action => 'account' %> <% end %> + +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/account_information_fr.rhtml b/app/views/mailer/account_information_fr.rhtml index 9210988f..71df3453 100644 --- a/app/views/mailer/account_information_fr.rhtml +++ b/app/views/mailer/account_information_fr.rhtml @@ -7,3 +7,6 @@ Pour se connecter à l'application: <%= url_for :only_path => false, :host => Se <% unless @user.auth_source %> Vous pouvez changer votre mot de passe à l'adresse: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'my', :action => 'account' %> <% end %> + +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/account_information_pl.rhtml b/app/views/mailer/account_information_pl.rhtml index f73108a7..7f9060b2 100644 --- a/app/views/mailer/account_information_pl.rhtml +++ b/app/views/mailer/account_information_pl.rhtml @@ -7,3 +7,6 @@ Zaloguj: <%= url_for :only_path => false, :host => Setting.host_name, :controlle <% unless @user.auth_source %> Możesz zmienić swoje hasło tutaj: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'my', :action => 'account' %> <% end %> + +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/attachments_added.text.html.rhtml b/app/views/mailer/attachments_added.text.html.rhtml index 336cad69..9bb30db1 100644 --- a/app/views/mailer/attachments_added.text.html.rhtml +++ b/app/views/mailer/attachments_added.text.html.rhtml @@ -3,3 +3,5 @@ +
+<%= textilizable Setting.emails_footer %> diff --git a/app/views/mailer/attachments_added.text.plain.rhtml b/app/views/mailer/attachments_added.text.plain.rhtml index 22df2203..7e4245ef 100644 --- a/app/views/mailer/attachments_added.text.plain.rhtml +++ b/app/views/mailer/attachments_added.text.plain.rhtml @@ -2,3 +2,5 @@ - <%= attachment.filename %><% end %> <%= url_for @url %> +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/document_added.text.html.rhtml b/app/views/mailer/document_added.text.html.rhtml index 2a574a1c..d7d6558b 100644 --- a/app/views/mailer/document_added.text.html.rhtml +++ b/app/views/mailer/document_added.text.html.rhtml @@ -2,3 +2,5 @@ (<%= @document.category.name %>)

<%= textilizable(@document.description) %> +
+<%= textilizable Setting.emails_footer %> diff --git a/app/views/mailer/document_added.text.plain.rhtml b/app/views/mailer/document_added.text.plain.rhtml index ee8f3e6b..bb42758f 100644 --- a/app/views/mailer/document_added.text.plain.rhtml +++ b/app/views/mailer/document_added.text.plain.rhtml @@ -2,3 +2,5 @@ <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> <%= @document.description %> +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/issue_add.text.html.rhtml b/app/views/mailer/issue_add.text.html.rhtml index a7ef8ece..7a0712c3 100644 --- a/app/views/mailer/issue_add.text.html.rhtml +++ b/app/views/mailer/issue_add.text.html.rhtml @@ -1,3 +1,5 @@ <%= l(:text_issue_added, "##{@issue.id}") %>
<%= render :file => "_issue_text_html", :use_full_path => true, :locals => { :issue => @issue } %> +
+<%= textilizable Setting.emails_footer %> diff --git a/app/views/mailer/issue_add.text.plain.rhtml b/app/views/mailer/issue_add.text.plain.rhtml index a9aa13b3..a5740ad8 100644 --- a/app/views/mailer/issue_add.text.plain.rhtml +++ b/app/views/mailer/issue_add.text.plain.rhtml @@ -1,3 +1,5 @@ <%= l(:text_issue_added, "##{@issue.id}") %> ---------------------------------------- <%= render :file => "_issue_text_plain", :use_full_path => true, :locals => { :issue => @issue } %> +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/issue_edit.text.html.rhtml b/app/views/mailer/issue_edit.text.html.rhtml index 59c767c9..fddd1943 100644 --- a/app/views/mailer/issue_edit.text.html.rhtml +++ b/app/views/mailer/issue_edit.text.html.rhtml @@ -8,3 +8,5 @@ <%= textilizable(@journal.notes) %>
<%= render :file => "_issue_text_html", :use_full_path => true, :locals => { :issue => @issue } %> +
+<%= textilizable Setting.emails_footer %> diff --git a/app/views/mailer/issue_edit.text.plain.rhtml b/app/views/mailer/issue_edit.text.plain.rhtml index 4431d46d..4ecc3754 100644 --- a/app/views/mailer/issue_edit.text.plain.rhtml +++ b/app/views/mailer/issue_edit.text.plain.rhtml @@ -6,3 +6,5 @@ <%= @journal.notes if @journal.notes? %> ---------------------------------------- <%= render :file => "_issue_text_plain", :use_full_path => true, :locals => { :issue => @issue } %> +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/lost_password.rhtml b/app/views/mailer/lost_password.rhtml index ea2e58ab..5b5bb3b9 100644 --- a/app/views/mailer/lost_password.rhtml +++ b/app/views/mailer/lost_password.rhtml @@ -1,2 +1,5 @@ <%= l(:mail_body_lost_password) %> <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'account', :action => 'lost_password', :token => @token.value %> + +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/message_posted.text.html.rhtml b/app/views/mailer/message_posted.text.html.rhtml new file mode 100644 index 00000000..89346e72 --- /dev/null +++ b/app/views/mailer/message_posted.text.html.rhtml @@ -0,0 +1,6 @@ +<%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to @message.subject, :only_path => false, :host => Setting.host_name, :controller => 'messages', :action => 'show', :board_id => @message.board_id, :id => @message.root %>
+<%= @message.author.name %> + +<%= textilizable @message.content %> +
+<%= textilizable Setting.emails_footer %> diff --git a/app/views/mailer/message_posted.rhtml b/app/views/mailer/message_posted.text.plain.rhtml similarity index 65% rename from app/views/mailer/message_posted.rhtml rename to app/views/mailer/message_posted.text.plain.rhtml index 10b46c41..97539fd0 100644 --- a/app/views/mailer/message_posted.rhtml +++ b/app/views/mailer/message_posted.text.plain.rhtml @@ -1,4 +1,6 @@ -<%= l(:field_author) %>: <%= @message.author.name %> <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'messages', :action => 'show', :board_id => @message.board_id, :id => @message.root %> +<%= @message.author.name %> <%= @message.content %> +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/news_added.text.html.rhtml b/app/views/mailer/news_added.text.html.rhtml index 7de6f48e..e99dfd5b 100644 --- a/app/views/mailer/news_added.text.html.rhtml +++ b/app/views/mailer/news_added.text.html.rhtml @@ -2,3 +2,5 @@ <%= @news.author.name %> <%= textilizable(@news.description) %> +
+<%= textilizable Setting.emails_footer %> diff --git a/app/views/mailer/news_added.text.plain.rhtml b/app/views/mailer/news_added.text.plain.rhtml index 7ee24b10..1a04af9c 100644 --- a/app/views/mailer/news_added.text.plain.rhtml +++ b/app/views/mailer/news_added.text.plain.rhtml @@ -3,3 +3,5 @@ <%= @news.author.name %> <%= @news.description %> +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/register.rhtml b/app/views/mailer/register.rhtml index 7e4f95f4..55fcf1e1 100644 --- a/app/views/mailer/register.rhtml +++ b/app/views/mailer/register.rhtml @@ -1,2 +1,5 @@ <%= l(:mail_body_register) %> <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'account', :action => 'register', :token => @token.value %> + +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/app/views/mailer/test.text.html.rhtml b/app/views/mailer/test.text.html.rhtml new file mode 100644 index 00000000..f1cb1881 --- /dev/null +++ b/app/views/mailer/test.text.html.rhtml @@ -0,0 +1,5 @@ +

This is a test email sent by Redmine.
+Redmine URL: <%= link_to url_for(:only_path => false, :host => Setting.host_name, :controller => 'welcome'), + url_for(:only_path => false, :host => Setting.host_name, :controller => 'welcome') %>

+
+<%= textilizable Setting.emails_footer %> diff --git a/app/views/mailer/test.rhtml b/app/views/mailer/test.text.plain.rhtml similarity index 66% rename from app/views/mailer/test.rhtml rename to app/views/mailer/test.text.plain.rhtml index deffa53e..0519caab 100644 --- a/app/views/mailer/test.rhtml +++ b/app/views/mailer/test.text.plain.rhtml @@ -1,3 +1,5 @@ This is a test email sent by Redmine. - Redmine URL: <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'welcome' %> + +---------------------------------------- +<%= Setting.emails_footer %> diff --git a/config/settings.yml b/config/settings.yml index fbc9da20..ff695cc7 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -96,4 +96,8 @@ repositories_encodings: default: '' ui_theme: default: '' +emails_footer: + default: |- + You have received this notification because you have either subscribed to it, or are involved in. + To change your notification preferences, please click here: http://hostname/my/account \ No newline at end of file diff --git a/lang/bg.yml b/lang/bg.yml index d4ef3511..0b333e48 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/cs.yml b/lang/cs.yml index b7b88884..e947b117 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/de.yml b/lang/de.yml index 793876fc..93190fb7 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/en.yml b/lang/en.yml index d0dc6466..88cbcd73 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -188,6 +188,7 @@ setting_date_format: Date format setting_cross_project_issue_relations: Allow cross-project issue relations setting_issue_list_default_columns: Default columns displayed on the issue list setting_repositories_encodings: Repositories encodings +setting_emails_footer: Emails footer label_user: User label_user_plural: Users diff --git a/lang/es.yml b/lang/es.yml index d66220e0..f55d5849 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -534,3 +534,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/fr.yml b/lang/fr.yml index ce543b68..70b60368 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -188,6 +188,7 @@ setting_date_format: Format de date setting_cross_project_issue_relations: Autoriser les relations entre demandes de différents projets setting_issue_list_default_columns: Colonnes affichées par défaut sur la liste des demandes setting_repositories_encodings: Encodages des dépôts +setting_emails_footer: Pied-de-page des emails label_user: Utilisateur label_user_plural: Utilisateurs diff --git a/lang/he.yml b/lang/he.yml index 0a310924..8cefd127 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/it.yml b/lang/it.yml index b4888808..840d298f 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/ja.yml b/lang/ja.yml index 3016d385..fc42cee5 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -532,3 +532,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/nl.yml b/lang/nl.yml index 9b7d73a9..fc6d9bbe 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -532,3 +532,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/pl.yml b/lang/pl.yml index 1b8602ab..4565b257 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/pt-br.yml b/lang/pt-br.yml index da25974a..942de55a 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/pt.yml b/lang/pt.yml index 94dace1d..49176d60 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/ro.yml b/lang/ro.yml index 93352c8c..8e7b8a2b 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -531,3 +531,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/sv.yml b/lang/sv.yml index 139105ed..878eb144 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -532,3 +532,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer diff --git a/lang/zh.yml b/lang/zh.yml index 9fda045b..34e56ea3 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -534,3 +534,4 @@ text_user_mail_option: "For unselected projects, you will only receive notificat label_user_mail_option_selected: "For any event on the selected projects only..." label_user_mail_option_all: "For any event on all my projects" label_user_mail_option_none: "Only for things I watch or I'm involved in" +setting_emails_footer: Emails footer