Improve emails (#305)

This commit is contained in:
Riccardo Graziosi
2024-03-09 17:26:24 +01:00
committed by GitHub
parent 5ad01b0138
commit 98daafc244
32 changed files with 169 additions and 101 deletions

View File

@@ -4,6 +4,13 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div><%= yield %></div>
<div style="margin: 16px auto; text-align: center;">
<a href="<%= add_subdomain_to(method(:root_url)) %>">
<%= image_tag('logo.png', alt: 'Astuto Logo', size: 64) %>
</a>
</div>
<div style="max-width: 580px; margin: 0 auto; border: 1px solid rgba(0, 0, 0, 0.125); border-radius: 0.25rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04),0 2px 4px -1px rgba(0, 0, 0, 0.03); padding: 24px; font-family: system-ui, sans-serif; font-size: 18px;">
<%= yield %>
</div>
</body>
</html>

View File

@@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p><%= t('mailers.user.opening_greeting') %></p>
<div><%= yield %></div>
<p><%= t('mailers.user.closing_greeting') %></p>
<footer>
<%=
link_to(
t('mailers.user.unsubscribe'),
add_subdomain_to(method(:edit_user_registration_url))
)
%>.
</footer>
</body>
</html>

View File

@@ -1 +0,0 @@
<%= yield %>

View File

@@ -0,0 +1 @@
<p><%= t('mailers.user.closing_greeting') %></p>

View File

@@ -0,0 +1 @@
<p><%= t('mailers.user.opening_greeting', name: user_name) %></p>

View File

@@ -0,0 +1,3 @@
<p style="width: 80%; margin: 32px auto; font-size: 16px; border: 1px solid rgba(0, 0, 0, 0.125); border-radius: 0.25rem; padding: 16px;">
<%= text %>
</p>

View File

@@ -0,0 +1,11 @@
<footer>
<hr style="border-top: 1px;">
<p style="margin-bottom: 0; font-size: 14px; color: grey;">
<%=
t(
'mailers.user.unsubscribe_from_post_html',
href: link_to(t('mailers.user.unsubscribe_link'), add_subdomain_to(method(:post_url), post))
)
%>
</p>
</footer>

View File

@@ -0,0 +1,11 @@
<footer>
<hr style="border-top: 1px;">
<p style="margin-bottom: 0; font-size: 14px; color: grey;">
<%=
t(
'mailers.user.unsubscribe_from_site_html',
href: link_to(t('mailers.user.unsubscribe_link'), add_subdomain_to(method(:edit_user_registration_url)))
).html_safe
%>
</p>
</footer>

View File

@@ -1,11 +1,15 @@
<p>
<%= t('mailers.user.notify_comment_owner.body', user: @comment.user.full_name, post: @comment.post.title) %>
</p>
<%= render 'user_mailer/opening', user_name: @user.full_name %>
<p>
<i><%= @comment.body %></i>
<%= t('mailers.user.notify_comment_owner.body_html', user: @comment.user.full_name, post: @comment.post.title) %>:
</p>
<%= render 'user_mailer/quoted_text', text: @comment.body %>
<p>
<%= link_to t('mailers.user.learn_more'), add_subdomain_to(method(:post_url), @comment.post) %>
</p>
<%= render 'user_mailer/closing' %>
<%= render 'user_mailer/unsubscribe_from_site' %>

View File

@@ -0,0 +1,17 @@
<%= render 'user_mailer/opening', user_name: @user.full_name %>
<p>
<%= t('mailers.user.notify_follower_of_post_status_change.body_html', post: @post.title) %>:
</p>
<p style="margin: 32px auto; text-align: center;">
<span style='color: white; border-radius: 10rem; padding: 0.5rem; background-color: <%= @post.post_status.color %>;'><%= @post.post_status.name.upcase %></span>
</p>
<p>
<%= link_to t('mailers.user.learn_more'), add_subdomain_to(method(:post_url), @post) %>
</p>
<%= render 'user_mailer/closing' %>
<%= render 'user_mailer/unsubscribe_from_post', post: @post %>

View File

@@ -0,0 +1,15 @@
<%= render 'user_mailer/opening', user_name: @user.full_name %>
<p>
<%= t('mailers.user.notify_follower_of_post_update.body_html', user: @comment.user.full_name, post: @comment.post.title) %>:
</p>
<%= render 'user_mailer/quoted_text', text: @comment.body %>
<p>
<%= link_to t('mailers.user.learn_more'), add_subdomain_to(method(:post_url), @comment.post) %>
</p>
<%= render 'user_mailer/closing' %>
<%= render 'user_mailer/unsubscribe_from_post', post: @comment.post %>

View File

@@ -1,10 +0,0 @@
<p>
<%= t('mailers.user.notify_followers_of_post_status_change.body', post: @post.title) %>
<span style='color: white; border-radius: 10rem; padding: 0.5rem; background-color: <%= @post.post_status.color %>;'>
<%= @post.post_status.name.upcase %>
</span>
</p>
<p>
<%= link_to t('mailers.user.learn_more'), add_subdomain_to(method(:post_url), @post) %>
</p>

View File

@@ -1,11 +0,0 @@
<p>
<%= t('mailers.user.notify_followers_of_post_update.body', user: @comment.user.full_name, post: @comment.post.title) %>
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to t('mailers.user.learn_more'), add_subdomain_to(method(:post_url), @comment.post) %>
</p>

View File

@@ -1,11 +1,15 @@
<p>
<%= t('mailers.user.notify_post_owner.body', user: @comment.user.full_name, post: @comment.post.title) %>
</p>
<%= render 'user_mailer/opening', user_name: @user.full_name %>
<p>
<i><%= @comment.body %></i>
<%= t('mailers.user.notify_post_owner.body_html', user: @comment.user.full_name, post: @comment.post.title) %>:
</p>
<%= render 'user_mailer/quoted_text', text: @comment.body %>
<p>
<%= link_to t('mailers.user.learn_more'), add_subdomain_to(method(:post_url), @comment.post) %>
</p>
<%= render 'user_mailer/closing' %>
<%= render 'user_mailer/unsubscribe_from_post', post: @comment.post %>