forked from ActiveCampaign/mailmason
-
Notifications
You must be signed in to change notification settings - Fork 0
/
previews.html
256 lines (240 loc) · 8.75 KB
/
previews.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Postmark Template Previews</title>
<script>
var templates = {
"welcome": {
"name": "Welcome",
"description": "Send a welcome email to users after they sign up.",
"guide": "https://postmarkapp.com/guides/welcome-email-best-practices"
},
"password_reset": {
"name": "Password Reset",
"description": "Send users a link to reset their password.",
"guide": "https://postmarkapp.com/guides/password-reset-email-best-practices"
},
"password_reset_help": {
"name": "Password Reset Help",
"description": "Help users reset their password if they can’t remember their email.",
"guide": "https://postmarkapp.com/guides/password-reset-email-best-practices"
},
"invoice": {
"name": "Invoice",
"description": "Request payment from a user.",
"guide": "https://postmarkapp.com/guides/receipt-and-invoice-email-best-practices"
},
"receipt": {
"name": "Receipt",
"description": "Send a receipt to users after they made a purchase.",
"guide": "https://postmarkapp.com/guides/receipt-and-invoice-email-best-practices"
},
"comment_notification": {
"name": "Comment Notification",
"description": "Notify users of new comments by other users.",
"guide": "https://postmarkapp.com/guides/comment-notification-email-best-practices"
},
"trial_expiring": {
"name": "Trial Expiring",
"description": "Let users know when their trial is about to expire.",
"guide": "https://postmarkapp.com/guides/trial-expiration-email-best-practices"
},
"trial_expired": {
"name": "Trial Expired",
"description": "Let users know when their expired trial.",
"guide": "https://postmarkapp.com/guides/trial-expiration-email-best-practices"
},
"user_invitation": {
"name": "User Invitation",
"description": "Help users invite others to use your software.",
"guide": "https://postmarkapp.com/guides/user-invitation-email-best-practices"
},
"example": {
"name": "Example",
"description": "Examples of built-in elements and styles.",
"guide": "https://postmarkapp.com/guides/transactional-email-best-practices"
}
}
</script>
<style>
body {
border-top: 8px solid #FEDF32;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 24px;
margin: 0;
/* Width is just big enough to fit desktop and mobile views side-by-side */
}
a {
color: #137FC9;
display: inline-block;
padding: 2px 4px;
text-decoration: none;
border-radius: 4px;
}
a[href="#toc"] {
float: right;
font-size: 120%;
font-weight: bold;
margin-top: -24px;
padding: 4px 8px;
}
a[href="#toc"]:after {
content: "\0020\21e7";
font-size: 120%;
}
a:hover {
background-color: #EFF5FC;
}
ol {
line-height: 1.6;
}
h1, hr {
clear: both;
}
h1 {
margin-bottom: 0;
}
p {
margin-top: 0;
}
hr {
display: block;
border-top: 1px solid #ccc;
border-bottom: none;
border-right: none;
border-left: none;
margin-top: 48px;
margin-bottom: 48px;
}
nav {
border-bottom: 1px solid #ccc;
display: block;
padding-bottom: 24px;
margin-bottom: 24px;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
}
nav ul li:first-child {
border-right: 1px solid #ccc;
font-weight: bold;
padding-right: 16px;
margin-right: 8px;
}
nav li {
display: inline-block;
}
nav a {
font-weight: normal;
margin-right: 8px;
}
nav a:after {
content: " \0020\2197";
}
div.container {
width: 1128px;
margin-left: auto;
margin-right: auto;
}
a.mailmason-logo {
float: right;
}
div.table-of-contents {
float: left;
padding-bottom: 24px;
}
</style>
</head>
<body>
<div class="container">
<nav>
<ul>
<li>MailMason</li>
<li><a href="https://github.com/wildbit/mailmason/wiki">Repository</a></li>
<li><a href="https://github.com/wildbit/mailmason/wiki">Documentation</a></li>
<li><a href="https://postmarkapp.com/why/templates">Postmark Templates</a></li>
</ul>
</nav>
<a href="https://github.com/wildbit/mailmason" class="mailmason-logo"><img src="http://assets.wildbit.com/wildbit/repos/mailmason/mailmason.png" alt="MailMason"></a>
<div class="table-of-contents">
<h1>MailMason Template Previews</h1>
<ol id="toc">
<!--
The table of contents is generated from the templates hash at the top
of the page using the JavaScript at the bottom of the page
-->
</ol>
</div>
<hr>
<div id="previews">
<!--
The previews are generated from the templates hash at the top
of the page using the JavaScript at the bottom of the page
-->
</div>
</div>
<script>
// This is the block of JavaScript that generates the TOC and previews
// Find the table of contents and previews area
var toc = document.getElementById("toc");
var previews = document.getElementById("previews");
// Iterate over the templates to generate the TOC and previews
for (var key in templates) {
console.log(key);
// Build the table of contents for the various templates
var list_item = document.createElement("li");
var anchor = document.createElement("a");
anchor.setAttribute("href", "#" + key);
anchor.appendChild(document.createTextNode(templates[key]["name"]));
list_item.appendChild(anchor);
list_item.appendChild(document.createTextNode(" - " + templates[key]["description"]));
toc.appendChild(list_item);
// Build the heading for the template
var heading = document.createElement("h1");
var description = document.createElement("p");
var guide_link = document.createElement("a");
var top_link = document.createElement("a");
top_link.setAttribute("href", "#toc");
top_link.appendChild(document.createTextNode("Back to Top"));
guide_link.setAttribute("href", templates[key]["guide"]);
guide_link.setAttribute("target", "_blank");
guide_link.setAttribute("rel", "noopener noreferrer");
guide_link.appendChild(document.createTextNode("📖 View Best Practices Guide"));
heading.appendChild(document.createTextNode(templates[key]["name"]));
heading.setAttribute("id", key);
description.appendChild(document.createTextNode(templates[key]["description"]));
description.appendChild(guide_link)
previews.appendChild(heading);
previews.appendChild(top_link);
previews.appendChild(description);
// Build the wide iframe preview for wide view of the template
var wide_preview = document.createElement("iframe");
wide_preview.setAttribute("width", "640")
wide_preview.setAttribute("height", "800")
wide_preview.setAttribute("src", "dist/" + key + ".html")
previews.appendChild(wide_preview);
// Build the wide iframe preview for narrow view of the template
var narrow_preview = document.createElement("iframe");
narrow_preview.setAttribute("width", "480")
narrow_preview.setAttribute("height", "800")
narrow_preview.setAttribute("src", "dist/" + key + ".html")
previews.appendChild(narrow_preview);
// Build the wide iframe preview for wide view of the template
var wide_preview = document.createElement("iframe");
wide_preview.setAttribute("width", "640")
wide_preview.setAttribute("height", "400")
wide_preview.setAttribute("src", "dist/" + key + ".txt")
previews.appendChild(wide_preview);
// Build the wide iframe preview for narrow view of the template
var narrow_preview = document.createElement("iframe");
narrow_preview.setAttribute("width", "480")
narrow_preview.setAttribute("height", "400")
narrow_preview.setAttribute("src", "dist/" + key + ".txt")
previews.appendChild(narrow_preview);
};
</script>
</body>
</html>