Mail templates for monitoring mails
This commit is contained in:
parent
71690b7d5c
commit
eb3e0d96be
|
@ -1,33 +1,4 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
em {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table border="0" cellpadding="10" cellspacing="0" bgcolor="#EDEDED">
|
||||
<tr>
|
||||
<td style="color: #444444; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, sans-serif;">
|
||||
<p>
|
||||
<strong style="font-size: 1.5em;">Hallo <%- node.nickname %>,</strong>
|
||||
</p>
|
||||
<%= header() %>
|
||||
|
||||
<p>
|
||||
für einen Deiner Knoten wurde der automatisierte Versand von Status-E-Mails aktiviert. Um sicherzustellen, dass
|
||||
|
@ -47,7 +18,7 @@
|
|||
|
||||
<tr>
|
||||
<th>Empfänger</th>
|
||||
<td><a href="mailto:<%- node.email %>" style="color: #E5287A;"><%- node.email %></a></td>
|
||||
<td><%= link('mailto:' + node.email, node.email) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
@ -58,7 +29,7 @@
|
|||
<tr>
|
||||
<td align="center" style="font-size: 1.5em;">
|
||||
<strong>
|
||||
<a href="<%- confirmUrl %>" style="color: #E5287A;">» E-Mail-Adresse bestätigen «</a>
|
||||
<%= link(confirmUrl, '» E-Mail-Adresse bestätigen «') %>
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -66,41 +37,6 @@
|
|||
|
||||
<p></p>
|
||||
|
||||
<p>
|
||||
Bei Fragen wende Dich gerne an
|
||||
<a href="mailto:<%- community.contactEmail %>" style="color: #E5287A;"><%- community.contactEmail %></a>.
|
||||
</p>
|
||||
<%= monitoringFooter() %>
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
Viele Grüße<br />
|
||||
Dein <%- community.name %>
|
||||
</strong>
|
||||
</p>
|
||||
|
||||
<hr style="border-top: 1px solid #333333; border-left: 0; border-right: 0; border-bottom: 0;" />
|
||||
|
||||
<p>
|
||||
<em>
|
||||
Möchtest Du keine Status-E-Mails zu Diesem Knoten mehr erhalten, so kannst Du den Versand
|
||||
jederzeit <a href="<%- disableUrl %>" style="color: #E5287A;">deaktivieren</a>.
|
||||
</em>
|
||||
</p>
|
||||
<p>
|
||||
<em>
|
||||
Alternativ kannst Du die Versandeinstellungen auch jederzeit unter
|
||||
<a href="<%- editNodeUrl %>" style="color: #E5287A;"><%- editNodeUrl %></a>
|
||||
ändern.
|
||||
</em>
|
||||
</p>
|
||||
<p>
|
||||
<em>
|
||||
Bitte habe Verständnis dafür, dass das An- und Abschalten des Versands für jeden Deiner Knoten
|
||||
einzeln erfolgt.
|
||||
</em>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
<%= footer() %>
|
||||
|
|
11
server/mailTemplates/monitoring-offline-1.body.html
Normal file
11
server/mailTemplates/monitoring-offline-1.body.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<%= header() %>
|
||||
|
||||
<%=
|
||||
snippet('monitoring-offline', {
|
||||
mailNum: 1
|
||||
})
|
||||
%>
|
||||
|
||||
<%= monitoringFooter() %>
|
||||
|
||||
<%= footer() %>
|
1
server/mailTemplates/monitoring-offline-1.subject.txt
Normal file
1
server/mailTemplates/monitoring-offline-1.subject.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Dein Knoten <%- node.hostname %> ist offline
|
11
server/mailTemplates/monitoring-offline-2.body.html
Normal file
11
server/mailTemplates/monitoring-offline-2.body.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<%= header() %>
|
||||
|
||||
<%=
|
||||
snippet('monitoring-offline', {
|
||||
mailNum: 2
|
||||
})
|
||||
%>
|
||||
|
||||
<%= monitoringFooter() %>
|
||||
|
||||
<%= footer() %>
|
1
server/mailTemplates/monitoring-offline-2.subject.txt
Normal file
1
server/mailTemplates/monitoring-offline-2.subject.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Dein Knoten <%- node.hostname %> ist weiterhin offline
|
11
server/mailTemplates/monitoring-offline-3.body.html
Normal file
11
server/mailTemplates/monitoring-offline-3.body.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<%= header() %>
|
||||
|
||||
<%=
|
||||
snippet('monitoring-offline', {
|
||||
mailNum: 3
|
||||
})
|
||||
%>
|
||||
|
||||
<%= monitoringFooter() %>
|
||||
|
||||
<%= footer() %>
|
1
server/mailTemplates/monitoring-offline-3.subject.txt
Normal file
1
server/mailTemplates/monitoring-offline-3.subject.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Dein Knoten <%- node.hostname %> ist weiterhin offline
|
29
server/mailTemplates/monitoring-online-again.body.html
Normal file
29
server/mailTemplates/monitoring-online-again.body.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<%= header() %>
|
||||
|
||||
<p>
|
||||
Dein Knoten ist wieder online.
|
||||
</p>
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top: 45px; margin-bottom: 45px;">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table class="table" style="border: 3px dashed #666666; padding: 10px; background-color: #F5F5F5; font-size: 1.3em;">
|
||||
<tr>
|
||||
<th>Knoten</th>
|
||||
<td><%- node.hostname %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Wieder online seit</th>
|
||||
<td><%= formatDateTime(lastSeen) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p></p>
|
||||
|
||||
<%= monitoringFooter() %>
|
||||
|
||||
<%= footer() %>
|
1
server/mailTemplates/monitoring-online-again.subject.txt
Normal file
1
server/mailTemplates/monitoring-online-again.subject.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Dein Knoten <%- node.hostname %> ist wieder online
|
6
server/mailTemplates/snippets/footer.html
Normal file
6
server/mailTemplates/snippets/footer.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
31
server/mailTemplates/snippets/header.html
Normal file
31
server/mailTemplates/snippets/header.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
th {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
em {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<table border="0" cellpadding="10" cellspacing="0" bgcolor="#EDEDED" width="100%">
|
||||
<tr>
|
||||
<td style="color: #444444; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, sans-serif;">
|
||||
<p>
|
||||
<strong style="font-size: 1.5em;">Hallo <%- node.nickname %>,</strong>
|
||||
</p>
|
32
server/mailTemplates/snippets/monitoring-footer.html
Normal file
32
server/mailTemplates/snippets/monitoring-footer.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<p>
|
||||
Bei Fragen wende Dich gerne an
|
||||
<%= link('mailto:' + community.contactEmail, community.contactEmail) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
Viele Grüße<br />
|
||||
Dein <%- community.name %>
|
||||
</strong>
|
||||
</p>
|
||||
|
||||
<%= hr() %>
|
||||
|
||||
<p>
|
||||
<em>
|
||||
Möchtest Du keine Status-E-Mails zu Diesem Knoten mehr erhalten, so kannst Du den Versand
|
||||
jederzeit <%= link(disableUrl, 'deaktivieren') %>.
|
||||
</em>
|
||||
</p>
|
||||
<p>
|
||||
<em>
|
||||
Alternativ kannst Du die Versandeinstellungen auch jederzeit unter
|
||||
<%= link(editNodeUrl, editNodeUrl) %> ändern.
|
||||
</em>
|
||||
</p>
|
||||
<p>
|
||||
<em>
|
||||
Bitte habe Verständnis dafür, dass das An- und Abschalten des Versands für jeden Deiner Knoten
|
||||
einzeln erfolgt.
|
||||
</em>
|
||||
</p>
|
23
server/mailTemplates/snippets/monitoring-offline.html
Normal file
23
server/mailTemplates/snippets/monitoring-offline.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<p>
|
||||
Dein Knoten ist <% if (mailNum === 1) { %>akutell<% } else { %>weiterhin<% } %> offline.
|
||||
</p>
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top: 45px; margin-bottom: 45px;">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table class="table" style="border: 3px dashed #666666; padding: 10px; background-color: #F5F5F5; font-size: 1.3em;">
|
||||
<tr>
|
||||
<th>Knoten</th>
|
||||
<td><%- node.hostname %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Zuletzt online</th>
|
||||
<td><%= formatFromNow(lastSeen) %> (<%= formatDateTime(lastSeen) %>)</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p></p>
|
|
@ -8,9 +8,64 @@ angular.module('ffffng')
|
|||
async,
|
||||
deepExtend,
|
||||
fs,
|
||||
moment,
|
||||
Logger
|
||||
) {
|
||||
var templateBasePath = __dirname + '/../mailTemplates';
|
||||
var snippetsBasePath = templateBasePath + '/snippets';
|
||||
|
||||
var templateFunctions = {};
|
||||
|
||||
function renderSnippet(name, data) {
|
||||
var snippetFile = snippetsBasePath + '/' + name + '.html';
|
||||
|
||||
return _.template(fs.readFileSync(snippetFile).toString())(deepExtend(
|
||||
{},
|
||||
this, // parent data
|
||||
data,
|
||||
templateFunctions
|
||||
));
|
||||
}
|
||||
|
||||
function snippet(name) {
|
||||
return function (data) {
|
||||
return renderSnippet.bind(this)(name, data);
|
||||
}
|
||||
}
|
||||
|
||||
function renderLink(href, text) {
|
||||
return _.template(
|
||||
'<a href="<%- href %>" style="color: #E5287A;"><%- text %></a>'
|
||||
)({
|
||||
href: href,
|
||||
text: text || href
|
||||
});
|
||||
}
|
||||
|
||||
function renderHR() {
|
||||
return '<hr style="border-top: 1px solid #333333; border-left: 0; border-right: 0; border-bottom: 0;" />';
|
||||
}
|
||||
|
||||
function formatDateTime(unix) {
|
||||
return moment.unix(unix).locale('de').local().format('DD.MM.YYYY HH:mm');
|
||||
}
|
||||
|
||||
function formatFromNow(unix) {
|
||||
return moment.unix(unix).locale('de').fromNow();
|
||||
}
|
||||
|
||||
templateFunctions.header = snippet('header');
|
||||
templateFunctions.footer = snippet('footer');
|
||||
|
||||
templateFunctions.monitoringFooter = snippet('monitoring-footer');
|
||||
|
||||
templateFunctions.snippet = renderSnippet;
|
||||
|
||||
templateFunctions.link = renderLink;
|
||||
templateFunctions.hr = renderHR;
|
||||
|
||||
templateFunctions.formatDateTime = formatDateTime;
|
||||
templateFunctions.formatFromNow = formatFromNow;
|
||||
|
||||
return {
|
||||
configureTransporter: function (transporter) {
|
||||
|
@ -38,7 +93,8 @@ angular.module('ffffng')
|
|||
{
|
||||
community: config.client.community,
|
||||
editNodeUrl: UrlBuilder.editNodeUrl()
|
||||
}
|
||||
},
|
||||
templateFunctions
|
||||
);
|
||||
|
||||
function render(field) {
|
||||
|
|
Loading…
Reference in a new issue