From 12ea724474abf4bebc41dedff4a5a3ce03e4a3b2 Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 10 May 2022 14:58:12 +0200 Subject: [PATCH 1/9] Fix evaluation comment email on system emails Currently with both seeds and dev_seeds, not only was this email not displayed from the system emails section, but it also caused an error in the application. @email_to had an empty value and in the view we tried to access @email_to.name which caused the error. We kept the same logic but added the current_user to make sure it always has a valid value. We add the current_user because the current_user is always present in this controller.. --- .../admin/system_emails_controller.rb | 2 +- spec/system/admin/system_emails_spec.rb | 43 ++++++++++++------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/app/controllers/admin/system_emails_controller.rb b/app/controllers/admin/system_emails_controller.rb index b71e1d32b..b112ac414 100644 --- a/app/controllers/admin/system_emails_controller.rb +++ b/app/controllers/admin/system_emails_controller.rb @@ -104,7 +104,7 @@ class Admin::SystemEmailsController < Admin::BaseController comment = Comment.where(commentable_type: "Budget::Investment").last if comment @email = EvaluationCommentEmail.new(comment) - @email_to = @email.to.first + @email_to = @email.to.first || current_user else redirect_to admin_system_emails_path, alert: t("admin.system_emails.alert.no_evaluation_comments") diff --git a/spec/system/admin/system_emails_spec.rb b/spec/system/admin/system_emails_spec.rb index b0717c98a..425c5b4d0 100644 --- a/spec/system/admin/system_emails_spec.rb +++ b/spec/system/admin/system_emails_spec.rb @@ -251,25 +251,36 @@ describe "System Emails" do expect(page).to have_content "Some example data is needed in order to preview the email." end - scenario "#evaluation_comment" do - admin = create(:administrator, user: create(:user, username: "Baby Doe")) - investment = create(:budget_investment, - title: "Cleaner city", - heading: heading, - author: user, - administrator: admin) - comment = create(:comment, :valuation, commentable: investment) + describe "#evaluation_comment" do + scenario "render correctly evaluaton comment mailer with valuator as a sample user" do + admin = create(:administrator, user: create(:user, username: "Baby Doe")) + investment = create(:budget_investment, + title: "Cleaner city", + heading: heading, + author: user, + administrator: admin) + comment = create(:comment, :valuation, commentable: investment) - visit admin_system_email_view_path("evaluation_comment") + visit admin_system_email_view_path("evaluation_comment") - expect(page).to have_content "New evaluation comment for Cleaner city" - expect(page).to have_content "Hi #{admin.name}" - expect(page).to have_content "There is a new evaluation comment from #{comment.user.name} "\ - "to the budget investment Cleaner city" - expect(page).to have_content comment.body + expect(page).to have_content "New evaluation comment for Cleaner city" + expect(page).to have_content "Hi #{admin.name}" + expect(page).to have_content "There is a new evaluation comment from #{comment.user.name} "\ + "to the budget investment Cleaner city" + expect(page).to have_content comment.body - expect(page).to have_link "Cleaner city", - href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments", host: app_host) + expect(page).to have_link "Cleaner city", + href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments", host: app_host) + end + + scenario "uses a current_user as a sample user for sample regular comments" do + create(:budget_investment_comment, body: "This is a sample comment") + + visit admin_system_email_view_path("evaluation_comment") + + expect(page).to have_content "This is a sample comment" + expect(page).to have_content admin.name + end end end From 7ff62532df101130b42bf2ec962ad4adc2c11449 Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 10 May 2022 15:30:32 +0200 Subject: [PATCH 2/9] Unifiy proposal notification digest with others emails The notification digest title did not look the same as other mail. We removed the table for the title to make it more consistent with the rest of the emails. --- .../proposal_notification_digest.html.erb | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 7b3d0f58b..95975ede9 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -1,20 +1,14 @@ - - - - - - - -
-

- <%= t("mailers.proposal_notification_digest.title", - org_name: Setting["org_name"]) %> -

-

- <%= t("mailers.proposal_notification_digest.info", - org_name: Setting["org_name"]) %> -

-
+ + +

+ <%= t("mailers.proposal_notification_digest.title", + org_name: Setting["org_name"]) %> +

+ +

+ <%= t("mailers.proposal_notification_digest.info", + org_name: Setting["org_name"]) %> +

<% @notifications.each do |notification| %> From 41b9705563d8df15871dd3c2b824d0740a23606f Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 10 May 2022 15:34:50 +0200 Subject: [PATCH 3/9] Unify unsubscribe section styles with others emails --- .../direct_message_for_receiver.html.erb | 20 ++++++------------- .../proposal_notification_digest.html.erb | 20 ++++++------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index ae9637d3e..c24b071e6 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -21,18 +21,10 @@
- - - - - - -
-

- <%= 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;"))) %> -

-
+

+ <%= 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;"))) %> +

diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 95975ede9..35654e1eb 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -59,18 +59,10 @@ <% end %> - - - - - - -
-

- <%= 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;"))) %> -

-
+

+ <%= 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;"))) %> +

From d0224d190324a625863576d58e1cace60a2d9f7c Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 4 May 2022 16:06:00 +0200 Subject: [PATCH 4/9] Add attributes for sanitize on unsubscribe link section In the comments and direct message emails, the "attributes" was missing and in the reply email it was not in the right place. --- app/views/mailer/comment.html.erb | 2 +- app/views/mailer/direct_message_for_receiver.html.erb | 3 ++- app/views/mailer/newsletter.html.erb | 2 +- app/views/mailer/reply.html.erb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/mailer/comment.html.erb b/app/views/mailer/comment.html.erb index d831b60bc..44c4af83e 100644 --- a/app/views/mailer/comment.html.erb +++ b/app/views/mailer/comment.html.erb @@ -25,6 +25,6 @@ style: "color: #2895F1; text-decoration: none;" ), 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 c24b071e6..4490113b3 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -25,6 +25,7 @@ <%= 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: "color: #2895F1; text-decoration: none;")), + attributes: %w[href style]) %>

diff --git a/app/views/mailer/newsletter.html.erb b/app/views/mailer/newsletter.html.erb index e28be0eea..33df7aa93 100644 --- a/app/views/mailer/newsletter.html.erb +++ b/app/views/mailer/newsletter.html.erb @@ -11,6 +11,6 @@ style: "color: #2895F1; text-decoration: none;" ), notification: User.human_attribute_name(:newsletter) - )) %> + ), attributes: %w[href style]) %>

diff --git a/app/views/mailer/reply.html.erb b/app/views/mailer/reply.html.erb index ac1b7ee55..2aa9f2f75 100644 --- a/app/views/mailer/reply.html.erb +++ b/app/views/mailer/reply.html.erb @@ -25,6 +25,6 @@ style: "color: #2895F1; text-decoration: none;" ), notification: User.human_attribute_name(:email_on_comment_reply) - )) %> + ), attributes: %w[href style]) %>

From d871bb9eaec28d7fb1856f4701f35e3d5aa300b9 Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 10 May 2022 16:51:41 +0200 Subject: [PATCH 5/9] Unify render "quotes" on emails This section was being displayed differently in each mailing. We are trying to unify it so that they are displayed the same. --- app/views/mailer/budget_investment_unfeasible.html.erb | 2 +- app/views/mailer/comment.html.erb | 6 +++--- app/views/mailer/evaluation_comment.html.erb | 6 ++++-- app/views/mailer/reply.html.erb | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/views/mailer/budget_investment_unfeasible.html.erb b/app/views/mailer/budget_investment_unfeasible.html.erb index e31f59b7a..b20d1e421 100644 --- a/app/views/mailer/budget_investment_unfeasible.html.erb +++ b/app/views/mailer/budget_investment_unfeasible.html.erb @@ -4,7 +4,7 @@ <%= t("mailers.budget_investment_unfeasible.hi") %>

-

+

<%= @investment.unfeasibility_explanation %>

diff --git a/app/views/mailer/comment.html.erb b/app/views/mailer/comment.html.erb index 44c4af83e..7a08045b5 100644 --- a/app/views/mailer/comment.html.erb +++ b/app/views/mailer/comment.html.erb @@ -13,9 +13,9 @@ <%= link_to @commentable.title, commentable_url(@commentable), style: "color: #2895F1; text-decoration:none;" %>

-

- <%= sanitize_and_auto_link @comment.body %> -

+
+ <%= simple_format sanitize_and_auto_link(@comment.body), {}, sanitize: false %> +

<%= sanitize(t("mailers.config.unsubscribe_text", diff --git a/app/views/mailer/evaluation_comment.html.erb b/app/views/mailer/evaluation_comment.html.erb index 4feafc181..8eb277d9c 100644 --- a/app/views/mailer/evaluation_comment.html.erb +++ b/app/views/mailer/evaluation_comment.html.erb @@ -16,8 +16,10 @@ )) %>

- <%= t("mailers.evaluation_comment.commenter_info", commenter: @email.comment.author.name, time: l(@email.comment.created_at)) %> -
+

+ <%= t("mailers.evaluation_comment.commenter_info", commenter: @email.comment.author.name, time: l(@email.comment.created_at)) %> +

+
<%= simple_format sanitize_and_auto_link(@email.comment.body), {}, sanitize: false %>
diff --git a/app/views/mailer/reply.html.erb b/app/views/mailer/reply.html.erb index 2aa9f2f75..5a13c9687 100644 --- a/app/views/mailer/reply.html.erb +++ b/app/views/mailer/reply.html.erb @@ -13,7 +13,7 @@ <%= link_to @email.commentable.title, comment_url(@email.reply.id), style: "color: #2895F1; text-decoration:none;" %>

-
+
<%= simple_format sanitize_and_auto_link(@email.reply.body), {}, sanitize: false %>
From 7f0f35a5c008a44a534e422619f2ed295b78d68d Mon Sep 17 00:00:00 2001 From: decabeza Date: Wed, 27 Apr 2022 19:48:45 +0200 Subject: [PATCH 6/9] Add mailer helpers to simplify customization --- app/helpers/mailer_helper.rb | 36 +++++++++++++++++++ app/mailers/devise_mailer.rb | 2 +- .../mailer/confirmation_instructions.html.erb | 14 ++++---- .../reset_password_instructions.html.erb | 16 +++++---- .../mailer/unlock_instructions.html.erb | 16 +++++---- app/views/mailer/already_confirmed.html.erb | 14 ++++---- .../mailer/budget_investment_created.html.erb | 21 +++++------ .../budget_investment_selected.html.erb | 16 ++++----- .../budget_investment_unfeasible.html.erb | 19 +++++----- .../budget_investment_unselected.html.erb | 8 ++--- app/views/mailer/comment.html.erb | 18 +++++----- .../direct_message_for_receiver.html.erb | 14 ++++---- .../mailer/direct_message_for_sender.html.erb | 12 +++---- app/views/mailer/email_verification.html.erb | 31 ++++++++-------- app/views/mailer/evaluation_comment.html.erb | 15 ++++---- .../mailer/machine_learning_error.html.erb | 10 +++--- .../mailer/machine_learning_success.html.erb | 10 +++--- app/views/mailer/newsletter.html.erb | 9 ++--- .../proposal_notification_digest.html.erb | 29 +++++++-------- app/views/mailer/reply.html.erb | 18 +++++----- app/views/mailer/user_invite.html.erb | 12 +++---- 21 files changed, 194 insertions(+), 146 deletions(-) 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.title") %>

-

+

<%= 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 %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb index a67e77f08..f27736fd1 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -1,22 +1,24 @@ - + -

+

<%= t("devise_views.mailer.reset_password_instructions.title") %>

-

+

<%= 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") %>

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb index 41ddc2f19..3085bb5ed 100644 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -1,22 +1,24 @@ - + -

+

<%= t("devise_views.mailer.unlock_instructions.title") %>

-

+

<%= 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 %>

diff --git a/app/views/mailer/already_confirmed.html.erb b/app/views/mailer/already_confirmed.html.erb index f517b8408..22e01b477 100644 --- a/app/views/mailer/already_confirmed.html.erb +++ b/app/views/mailer/already_confirmed.html.erb @@ -1,17 +1,19 @@ - + -

+

<%= t("mailers.already_confirmed.subject") %>

-

+

<%= 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 %>

diff --git a/app/views/mailer/budget_investment_created.html.erb b/app/views/mailer/budget_investment_created.html.erb index 3c0c29980..0e603f29a 100644 --- a/app/views/mailer/budget_investment_created.html.erb +++ b/app/views/mailer/budget_investment_created.html.erb @@ -1,39 +1,40 @@ - + -

+

<%= t("mailers.budget_investment_created.title") %>

-

+

<%= 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") %>

diff --git a/app/views/mailer/budget_investment_selected.html.erb b/app/views/mailer/budget_investment_selected.html.erb index 08e3409b8..cb4de4faf 100644 --- a/app/views/mailer/budget_investment_selected.html.erb +++ b/app/views/mailer/budget_investment_selected.html.erb @@ -1,10 +1,10 @@ - + -

+

<%= t("mailers.budget_investment_selected.hi") %>

-

+

<%= t("mailers.budget_investment_selected.share") %>

@@ -12,20 +12,20 @@ - <%= 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_selected.share_button") %> + <%= 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_selected.share_button") %> <% end %> -

+

<%= 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") %>

diff --git a/app/views/mailer/budget_investment_unselected.html.erb b/app/views/mailer/budget_investment_unselected.html.erb index e45a7848d..dba91f412 100644 --- a/app/views/mailer/budget_investment_unselected.html.erb +++ b/app/views/mailer/budget_investment_unselected.html.erb @@ -1,14 +1,14 @@ - + -

+

<%= t("mailers.budget_investment_unselected.hi") %>

-

+

<%= t("mailers.budget_investment_unselected.thanks") %>

-

+

<%= t("mailers.budget_investment_unselected.sincerely") %>

diff --git a/app/views/mailer/comment.html.erb b/app/views/mailer/comment.html.erb index 7a08045b5..93e5888d8 100644 --- a/app/views/mailer/comment.html.erb +++ b/app/views/mailer/comment.html.erb @@ -1,28 +1,28 @@ - + -

+

<%= t("mailers.comment.title") %>

-

+

<%= 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 %>

-
- <%= simple_format sanitize_and_auto_link(@comment.body), {}, sanitize: false %> +
+ <%= mailer_simple_format(@comment.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(: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 @@ - -

+ +

<%= @direct_message.title %>

-
- <%= simple_format sanitize_and_auto_link(@direct_message.body), {}, sanitize: false %> +
+ <%= mailer_simple_format(@direct_message.body) %>
- <%= 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]) %>

diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb index cb2d9080a..90dad33f4 100644 --- a/app/views/mailer/direct_message_for_sender.html.erb +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -1,15 +1,15 @@ - + -

+

<%= sanitize(t("mailers.direct_message_for_sender.title", receiver: @direct_message.receiver.name)) %>

-

+

<%= @direct_message.title %> -

+

-
- <%= simple_format sanitize_and_auto_link(@direct_message.body), {}, sanitize: false %> +
+ <%= mailer_simple_format(@direct_message.body) %>
diff --git a/app/views/mailer/email_verification.html.erb b/app/views/mailer/email_verification.html.erb index a7b7e94dc..5b64fd2fc 100644 --- a/app/views/mailer/email_verification.html.erb +++ b/app/views/mailer/email_verification.html.erb @@ -1,21 +1,24 @@ - -

+ + +

<%= 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") %>

diff --git a/app/views/mailer/evaluation_comment.html.erb b/app/views/mailer/evaluation_comment.html.erb index 8eb277d9c..1a8f44c26 100644 --- a/app/views/mailer/evaluation_comment.html.erb +++ b/app/views/mailer/evaluation_comment.html.erb @@ -1,14 +1,14 @@ - + -

+

<%= t("mailers.evaluation_comment.title", investment: @email.commentable.title) %>

-

+

<%= 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)) %>

-
- <%= simple_format sanitize_and_auto_link(@email.comment.body), {}, sanitize: false %> + +
+ <%= mailer_simple_format(@email.comment.body) %>
diff --git a/app/views/mailer/machine_learning_error.html.erb b/app/views/mailer/machine_learning_error.html.erb index 9798f477c..d28a9fbf1 100644 --- a/app/views/mailer/machine_learning_error.html.erb +++ b/app/views/mailer/machine_learning_error.html.erb @@ -1,16 +1,14 @@ - + -

+

<%= t("mailers.machine_learning_error.title") %>

-

+

<%= 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.title") %>

-

+

<%= 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.title", org_name: Setting["org_name"]) %>

-

+

<%= 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;" %> -

-

+

+ <%= link_to notification.notifiable.title, proposal_url(notification.notifiable.proposal, anchor: "tab-notifications"), style: css_for_mailer_link %> +

+

<%= notification.notifiable.proposal.title %> •  <%= notification.notifiable.proposal.created_at.to_date %> •  <%= notification.notifiable.proposal.author.name %>

-

+

<%= notification.notifiable.body %>

@@ -31,12 +31,12 @@ - <%= link_to proposal_url(notification.notifiable.proposal, 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 %> + <%= link_to proposal_url(notification.notifiable.proposal, 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.proposal_notification_digest.share") %> <% end %> - <%= link_to proposal_url(notification.notifiable.proposal, anchor: "comments"), 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; margin-left: 12px;" do %> + <%= link_to proposal_url(notification.notifiable.proposal, anchor: "comments"), style: css_for_mailer_button do %> <%= image_tag("icon_mailer_comment.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> <%= t("mailers.proposal_notification_digest.comment") %> <% end %> @@ -44,10 +44,10 @@ -

+

<%= 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]) %>

@@ -59,10 +59,11 @@ <% end %> -

+

<%= 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.title") %>

-

+

<%= 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 %>

-
- <%= simple_format sanitize_and_auto_link(@email.reply.body), {}, sanitize: false %> +
+ <%= mailer_simple_format(@email.reply.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(: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.title", org: Setting["org_name"]) %>

-

+

<%= 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") %>

From bec59f1f9f04feef3048412bddc4077e53604937 Mon Sep 17 00:00:00 2001 From: decabeza Date: Wed, 27 Apr 2022 19:53:03 +0200 Subject: [PATCH 7/9] Remove icon images on mailers --- app/assets/images/icon_mailer_comment.png | Bin 251 -> 0 bytes app/assets/images/icon_mailer_reply.png | Bin 230 -> 0 bytes app/assets/images/icon_mailer_share.png | Bin 379 -> 0 bytes .../mailer/budget_investment_created.html.erb | 1 - .../mailer/budget_investment_selected.html.erb | 1 - .../mailer/direct_message_for_receiver.html.erb | 1 - .../mailer/proposal_notification_digest.html.erb | 2 -- 7 files changed, 5 deletions(-) delete mode 100644 app/assets/images/icon_mailer_comment.png delete mode 100644 app/assets/images/icon_mailer_reply.png delete mode 100644 app/assets/images/icon_mailer_share.png diff --git a/app/assets/images/icon_mailer_comment.png b/app/assets/images/icon_mailer_comment.png deleted file mode 100644 index d3c9bff738825499e7c06f8a2adce4b5d17b586c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ za0`PlBg3pY5@fx({`eF=FuU@JE6u`H t^}0y%m%?NFP723uJSgy8?a}=M%yHKgpUwZrxEbhB22WQ%mvv4FO#oa~T$ca< diff --git a/app/assets/images/icon_mailer_reply.png b/app/assets/images/icon_mailer_reply.png deleted file mode 100644 index 0c9159e8451c68303b48a710cd6cbd4199a3bd3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eK!3HFi66di4DVAa<&kznEsNqQI0P;BtJR*x3 z7`TN&n2}-D90{Ocho_5Uh{nXD=Qr{mG7xBe=)Z9B!sSbR!WOtD@r0d_nj*=t(Y-;} zh*7pytLuVAP|8h>%m>r`)bH<2-}^XziuV!qFU2j{F@`N(o4EEmbstW-zW9K#c;bnW z_P-i>X)d}S4;adoT|A$D=L6q+akJpycQ17H62q1&^_U;MvZMa=+(joPi{4C=syo0w YwL?*(&Fkngpqm&xUHx3vIVCg!0GPy3$p8QV diff --git a/app/assets/images/icon_mailer_share.png b/app/assets/images/icon_mailer_share.png deleted file mode 100644 index f95d44141b621be582501edd89e8cbdf98321ba1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ za0`PlBg3pY5)2HCvYsxEAr`$yCv5a$P84WK|9|9!JjegHc^wIgON8HiRn572%&hl^ z%(f&|j%i9^N)gdrD^>Uv#FWhL9c6yVHF-@d%U7HJIlaN>jPAel;}um^ntrc(e(FtK zhAXR>q}E>RHMahCkAJg{bO=+4)m+vdx6^K4TwH#CKKm@Twk^ijW!u@Daud1ovpEcl zL>h|IUW=^!Cc9x4x2;Oy9ucP(lZw+>_6S{!o1_xX5VNGpt3mqMM=_VHUDu30dmZ^B zvGQHbSJx*UGxZtH)Jm{62rzZOvNg_smaepkZNbM(5eAnh6GHh8iTgg{%I_2h3;qYyYi)m*Ktk X)PU#K>!xG?Lyy7J)z4*}Q$iB}&@_=P diff --git a/app/views/mailer/budget_investment_created.html.erb b/app/views/mailer/budget_investment_created.html.erb index 0e603f29a..2b2efbcbf 100644 --- a/app/views/mailer/budget_investment_created.html.erb +++ b/app/views/mailer/budget_investment_created.html.erb @@ -26,7 +26,6 @@ <%= 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 %> diff --git a/app/views/mailer/budget_investment_selected.html.erb b/app/views/mailer/budget_investment_selected.html.erb index cb4de4faf..66c61bdfc 100644 --- a/app/views/mailer/budget_investment_selected.html.erb +++ b/app/views/mailer/budget_investment_selected.html.erb @@ -13,7 +13,6 @@ <%= 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_selected.share_button") %> <% end %> diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index 06c3d849a..e680ec668 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -12,7 +12,6 @@ <%= 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) %> <% end %> diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 7842f7707..3c23f5777 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -32,12 +32,10 @@ <%= link_to proposal_url(notification.notifiable.proposal, 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.proposal_notification_digest.share") %> <% end %> <%= link_to proposal_url(notification.notifiable.proposal, anchor: "comments"), style: css_for_mailer_button do %> - <%= image_tag("icon_mailer_comment.png", style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> <%= t("mailers.proposal_notification_digest.comment") %> <% end %> From 8c078ae0a9453f2778ed335f2e69f907e42051a5 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 28 Apr 2022 18:25:46 +0200 Subject: [PATCH 8/9] Add missing heading title on mailers --- app/views/mailer/budget_investment_selected.html.erb | 4 ++++ app/views/mailer/budget_investment_unfeasible.html.erb | 4 ++++ app/views/mailer/budget_investment_unselected.html.erb | 4 ++++ app/views/mailer/direct_message_for_sender.html.erb | 6 +++++- app/views/mailer/email_verification.html.erb | 6 +++++- config/locales/en/mailers.yml | 9 +++++++-- config/locales/es/mailers.yml | 9 +++++++-- 7 files changed, 36 insertions(+), 6 deletions(-) diff --git a/app/views/mailer/budget_investment_selected.html.erb b/app/views/mailer/budget_investment_selected.html.erb index 66c61bdfc..6ac506081 100644 --- a/app/views/mailer/budget_investment_selected.html.erb +++ b/app/views/mailer/budget_investment_selected.html.erb @@ -1,5 +1,9 @@ +

+ <%= t("mailers.budget_investment_selected.title") %> +

+

<%= t("mailers.budget_investment_selected.hi") %>

diff --git a/app/views/mailer/budget_investment_unfeasible.html.erb b/app/views/mailer/budget_investment_unfeasible.html.erb index 49f9d5997..3420b4687 100644 --- a/app/views/mailer/budget_investment_unfeasible.html.erb +++ b/app/views/mailer/budget_investment_unfeasible.html.erb @@ -1,5 +1,9 @@ +

+ <%= t("mailers.budget_investment_unfeasible.title") %> +

+

<%= t("mailers.budget_investment_unfeasible.hi") %>

diff --git a/app/views/mailer/budget_investment_unselected.html.erb b/app/views/mailer/budget_investment_unselected.html.erb index dba91f412..c04da7272 100644 --- a/app/views/mailer/budget_investment_unselected.html.erb +++ b/app/views/mailer/budget_investment_unselected.html.erb @@ -1,5 +1,9 @@ +

+ <%= t("mailers.budget_investment_unselected.title") %> +

+

<%= t("mailers.budget_investment_unselected.hi") %>

diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb index 90dad33f4..c775d936f 100644 --- a/app/views/mailer/direct_message_for_sender.html.erb +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -1,7 +1,11 @@ +

+ <%= t("mailers.direct_message_for_sender.title") %> +

+

- <%= sanitize(t("mailers.direct_message_for_sender.title", + <%= sanitize(t("mailers.direct_message_for_sender.text", receiver: @direct_message.receiver.name)) %>

diff --git a/app/views/mailer/email_verification.html.erb b/app/views/mailer/email_verification.html.erb index 5b64fd2fc..27365639f 100644 --- a/app/views/mailer/email_verification.html.erb +++ b/app/views/mailer/email_verification.html.erb @@ -1,7 +1,11 @@ -

+

<%= t("mailers.email_verification.title") %> +

+ +

+ <%= t("mailers.email_verification.text") %>

diff --git a/config/locales/en/mailers.yml b/config/locales/en/mailers.yml index e3601ef90..a11aff0cb 100644 --- a/config/locales/en/mailers.yml +++ b/config/locales/en/mailers.yml @@ -20,7 +20,8 @@ en: instructions: To complete the verification of your user account you must click %{verification_link}. subject: Confirm your email thanks: Thank you very much. - title: Confirm your account using the following link + title: "Confirm your email" + text: "Confirm your account using the following link." reply: hi: Hi new_reply_by: There is a new response from %{commenter} to your comment on @@ -39,7 +40,8 @@ en: unsubscribe_text: "If you don't want to receive direct messages, visit %{notifications} and uncheck 'Receive emails about direct messages'." direct_message_for_sender: subject: "You have sent a new private message" - title: "You have sent a new private message to %{receiver} with the content:" + title: "You have sent a new private message" + text: "You have sent a new private message to %{receiver} with the content:" user_invite: ignore: "If you have not requested this invitation don't worry, you can ignore this email." text: "Thank you for applying to join %{org}! In seconds you can start to participate, just fill the form below:" @@ -57,6 +59,7 @@ en: sincerely: "Sincerely," share: "Share your project" budget_investment_unfeasible: + title: "Your investment project has been marked as unfeasible" hi: "Dear user," new: "For all these, we invite you to elaborate a new investment that adjusts to the conditions of this process. You can do it following this link: %{url}." new_href: "new investment project" @@ -65,6 +68,7 @@ en: subject: "Your investment project '%{code}' has been marked as unfeasible" budget_investment_selected: subject: "Your investment project '%{code}' has been selected" + title: "Your investment project has been selected" hi: "Dear user," share: "Start to get votes, share your investment project on social networks. Share is essential to make it a reality." share_button: "Share your investment project" @@ -72,6 +76,7 @@ en: sincerely: "Sincererly" budget_investment_unselected: subject: "Your investment project '%{code}' has not been selected" + title: "Your investment project has not been selected" hi: "Dear user," thanks: "Thank you again for participating." sincerely: "Sincererly" diff --git a/config/locales/es/mailers.yml b/config/locales/es/mailers.yml index ada78196f..b8f4d73fb 100644 --- a/config/locales/es/mailers.yml +++ b/config/locales/es/mailers.yml @@ -20,7 +20,8 @@ es: instructions: Para terminar de verificar tu cuenta de usuario pulsa %{verification_link}. subject: Verifica tu email thanks: Muchas gracias. - title: Verifica tu cuenta con el siguiente enlace + title: "Verifica tu email" + text: "Verifica tu cuenta con el siguiente enlace." reply: hi: Hola new_reply_by: Hay una nueva respuesta de %{commenter} a tu comentario en @@ -39,7 +40,8 @@ es: unsubscribe_text: "Si no quieres recibir mensajes privados, puedes entrar en %{notifications} y desmarcar la opción 'Recibir emails con mensajes privados'." direct_message_for_sender: subject: "Has enviado un nuevo mensaje privado" - title: "Has enviado un nuevo mensaje privado a %{receiver} con el siguiente contenido:" + title: "Has enviado un nuevo mensaje privado" + text: "Has enviado un nuevo mensaje privado a %{receiver} con el siguiente contenido:" user_invite: ignore: "Si no has solicitado esta invitación no te preocupes, puedes ignorar este correo." text: "¡Gracias por solicitar unirte a %{org}! En unos segundos podrás empezar a participar, sólo tienes que rellenar el siguiente formulario:" @@ -57,6 +59,7 @@ es: sincerely: "Atentamente," share: "Comparte tu proyecto" budget_investment_unfeasible: + title: "Tu proyecto de gasto ha sido marcado como inviable" hi: "Estimado/a usuario/a" new: "Por todo ello, te invitamos a que elabores un nuevo proyecto de gasto que se ajuste a las condiciones de este proceso. Esto lo puedes hacer en este enlace: %{url}." new_href: "nuevo proyecto de gasto" @@ -65,6 +68,7 @@ es: subject: "Tu proyecto de gasto '%{code}' ha sido marcado como inviable" budget_investment_selected: subject: "Tu proyecto de gasto '%{code}' ha sido seleccionado" + title: "Tu proyecto de gasto ha sido seleccionado" hi: "Estimado/a usuario/a" share: "Empieza ya a conseguir votos, comparte tu proyecto de gasto en redes sociales. La difusión es fundamental para conseguir que se haga realidad." share_button: "Comparte tu proyecto" @@ -72,6 +76,7 @@ es: sincerely: "Atentamente" budget_investment_unselected: subject: "Tu proyecto de gasto '%{code}' no ha sido seleccionado" + title: "Tu proyecto de gasto no ha sido seleccionado" hi: "Estimado/a usuario/a" thanks: "Gracias de nuevo por tu participación." sincerely: "Atentamente" From 73f710e73712a349e4e65f16010012c3ff61c3d7 Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 4 May 2022 20:38:58 +0200 Subject: [PATCH 9/9] Unify format and indentation for sanitize, i18n and links on emails In the mail section we have very different indentations and formatting in texts with sanitize, links and texts with interpolations. In my opinion it helps a lot to have clearer indentations in these cases. This may not be the best way to indent them, but at least I think it is clearer than it was and at least relatively unified. --- .../mailer/budget_investment_created.html.erb | 23 ++++++++++++------- .../budget_investment_unfeasible.html.erb | 10 +++++--- app/views/mailer/comment.html.erb | 17 ++++++++------ .../direct_message_for_receiver.html.erb | 14 +++++++---- .../mailer/direct_message_for_sender.html.erb | 3 +-- app/views/mailer/email_verification.html.erb | 22 +++++++++++------- app/views/mailer/evaluation_comment.html.erb | 11 +++++---- .../mailer/machine_learning_error.html.erb | 3 ++- .../mailer/machine_learning_success.html.erb | 3 ++- app/views/mailer/newsletter.html.erb | 17 ++++++++------ .../proposal_notification_digest.html.erb | 23 +++++++++++++------ app/views/mailer/reply.html.erb | 17 ++++++++------ 12 files changed, 102 insertions(+), 61 deletions(-) diff --git a/app/views/mailer/budget_investment_created.html.erb b/app/views/mailer/budget_investment_created.html.erb index 2b2efbcbf..8c2da30c6 100644 --- a/app/views/mailer/budget_investment_created.html.erb +++ b/app/views/mailer/budget_investment_created.html.erb @@ -5,20 +5,27 @@

- <%= sanitize(t("mailers.budget_investment_created.intro", - author: @investment.author.name)) %> + <%= 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.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, - style: css_for_mailer_link)), attributes: %w[href style]) %> + <%= sanitize( + t("mailers.budget_investment_created.follow", + link: link_to(t("mailers.budget_investment_created.follow_link"), budgets_url, + style: css_for_mailer_link) + ), + attributes: %w[href style] + ) %>

diff --git a/app/views/mailer/budget_investment_unfeasible.html.erb b/app/views/mailer/budget_investment_unfeasible.html.erb index 3420b4687..0fd60982d 100644 --- a/app/views/mailer/budget_investment_unfeasible.html.erb +++ b/app/views/mailer/budget_investment_unfeasible.html.erb @@ -13,10 +13,14 @@

- <%= sanitize(t("mailers.budget_investment_unfeasible.new", + <%= 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]) %> + new_budget_investment_url(@investment.budget), + style: css_for_mailer_link) + ), + attributes: %w[href style] + ) %>

diff --git a/app/views/mailer/comment.html.erb b/app/views/mailer/comment.html.erb index 93e5888d8..3c277bbd8 100644 --- a/app/views/mailer/comment.html.erb +++ b/app/views/mailer/comment.html.erb @@ -18,13 +18,16 @@

- <%= sanitize(t("mailers.config.unsubscribe_text", - notifications: link_to( - t("mailers.config.notifications_link"), - edit_subscriptions_url(token: @token), - 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: css_for_mailer_link + ), + notification: User.human_attribute_name(:email_on_comment) ), - notification: User.human_attribute_name(:email_on_comment) - ), attributes: %w[href style]) %> + 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 e680ec668..efe41e744 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -21,10 +21,14 @@

- <%= sanitize(t("mailers.direct_message_for_receiver.unsubscribe_text", - notifications: link_to(t("mailers.config.notifications_link"), - edit_subscriptions_url(token: @token), - style: css_for_mailer_link)), - attributes: %w[href style]) %> + <%= sanitize( + t("mailers.direct_message_for_receiver.unsubscribe_text", + notifications: link_to( + t("mailers.config.notifications_link"), + edit_subscriptions_url(token: @token), + style: css_for_mailer_link) + ), + attributes: %w[href style] + ) %>

diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb index c775d936f..f5bdbdaed 100644 --- a/app/views/mailer/direct_message_for_sender.html.erb +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -5,8 +5,7 @@

- <%= sanitize(t("mailers.direct_message_for_sender.text", - receiver: @direct_message.receiver.name)) %> + <%= sanitize(t("mailers.direct_message_for_sender.text", receiver: @direct_message.receiver.name)) %>

diff --git a/app/views/mailer/email_verification.html.erb b/app/views/mailer/email_verification.html.erb index 27365639f..fe1525a3f 100644 --- a/app/views/mailer/email_verification.html.erb +++ b/app/views/mailer/email_verification.html.erb @@ -9,17 +9,23 @@

- <%= 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", + 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)) %> + <%= sanitize( + t("mailers.email_verification.instructions_2", + document_type: humanize_document_type(@document_type), + document_number: @document_number) + ) %>

diff --git a/app/views/mailer/evaluation_comment.html.erb b/app/views/mailer/evaluation_comment.html.erb index 1a8f44c26..fa95263ed 100644 --- a/app/views/mailer/evaluation_comment.html.erb +++ b/app/views/mailer/evaluation_comment.html.erb @@ -9,11 +9,12 @@

- <%= sanitize(t( - "mailers.evaluation_comment.new_comment_by", - commenter: @email.comment.author.name, - investment: valuation_comments_link(@email.commentable) - )) %> + <%= sanitize( + t("mailers.evaluation_comment.new_comment_by", + commenter: @email.comment.author.name, + investment: valuation_comments_link(@email.commentable) + ) + ) %>

diff --git a/app/views/mailer/machine_learning_error.html.erb b/app/views/mailer/machine_learning_error.html.erb index d28a9fbf1..9a14a2d3c 100644 --- a/app/views/mailer/machine_learning_error.html.erb +++ b/app/views/mailer/machine_learning_error.html.erb @@ -9,7 +9,8 @@

- <%= link_to t("mailers.machine_learning_error.link"), admin_machine_learning_url, + <%= 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 2e55baff0..ec22b0b8c 100644 --- a/app/views/mailer/machine_learning_success.html.erb +++ b/app/views/mailer/machine_learning_success.html.erb @@ -9,7 +9,8 @@

- <%= link_to t("mailers.machine_learning_success.link"), admin_machine_learning_url, + <%= 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 59a9375ad..7b7d5130d 100644 --- a/app/views/mailer/newsletter.html.erb +++ b/app/views/mailer/newsletter.html.erb @@ -5,13 +5,16 @@

- <%= sanitize(t("mailers.config.unsubscribe_text", - notifications: link_to( - t("mailers.config.notifications_link"), - edit_subscriptions_url(token: @token), - 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: css_for_mailer_link + ), + notification: User.human_attribute_name(:newsletter) ), - notification: User.human_attribute_name(:newsletter) - ), attributes: %w[href style]) %> + 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 3c23f5777..fee371793 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -43,9 +43,14 @@

- <%= sanitize(link_to(t("mailers.proposal_notification_digest.unfollow"), + <%= sanitize( + link_to( + t("mailers.proposal_notification_digest.unfollow"), proposal_url(notification.notifiable.proposal), - style: css_for_mailer_link), attributes: %w[href style]) %> + style: css_for_mailer_link + ), + attributes: %w[href style] + ) %>

@@ -58,10 +63,14 @@ <% end %>

- <%= sanitize(t("mailers.proposal_notification_digest.unsubscribe_text", - notifications: link_to(t("mailers.config.notifications_link"), - edit_subscriptions_url(token: @token), - 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: 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 20d8fcdc5..c25fcb1bc 100644 --- a/app/views/mailer/reply.html.erb +++ b/app/views/mailer/reply.html.erb @@ -18,13 +18,16 @@

- <%= sanitize(t("mailers.config.unsubscribe_text", - notifications: link_to( - t("mailers.config.notifications_link"), - edit_subscriptions_url(token: @token), - 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: css_for_mailer_link + ), + notification: User.human_attribute_name(:email_on_comment_reply) ), - notification: User.human_attribute_name(:email_on_comment_reply) - ), attributes: %w[href style]) %> + attributes: %w[href style] + ) %>