diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb index b6de1620a..61e3bd465 100644 --- a/app/helpers/mailer_helper.rb +++ b/app/helpers/mailer_helper.rb @@ -15,4 +15,40 @@ module MailerHelper style: "color: #2895F1; text-decoration:none;" ) end + + def mailer_simple_format(text) + simple_format(sanitize_and_auto_link(text), { style: css_for_mailer_text }, sanitize: false) + end + + def mailer_font_family + "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;" + end + + def css_for_mailer_heading + mailer_font_family + "font-size: 48px;" + end + + def css_for_mailer_subheading + mailer_font_family + "font-size: 20px; font-weight: bold; line-height: 24px; margin-bottom: 2px;" + end + + def css_for_mailer_text + mailer_font_family + "font-size: 14px;font-weight: normal;line-height: 24px;" + end + + def css_for_mailer_button + mailer_font_family + "background: #004a83;border-radius: 6px;color: #fff!important;display: inline-block;font-weight: bold;margin: 0;min-width: 200px;padding: 10px 15px;text-align: center;text-decoration: none;" + end + + def css_for_mailer_link + "color: #1779ba; text-decoration: underline;" + end + + def css_for_mailer_quote + "border-left: 2px solid #DEE0E3;font-style: italic;margin-left: 20px;padding:0px 10px;" + end + + def css_for_mailer_content + "padding-bottom: 20px; padding-left: 10px;" + end end diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb index 89f2a76b6..30d404a9f 100644 --- a/app/mailers/devise_mailer.rb +++ b/app/mailers/devise_mailer.rb @@ -1,5 +1,5 @@ class DeviseMailer < Devise::Mailer - helper :application, :settings + helper :application, :settings, :mailer include Devise::Controllers::UrlHelpers default template_path: "devise/mailer" diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index c81e6fc74..40f39de2b 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -1,18 +1,20 @@ -
+
<%= t("devise_views.mailer.confirmation_instructions.welcome") %> <%= @email %>
-+
<%= t("devise_views.mailer.confirmation_instructions.text") %>
-- <%= link_to t("devise_views.mailer.confirmation_instructions.confirm_link"), confirmation_url(@resource, confirmation_token: @token), style: "color: #2895F1; text-decoration:none;" %> +
+ <%= link_to t("devise_views.mailer.confirmation_instructions.confirm_link"), + confirmation_url(@resource, confirmation_token: @token), + style: css_for_mailer_link %>
+
<%= t("devise_views.mailer.reset_password_instructions.hello") %> <%= @resource.email %>
-+
<%= t("devise_views.mailer.reset_password_instructions.text") %>
-- <%= link_to t("devise_views.mailer.reset_password_instructions.change_link"), edit_password_url(@resource, reset_password_token: @token), style: "color: #2895F1; text-decoration:none;" %> +
+ <%= link_to t("devise_views.mailer.reset_password_instructions.change_link"), + edit_password_url(@resource, reset_password_token: @token), + style: css_for_mailer_link %>
-+
<%= t("devise_views.mailer.reset_password_instructions.ignore_text") %> <%= t("devise_views.mailer.reset_password_instructions.info_text") %>
+
<%= t("devise_views.mailer.unlock_instructions.hello") %> <%= @resource.email %>
-+
<%= t("devise_views.mailer.unlock_instructions.info_text") %>
-+
<%= t("devise_views.mailer.unlock_instructions.instructions_text") %>
-- <%= link_to t("devise_views.mailer.unlock_instructions.unlock_link"), unlock_url(@resource, unlock_token: @token), style: "color: #2895F1; text-decoration:none;" %> +
+ <%= link_to t("devise_views.mailer.unlock_instructions.unlock_link"), + unlock_url(@resource, unlock_token: @token), + style: css_for_mailer_link %>
+
<%= t("mailers.already_confirmed.info") %>
-+
<%= t("mailers.already_confirmed.new_password") %>
-- <%= link_to t("devise_views.shared.links.new_password"), new_password_url(@user), style: "color: #2895F1; text-decoration:none;" %> + +
+ <%= link_to t("devise_views.shared.links.new_password"), + new_password_url(@user), style: css_for_mailer_link %>
+
<%= sanitize(t("mailers.budget_investment_created.intro", author: @investment.author.name)) %>
-+
<%= sanitize(t("mailers.budget_investment_created.text", investment: @investment.title, budget: @investment.budget.name)) %>
-+
<%= sanitize(t("mailers.budget_investment_created.follow", - link: link_to(t("mailers.budget_investment_created.follow_link"), budgets_url))) %> + link: link_to(t("mailers.budget_investment_created.follow_link"), budgets_url, + style: css_for_mailer_link)), attributes: %w[href style]) %>
| - <%= link_to budget_investment_url(@investment.budget, @investment, anchor: "social-share"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> - <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> - <%= t("mailers.budget_investment_created.share") %> + <%= link_to budget_investment_url(@investment.budget, @investment, anchor: "social-share"), style: css_for_mailer_button do %> + <%= image_tag("icon_mailer_share.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> + <%= t("mailers.budget_investment_created.share") %> <% end %> |
+
<%= t("mailers.budget_investment_created.sincerely") %>
+
<%= t("mailers.budget_investment_selected.hi") %>
-+
<%= t("mailers.budget_investment_selected.share") %>
@@ -12,20 +12,20 @@+
<%= t("mailers.budget_investment_selected.thanks") %>
-+
<%= t("mailers.budget_investment_selected.sincerely") %>
diff --git a/app/views/mailer/budget_investment_unfeasible.html.erb b/app/views/mailer/budget_investment_unfeasible.html.erb index b20d1e421..49f9d5997 100644 --- a/app/views/mailer/budget_investment_unfeasible.html.erb +++ b/app/views/mailer/budget_investment_unfeasible.html.erb @@ -1,24 +1,25 @@ -+
<%= t("mailers.budget_investment_unfeasible.hi") %>
-+
<%= @investment.unfeasibility_explanation %>
-- <%= sanitize(t("mailers.budget_investment_unfeasible.new", - url: link_to(t("mailers.budget_investment_unfeasible.new_href"), - new_budget_investment_url(@investment.budget), style: "color: #2895F1; text-decoration: underline;"))) %> +
+ <%= sanitize(t("mailers.budget_investment_unfeasible.new", + url: link_to(t("mailers.budget_investment_unfeasible.new_href"), + new_budget_investment_url(@investment.budget), style: css_for_mailer_link)), + attributes: %w[href style]) %>
-+
<%= t("mailers.budget_investment_unfeasible.sorry") %>
-+
<%= t("mailers.budget_investment_unfeasible.sincerely") %>
+
<%= t("mailers.budget_investment_unselected.hi") %>
-+
<%= t("mailers.budget_investment_unselected.thanks") %>
-+
<%= t("mailers.budget_investment_unselected.sincerely") %>
+
<%= t("mailers.comment.hi") %> <%= @commentable.author.name %>,
-+
<%= sanitize(t("mailers.comment.new_comment_by", commenter: @comment.author.name)) %> - <%= link_to @commentable.title, commentable_url(@commentable), style: "color: #2895F1; text-decoration:none;" %> + <%= link_to @commentable.title, commentable_url(@commentable), style: css_for_mailer_link %>
-+
<%= sanitize(t("mailers.config.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), - style: "color: #2895F1; text-decoration: none;" + style: css_for_mailer_link ), notification: User.human_attribute_name(:email_on_comment) ), attributes: %w[href style]) %> diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index 4490113b3..06c3d849a 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -1,17 +1,17 @@ -
| - <%= link_to user_url(@direct_message.sender), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;", target: "_blank" do %> + <%= link_to user_url(@direct_message.sender), style: css_for_mailer_button, target: "_blank" do %> <%= image_tag("icon_mailer_reply.png", style: "border: 0; display: inline-block; width: 100%; max-width: 12px; vertical-align: sub;", alt: "") %> <%= t("mailers.direct_message_for_receiver.reply", sender: @direct_message.sender.name) %> @@ -21,11 +21,11 @@ |
+
<%= sanitize(t("mailers.direct_message_for_receiver.unsubscribe_text", notifications: link_to(t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), - style: "color: #2895F1; text-decoration: none;")), + style: css_for_mailer_link)), attributes: %w[href style]) %>
+
<%= sanitize(t("mailers.direct_message_for_sender.title", receiver: @direct_message.receiver.name)) %>
-<%= @direct_message.title %> - +
-<%= t("mailers.email_verification.title") %> - - -
- <%= sanitize(t("mailers.email_verification.instructions", - verification_link: link_to( - t("mailers.email_verification.click_here_to_verify"), - email_url(email_verification_token: @token)))) %>
-- <%= sanitize(t("mailers.email_verification.instructions_2", - document_type: humanize_document_type(@document_type), - document_number: @document_number)) %> +
+ <%= sanitize(t("mailers.email_verification.instructions", + verification_link: link_to( + t("mailers.email_verification.click_here_to_verify"), + email_url(email_verification_token: @token), style: css_for_mailer_link)), + attributes: %w[href style]) %>
-+ +
+ <%= sanitize(t("mailers.email_verification.instructions_2", + document_type: humanize_document_type(@document_type), + document_number: @document_number)) %> +
+ +<%= t("mailers.email_verification.thanks") %>
+
<%= t("mailers.evaluation_comment.hi") %> <%= @email_to.name %>,
-+
<%= sanitize(t( "mailers.evaluation_comment.new_comment_by", commenter: @email.comment.author.name, @@ -16,10 +16,11 @@ )) %>
-+
<%= t("mailers.evaluation_comment.commenter_info", commenter: @email.comment.author.name, time: l(@email.comment.created_at)) %>
-+
<%= t("mailers.machine_learning_error.text") %>
-+
<%= link_to t("mailers.machine_learning_error.link"), admin_machine_learning_url, style: "color: #2895F1; text-decoration:none;" %>
diff --git a/app/views/mailer/machine_learning_success.html.erb b/app/views/mailer/machine_learning_success.html.erb index 5f6c5d5e5..2e55baff0 100644 --- a/app/views/mailer/machine_learning_success.html.erb +++ b/app/views/mailer/machine_learning_success.html.erb @@ -1,16 +1,14 @@ -+
<%= t("mailers.machine_learning_success.text") %>
-+
<%= link_to t("mailers.machine_learning_success.link"), admin_machine_learning_url, style: "color: #2895F1; text-decoration:none;" %>
diff --git a/app/views/mailer/newsletter.html.erb b/app/views/mailer/newsletter.html.erb index 33df7aa93..59a9375ad 100644 --- a/app/views/mailer/newsletter.html.erb +++ b/app/views/mailer/newsletter.html.erb @@ -1,14 +1,15 @@ -+
<%= auto_link_already_sanitized_html wysiwyg(@newsletter.body) %>
-+
<%= sanitize(t("mailers.config.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), - style: "color: #2895F1; text-decoration: none;" + style: css_for_mailer_link ), notification: User.human_attribute_name(:newsletter) ), attributes: %w[href style]) %> diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 35654e1eb..7842f7707 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -1,11 +1,11 @@ -
+
<%= t("mailers.proposal_notification_digest.info", org_name: Setting["org_name"]) %>
@@ -15,15 +15,15 @@- <%= link_to notification.notifiable.title, proposal_url(notification.notifiable.proposal, anchor: "tab-notifications"), style: "color: #2895F1; text-decoration: none;" %> -
-+
<%= notification.notifiable.proposal.title %> • <%= notification.notifiable.proposal.created_at.to_date %> • <%= notification.notifiable.proposal.author.name %>
-+
<%= notification.notifiable.body %>
@@ -31,12 +31,12 @@+
<%= sanitize(link_to(t("mailers.proposal_notification_digest.unfollow"), proposal_url(notification.notifiable.proposal), - style: "color: #2895F1; text-decoration: none;")) %> + style: css_for_mailer_link), attributes: %w[href style]) %>
+
<%= sanitize(t("mailers.proposal_notification_digest.unsubscribe_text", notifications: link_to(t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), - style: "color: #2895F1; text-decoration: none;"))) %> + style: css_for_mailer_link)), + attributes: %w[href style]) %>
diff --git a/app/views/mailer/reply.html.erb b/app/views/mailer/reply.html.erb index 5a13c9687..20d8fcdc5 100644 --- a/app/views/mailer/reply.html.erb +++ b/app/views/mailer/reply.html.erb @@ -1,28 +1,28 @@ -+
<%= t("mailers.reply.hi") %> <%= @email.recipient.name %>,
-+
<%= sanitize(t("mailers.reply.new_reply_by", commenter: @email.reply.author.name)) %> - <%= link_to @email.commentable.title, comment_url(@email.reply.id), style: "color: #2895F1; text-decoration:none;" %> + <%= link_to @email.commentable.title, comment_url(@email.reply.id), style: css_for_mailer_link %>
-+
<%= sanitize(t("mailers.config.unsubscribe_text", notifications: link_to( t("mailers.config.notifications_link"), edit_subscriptions_url(token: @token), - style: "color: #2895F1; text-decoration: none;" + style: css_for_mailer_link ), notification: User.human_attribute_name(:email_on_comment_reply) ), attributes: %w[href style]) %> diff --git a/app/views/mailer/user_invite.html.erb b/app/views/mailer/user_invite.html.erb index 9cad28493..aa435ec9d 100644 --- a/app/views/mailer/user_invite.html.erb +++ b/app/views/mailer/user_invite.html.erb @@ -1,23 +1,23 @@ -
+
<%= t("mailers.user_invite.text", org: Setting["org_name"]) %>
- <%= link_to t("mailers.user_invite.button"), new_user_registration_url, style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #004A83; border-radius: 6px; color: #fff !important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" %> + <%= link_to t("mailers.user_invite.button"), new_user_registration_url, style: css_for_mailer_button %>
-+
<%= t("mailers.user_invite.ignore") %>
-+
<%= t("mailers.user_invite.thanks") %>