From 02194838dd64558cd974e68cb0bf800dffd25c91 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 16 Jan 2018 20:20:15 +0100 Subject: HTML e-mails for NotificationMailer (#6263) * HTML e-mails for NotificationMailer (except digest) * Add HTML template for digest * Fix build --- app/views/notification_mailer/_status.html.haml | 30 +++++++++++++++ app/views/notification_mailer/digest.html.haml | 44 +++++++++++++++++++++ app/views/notification_mailer/favourite.html.haml | 45 ++++++++++++++++++++++ app/views/notification_mailer/follow.html.haml | 43 +++++++++++++++++++++ .../notification_mailer/follow_request.html.haml | 43 +++++++++++++++++++++ app/views/notification_mailer/mention.html.haml | 45 ++++++++++++++++++++++ app/views/notification_mailer/reblog.html.haml | 45 ++++++++++++++++++++++ 7 files changed, 295 insertions(+) create mode 100644 app/views/notification_mailer/_status.html.haml create mode 100644 app/views/notification_mailer/digest.html.haml create mode 100644 app/views/notification_mailer/favourite.html.haml create mode 100644 app/views/notification_mailer/follow.html.haml create mode 100644 app/views/notification_mailer/follow_request.html.haml create mode 100644 app/views/notification_mailer/mention.html.haml create mode 100644 app/views/notification_mailer/reblog.html.haml (limited to 'app/views/notification_mailer') diff --git a/app/views/notification_mailer/_status.html.haml b/app/views/notification_mailer/_status.html.haml new file mode 100644 index 000000000..1e796ed29 --- /dev/null +++ b/app/views/notification_mailer/_status.html.haml @@ -0,0 +1,30 @@ +- i ||= 0 + +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell{ class: i.zero? ? 'content-start' : nil } + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.padded.status + %table.status-header{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td{ align: 'left', width: 48 } + = image_tag status.account.avatar + %td{ align: 'left' } + %bdi= display_name(status.account) + = "@#{status.account.acct}" + + = Formatter.instance.format(status) + + %p.status-footer + = link_to l(status.created_at), web_url("statuses/#{status.id}") diff --git a/app/views/notification_mailer/digest.html.haml b/app/views/notification_mailer/digest.html.haml new file mode 100644 index 000000000..10e44f8dd --- /dev/null +++ b/app/views/notification_mailer/digest.html.haml @@ -0,0 +1,44 @@ +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.darker.hero-with-button + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.text-center.padded + %h1= t 'notification_mailer.digest.title' + %p.lead= t('notification_mailer.digest.body', since: l(@since.to_date, format: :short), instance: site_hostname) + %table.button{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.button-primary + = link_to web_url do + %span= t 'notification_mailer.digest.action' + +- @notifications.each_with_index do |n, i| + = render 'status', status: n.target_status, i: i + +- unless @follows_since.zero? + %table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.content-start.border-top + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.text-center + %p= t('notification_mailer.digest.new_followers_summary', count: @follows_since) diff --git a/app/views/notification_mailer/favourite.html.haml b/app/views/notification_mailer/favourite.html.haml new file mode 100644 index 000000000..6cbc552fa --- /dev/null +++ b/app/views/notification_mailer/favourite.html.haml @@ -0,0 +1,45 @@ +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.hero + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.text-center.padded + %table.hero-icon{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td + = image_tag asset_pack_path('icon_grade.svg') + + %h1= t 'notification_mailer.favourite.title' + %p.lead= t('notification_mailer.favourite.body', name: @account.acct) + += render 'status', status: @status + +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.content-start.border-top + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.button-cell + %table.button{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.button-primary + = link_to web_url("statuses/#{@status.id}") do + %span= t 'application_mailer.view_status' diff --git a/app/views/notification_mailer/follow.html.haml b/app/views/notification_mailer/follow.html.haml new file mode 100644 index 000000000..d1ae18ea9 --- /dev/null +++ b/app/views/notification_mailer/follow.html.haml @@ -0,0 +1,43 @@ +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.hero + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.text-center.padded + %table.hero-icon{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td + = image_tag asset_pack_path('icon_person_add.svg') + + %h1= t 'notification_mailer.follow.title' + %p.lead= t('notification_mailer.follow.body', name: @account.acct) + +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.content-start + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.button-cell + %table.button{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.button-primary + = link_to web_url("accounts/#{@account.id}") do + %span= t 'application_mailer.view_profile' diff --git a/app/views/notification_mailer/follow_request.html.haml b/app/views/notification_mailer/follow_request.html.haml new file mode 100644 index 000000000..ce5f578b1 --- /dev/null +++ b/app/views/notification_mailer/follow_request.html.haml @@ -0,0 +1,43 @@ +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.hero + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.text-center.padded + %table.hero-icon{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td + = image_tag asset_pack_path('icon_person_add.svg') + + %h1= t 'notification_mailer.follow_request.title' + %p.lead= t('notification_mailer.follow_request.body', name: @account.acct) + +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.content-start + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.button-cell + %table.button{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.button-primary + = link_to web_url("follow_requests") do + %span= t 'notification_mailer.follow_request.action' diff --git a/app/views/notification_mailer/mention.html.haml b/app/views/notification_mailer/mention.html.haml new file mode 100644 index 000000000..9ecbe8550 --- /dev/null +++ b/app/views/notification_mailer/mention.html.haml @@ -0,0 +1,45 @@ +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.hero + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.text-center.padded + %table.hero-icon{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td + = image_tag asset_pack_path('icon_reply.svg') + + %h1= t 'notification_mailer.mention.title' + %p.lead= t('notification_mailer.mention.body', name: @status.account.acct) + += render 'status', status: @status + +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.content-start.border-top + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.button-cell + %table.button{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.button-primary + = link_to web_url("statuses/#{@status.id}") do + %span= t 'notification_mailer.mention.action' diff --git a/app/views/notification_mailer/reblog.html.haml b/app/views/notification_mailer/reblog.html.haml new file mode 100644 index 000000000..895e903ea --- /dev/null +++ b/app/views/notification_mailer/reblog.html.haml @@ -0,0 +1,45 @@ +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.hero + .email-row + .col-6 + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.text-center.padded + %table.hero-icon{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td + = image_tag asset_pack_path('icon_cached.svg') + + %h1= t 'notification_mailer.reblog.title' + %p.lead= t('notification_mailer.reblog.body', name: @account.acct) + += render 'status', status: @status + +%table.email-table{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.email-body + .email-container + %table.content-section{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.content-cell.content-start.border-top + %table.column{ cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.column-cell.button-cell + %table.button{ align: 'center', cellspacing: 0, cellpadding: 0 } + %tbody + %tr + %td.button-primary + = link_to web_url("statuses/#{@status.id}") do + %span= t 'application_mailer.view_status' -- cgit From eed7484cd6541b93452cd7aa62a3f61c361c89cc Mon Sep 17 00:00:00 2001 From: mayaeh Date: Wed, 17 Jan 2018 20:41:24 +0900 Subject: Change mailer image url (#6279) * Change image URL in mailer to full path * Add application_mailer.view_profile localization. --- app/views/notification_mailer/favourite.html.haml | 2 +- app/views/notification_mailer/follow.html.haml | 2 +- app/views/notification_mailer/follow_request.html.haml | 2 +- app/views/notification_mailer/mention.html.haml | 2 +- app/views/notification_mailer/reblog.html.haml | 2 +- config/locales/en.yml | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) (limited to 'app/views/notification_mailer') diff --git a/app/views/notification_mailer/favourite.html.haml b/app/views/notification_mailer/favourite.html.haml index 6cbc552fa..f26b08b18 100644 --- a/app/views/notification_mailer/favourite.html.haml +++ b/app/views/notification_mailer/favourite.html.haml @@ -17,7 +17,7 @@ %tbody %tr %td - = image_tag asset_pack_path('icon_grade.svg') + = image_tag full_pack_url('icon_grade.svg'), alt:'' %h1= t 'notification_mailer.favourite.title' %p.lead= t('notification_mailer.favourite.body', name: @account.acct) diff --git a/app/views/notification_mailer/follow.html.haml b/app/views/notification_mailer/follow.html.haml index d1ae18ea9..1290e2bc4 100644 --- a/app/views/notification_mailer/follow.html.haml +++ b/app/views/notification_mailer/follow.html.haml @@ -17,7 +17,7 @@ %tbody %tr %td - = image_tag asset_pack_path('icon_person_add.svg') + = image_tag full_pack_url('icon_person_add.svg'), alt: '' %h1= t 'notification_mailer.follow.title' %p.lead= t('notification_mailer.follow.body', name: @account.acct) diff --git a/app/views/notification_mailer/follow_request.html.haml b/app/views/notification_mailer/follow_request.html.haml index ce5f578b1..41efeafaf 100644 --- a/app/views/notification_mailer/follow_request.html.haml +++ b/app/views/notification_mailer/follow_request.html.haml @@ -17,7 +17,7 @@ %tbody %tr %td - = image_tag asset_pack_path('icon_person_add.svg') + = image_tag full_pack_url('icon_person_add.svg'), alt: '' %h1= t 'notification_mailer.follow_request.title' %p.lead= t('notification_mailer.follow_request.body', name: @account.acct) diff --git a/app/views/notification_mailer/mention.html.haml b/app/views/notification_mailer/mention.html.haml index 9ecbe8550..619c580ce 100644 --- a/app/views/notification_mailer/mention.html.haml +++ b/app/views/notification_mailer/mention.html.haml @@ -17,7 +17,7 @@ %tbody %tr %td - = image_tag asset_pack_path('icon_reply.svg') + = image_tag full_pack_url('icon_reply.svg'), alt: '' %h1= t 'notification_mailer.mention.title' %p.lead= t('notification_mailer.mention.body', name: @status.account.acct) diff --git a/app/views/notification_mailer/reblog.html.haml b/app/views/notification_mailer/reblog.html.haml index 895e903ea..61c6ee6be 100644 --- a/app/views/notification_mailer/reblog.html.haml +++ b/app/views/notification_mailer/reblog.html.haml @@ -17,7 +17,7 @@ %tbody %tr %td - = image_tag asset_pack_path('icon_cached.svg') + = image_tag full_pack_url('icon_cached.svg'), alt: '' %h1= t 'notification_mailer.reblog.title' %p.lead= t('notification_mailer.reblog.body', name: @account.acct) diff --git a/config/locales/en.yml b/config/locales/en.yml index 7b9a1f15d..f23f35a89 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -343,6 +343,7 @@ en: settings: 'Change e-mail preferences: %{link}' signature: Mastodon notifications from %{instance} view: 'View:' + view_profile: View Profile view_status: View status applications: created: Application successfully created -- cgit