From 87ff7c71e36851eccfad8fd8c02b1561327d38cc Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Fri, 23 Nov 2018 17:24:10 +0100 Subject: [PATCH] Update the delivery email look & feel Closes SCI-2884. --- app/views/users/mailer/notification.html.erb | 10 ++++------ config/locales/en.yml | 4 ++-- test/mailers/previews/app_mailer_preview.rb | 13 +++++++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/views/users/mailer/notification.html.erb b/app/views/users/mailer/notification.html.erb index 30ae6939b..e866c1158 100644 --- a/app/views/users/mailer/notification.html.erb +++ b/app/views/users/mailer/notification.html.erb @@ -10,7 +10,8 @@ <% # We assume the system notification is clean %> <%= @notification.title.html_safe %> <% elsif @notification.deliver? %> - <%= I18n.t("notifications.deliver.email_body").html_safe %> +

<%= I18n.t("notifications.deliver.email_body_1") %>

+

<%= I18n.t("notifications.deliver.email_body_2") %>

<% else %> <%= sanitize_input(prepend_server_url_to_links(@notification.title)) %> <% end %> @@ -21,12 +22,9 @@ <% # We assume the system notification is clean %> <%= @notification.message.html_safe %> <% elsif @notification.deliver? %> -

- <%= I18n.t("notifications.deliver.email_end_greeting").html_safe %> -

- <% # work around the problem with inserting the link of zipExport %> - <% zip_id = /data-id='(\d*)'/.match(@notification.message)[1] %> <%= I18n.t("notifications.deliver.download_link") %> + <% # work around the problem with inserting the link of zipExport %> + <% zip_id = /data-id=('|")(\d*)('|")/.match(@notification.message)[2] %> <%= @notification.message.gsub(/href='.+'/, "href='#{zip_exports_download_url(zip_id)}'").html_safe %> <% else %> <%= sanitize_input(prepend_server_url_to_links(@notification.message)) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 5475497e2..f71978644 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1863,8 +1863,8 @@ en: download_link: "Download link:" download_text: "Click the link to download the file." email_subject: "Your SciNote export is ready!" - email_body: "

The export of SciNote project(s) that you requested is ready!

You can find the link to download the file below or in your SciNote notifications. Please keep in mind that the link will expire in 7 days for security reasons.

" - email_end_greeting: "

Best regards,

Your SciNote team

" + email_body_1: "The export of SciNote data that you requested is ready!" + email_body_2: "You can find the link to download the file below or in your SciNote notifications. Please keep in mind that the link will expire in 7 days for security reasons." show_all: "Show all notifications" show_more: "Show more notifications" no_notifications: "No notifications." diff --git a/test/mailers/previews/app_mailer_preview.rb b/test/mailers/previews/app_mailer_preview.rb index f72671f60..0fb4591c9 100644 --- a/test/mailers/previews/app_mailer_preview.rb +++ b/test/mailers/previews/app_mailer_preview.rb @@ -69,6 +69,19 @@ class AppMailerPreview < ActionMailer::Preview ) end + def delivery_notification + AppMailer.notification( + fake_user, + Notification.new( + type_of: :deliver, + title: 'Your requested export package is ready!', + message: 'export_YYYY-MM-DD_HH-mm-ss.zip', + created_at: Time.now + ) + ) + end + private def fake_user