Update the delivery email look & feel

Closes SCI-2884.
This commit is contained in:
Luka Murn 2018-11-23 17:24:10 +01:00
parent af307eae73
commit 87ff7c71e3
3 changed files with 19 additions and 8 deletions

View file

@ -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 %>
<p><%= I18n.t("notifications.deliver.email_body_1") %></p>
<p><%= I18n.t("notifications.deliver.email_body_2") %></p>
<% 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? %>
<p>
<%= I18n.t("notifications.deliver.email_end_greeting").html_safe %>
</p>
<% # 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)) %>

View file

@ -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: "<p>The export of SciNote project(s) that you requested is ready!</p><p>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.</p>"
email_end_greeting: "<p>Best regards,</p><p>Your SciNote team</p>"
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."

View file

@ -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: '<a href="/zip_exports/download/1" target="_blank" ' \
'data-id="1">export_YYYY-MM-DD_HH-mm-ss.zip</a>',
created_at: Time.now
)
)
end
private
def fake_user