Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 49d3dd2

Browse files
committed
refactor(mailer): add template & fix typo
1 parent a28d68c commit 49d3dd2

File tree

3 files changed

+201
-4
lines changed

3 files changed

+201
-4
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
defmodule GroupherServer.Email.Templates.MentionAuthor do
2+
@moduledoc """
3+
template for mention author, like but not limit to:
4+
5+
post, job, video, repo ...
6+
or mention in comment ..
7+
8+
if you want change style or debug the template
9+
just copy and paste raw string to: https://mjml.io/try-it-live
10+
"""
11+
12+
def html(record) do
13+
"""
14+
TODO
15+
"""
16+
end
17+
18+
def text() do
19+
"""
20+
有人发帖了
21+
"""
22+
end
23+
24+
defp raw() do
25+
"""
26+
<mjml>
27+
<mj-head>
28+
<mj-title>Discount Light</mj-title>
29+
<mj-preview>Pre-header Text</mj-preview>
30+
<mj-attributes>
31+
<mj-all font-family="'Helvetica Neue', Helvetica, Arial, sans-serif"></mj-all>
32+
<mj-text font-weight="400" font-size="16px" color="#000000" line-height="24px" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif"></mj-text>
33+
</mj-attributes>
34+
<mj-style inline="inline">
35+
.body-section { -webkit-box-shadow: 1px 4px 11px 0px rgba(0, 0, 0, 0.15); -moz-box-shadow: 1px 4px 11px 0px rgba(0, 0, 0, 0.15); box-shadow: 1px 4px 11px 0px rgba(0, 0, 0, 0.15); }
36+
</mj-style>
37+
<mj-style inline="inline">
38+
.text-link { color: #5e6ebf }
39+
</mj-style>
40+
<mj-style inline="inline">
41+
.footer-link { color: #888888 }
42+
</mj-style>
43+
44+
</mj-head>
45+
<mj-body background-color="#002B34" width="600px">
46+
<mj-section full-width="full-width" background-color="#183a42" padding-bottom="0">
47+
<mj-column width="100%">
48+
<mj-text color="#17CBC4" font-weight="bold" align="center" font-size="18px" letter-spacing="1px" padding-top="20px">
49+
coderplanets
50+
<br/>
51+
</mj-text>
52+
<mj-text color="#0d8396" align="center" font-size="13px" padding-top="0" font-weight="bold" letter-spacing="1px" line-height="20px">
53+
the most sexiest community for developers, ever.
54+
</mj-text>
55+
56+
</mj-column>
57+
</mj-section>
58+
59+
<mj-wrapper padding-top="0" padding-bottom="0" css-class="body-section">
60+
<mj-section background-color="#042f3a" padding-left="6px" padding-right="6px">
61+
<mj-column width="100%">
62+
<mj-text color="#6f8696" font-weight="bold" font-size="18px">
63+
<br/>
64+
xxx 在文章/评论标题里提及/回复了你
65+
</mj-text>
66+
<mj-text color="#637381" font-size="16px">
67+
文章内容或评论内容摘要
68+
</mj-text>
69+
70+
<mj-divider border-width="1px" border-style="dashed" border-color="#113A41" />
71+
72+
73+
<mj-text color="#637381" font-size="16px" padding-top="10px" align="center">
74+
<a class="text-link" href="https://github.com/coderplanets.com">去看看 -></a>
75+
</mj-text>
76+
77+
</mj-column>
78+
</mj-section>
79+
80+
</mj-wrapper>
81+
82+
<mj-wrapper full-width="full-width">
83+
<mj-section>
84+
<mj-column width="100%" padding="0">
85+
<mj-social font-size="15px" icon-size="30px" mode="horizontal" padding="0" align="center">
86+
<mj-social-element name="github" href="https://github.com/coderplanets" background-color="#296C7D">
87+
</mj-social-element>
88+
</mj-social>
89+
90+
91+
<mj-text color="#445566" font-size="11px" align="center" line-height="16px">
92+
&copy; Coderplanets Inc., All Rights Reserved.
93+
</mj-text>
94+
</mj-column>
95+
</mj-section>
96+
<mj-section padding-top="0">
97+
<mj-group>
98+
<mj-column width="100%" padding-right="0">
99+
<mj-text color="#445566" font-size="11px" align="center" line-height="16px" font-weight="bold">
100+
<a class="footer-link" href="https://coderplanets.com/home/post/45">Privacy</a>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<a class="footer-link" href="https://www.github.com/coderplanets/coderplanets_web/issues">Unsubscribe</a>
101+
</mj-text>
102+
</mj-column>
103+
</mj-group>
104+
105+
</mj-section>
106+
</mj-wrapper>
107+
108+
</mj-body>
109+
</mjml>
110+
"""
111+
end
112+
end

lib/groupher_server/mailer/templates/notify_admin_on_content_created.ex

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,104 @@ defmodule GroupherServer.Email.Templates.NotifyAdminOnContentCreated do
88
"""
99
def html(record) do
1010
"""
11-
hello
11+
TODO
1212
"""
1313
end
1414

1515
def text() do
1616
"""
17-
有人打赏了
17+
有人发帖了
1818
"""
1919
end
2020

2121
defp raw() do
2222
"""
23-
TODO
23+
<mjml>
24+
<mj-head>
25+
<mj-title>Discount Light</mj-title>
26+
<mj-preview>Pre-header Text</mj-preview>
27+
<mj-attributes>
28+
<mj-all font-family="'Helvetica Neue', Helvetica, Arial, sans-serif"></mj-all>
29+
<mj-text font-weight="400" font-size="16px" color="#000000" line-height="24px" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif"></mj-text>
30+
</mj-attributes>
31+
<mj-style inline="inline">
32+
.body-section { -webkit-box-shadow: 1px 4px 11px 0px rgba(0, 0, 0, 0.15); -moz-box-shadow: 1px 4px 11px 0px rgba(0, 0, 0, 0.15); box-shadow: 1px 4px 11px 0px rgba(0, 0, 0, 0.15); }
33+
</mj-style>
34+
<mj-style inline="inline">
35+
.text-link { color: #5e6ebf }
36+
</mj-style>
37+
<mj-style inline="inline">
38+
.footer-link { color: #888888 }
39+
</mj-style>
40+
41+
</mj-head>
42+
<mj-body background-color="#002B34" width="600px">
43+
<mj-section full-width="full-width" background-color="#183a42" padding-bottom="0">
44+
<mj-column width="100%">
45+
<mj-text color="#17CBC4" font-weight="bold" align="center" font-size="18px" letter-spacing="1px" padding-top="20px">
46+
coderplanets
47+
<br/>
48+
</mj-text>
49+
<mj-text color="#0d8396" align="center" font-size="13px" padding-top="0" font-weight="bold" letter-spacing="1px" line-height="20px">
50+
the most sexiest community for developers, ever.
51+
</mj-text>
52+
53+
</mj-column>
54+
</mj-section>
55+
56+
<mj-wrapper padding-top="0" padding-bottom="0" css-class="body-section">
57+
<mj-section background-color="#042f3a" padding-left="6px" padding-right="6px">
58+
<mj-column width="100%">
59+
<mj-text color="#6f8696" font-weight="bold" font-size="18px">
60+
这里是文章标题
61+
</mj-text>
62+
<mj-text color="#637381" font-size="16px">
63+
这是文章的文字版,作者名字放在邮件标题就好
64+
</mj-text>
65+
66+
<mj-divider border-width="1px" border-style="dashed" border-color="#113A41" />
67+
68+
<mj-text color="#637381" font-size="16px" padding-top="30px" align="center">
69+
<a class="text-link" href="https://github.com/coderplanets.com">社区地址 -></a>
70+
</mj-text>
71+
72+
<mj-text color="#637381" font-size="16px" padding-top="10px" align="center">
73+
<a class="text-link" href="https://github.com/coderplanets.com">文章地址 -></a>
74+
</mj-text>
75+
76+
</mj-column>
77+
</mj-section>
78+
79+
</mj-wrapper>
80+
81+
<mj-wrapper full-width="full-width">
82+
<mj-section>
83+
<mj-column width="100%" padding="0">
84+
<mj-social font-size="15px" icon-size="30px" mode="horizontal" padding="0" align="center">
85+
<mj-social-element name="github" href="https://github.com/coderplanets" background-color="#296C7D">
86+
</mj-social-element>
87+
</mj-social>
88+
89+
90+
<mj-text color="#445566" font-size="11px" align="center" line-height="16px">
91+
&copy; Coderplanets Inc., All Rights Reserved.
92+
</mj-text>
93+
</mj-column>
94+
</mj-section>
95+
<mj-section padding-top="0">
96+
<mj-group>
97+
<mj-column width="100%" padding-right="0">
98+
<mj-text color="#445566" font-size="11px" align="center" line-height="16px" font-weight="bold">
99+
<a class="footer-link" href="https://coderplanets.com/home/post/45">Privacy</a>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<a class="footer-link" href="https://www.github.com/coderplanets/coderplanets_web/issues">Unsubscribe</a>
100+
</mj-text>
101+
</mj-column>
102+
</mj-group>
103+
104+
</mj-section>
105+
</mj-wrapper>
106+
107+
</mj-body>
108+
</mjml>
24109
"""
25110
end
26111
end

lib/groupher_server/mailer/templates/notify_admin_payment.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
593593
<mj-section>
594594
<mj-column width="100%" padding="0">
595595
<mj-social font-size="15px" icon-size="30px" mode="horizontal" padding="0" align="center">
596-
<mj-social-element name="github" href="https://mjml.io/" background-color="#296C7D">
596+
<mj-social-element name="github" href="https://github.com/coderplanets" background-color="#296C7D">
597597
</mj-social-element>
598598
</mj-social>
599599
<mj-text color="#445566" font-size="11px" align="center" line-height="16px">

0 commit comments

Comments
 (0)