Skip to content

Commit

Permalink
[WIP] Ticket CV2-5067: Fixing e-mail template
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Aug 23, 2024
1 parent 4b8e64e commit 1726979
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/mailers/export_list_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class ExportListMailer < ApplicationMailer
def send_csv(csv_file_url, user)
@csv_file_url = csv_file_url
@user = user
@expire_in = CheckConfig.get('export_csv_expire', 7.days.to_i, :integer) / (60 * 60 * 24)
expire_in = Time.now.to_i + CheckConfig.get('export_csv_expire', 7.days.to_i, :integer)
@expire_in = I18n.l(Time.at(expire_in), format: :email)
subject = I18n.t('mails_notifications.export_list.subject')
Rails.logger.info "Sending export e-mail to #{@user.email}"
mail(to: @user.email, email_type: 'export_list', subject: subject)
Expand Down
8 changes: 7 additions & 1 deletion app/views/export_list_mailer/send_csv.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</table>
<div class="text-gray" style="color: #757575 !important;">
<div class="h3" style="font-size: 21px; letter-spacing: -0.2px; line-height: 30px;">
<%= I18n.t(:"mails_notifications.export_list.body", days: @expire_in) %>
<%= I18n.t(:"mails_notifications.export_list.body") %>
</div>
</div>
</div>
Expand Down Expand Up @@ -100,6 +100,12 @@
<td style="border-collapse: collapse; font-size: 23px; line-height: 1; text-decoration: none !important;">&nbsp;</td>
</tr>
</table>

<div class="text-gray" style="color: #757575 !important;">
<div class="h3" style="font-size: 21px; letter-spacing: -0.2px; line-height: 30px;">
<%= I18n.t(:"mails_notifications.export_list.footer", date: @expire_in) %>
</div>
</div>
</div>
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt;">
<tr>
Expand Down
4 changes: 3 additions & 1 deletion app/views/export_list_mailer/send_csv.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

<%= I18n.t('mails_notifications.export_list.subject') %>

<%= I18n.t('mails_notifications.export_list.body', days: @expire_in ) %>
<%= I18n.t('mails_notifications.export_list.body') %>

<%= I18n.t('mails_notifications.export_list.button_label') %>: <%= @csv_file_url %>

<%= I18n.t('mails_notifications.export_list.footer', date: @expire_in ) %>

...

<%= strip_tags I18n.t("mails_notifications.copyright_html", app_name: CheckConfig.get('app_name')) %>
Expand Down
7 changes: 4 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,11 @@ en:
term_button: Terms of Service
more_info: This is a one-time required legal notice sent to all Check users, even those who have unsubscribed by optional announcements.
export_list:
subject: Your Check data export is ready
hello: Hello %{name}
body: Your data export is ready. Click on the button below to download it. Please note that the link is valid only for %{days} days.
button_label: Download export
subject: Check Data Export
body: Your requested Check data export is available to download.
button_label: Download Export
footer: This download link will expire on %{date}.
mail_security:
device_subject: 'Security alert: New login to %{app_name} from %{browser} on %{platform}'
ip_subject: 'Security alert: New or unusual %{app_name} login'
Expand Down

0 comments on commit 1726979

Please sign in to comment.