Browse Source

Nicer html report

pull/64/head
Pēteris Caune 9 years ago
parent
commit
2df92c9c9e
3 changed files with 48 additions and 28 deletions
  1. +12
    -10
      hc/lib/emails.py
  2. +8
    -3
      templates/emails/base.html
  3. +28
    -15
      templates/emails/report-body-html.html

+ 12
- 10
hc/lib/emails.py View File

@ -1,26 +1,28 @@
from django.conf import settings
from djmail.template_mail import InlineCSSTemplateMail from djmail.template_mail import InlineCSSTemplateMail
def login(to, ctx):
o = InlineCSSTemplateMail("login")
def send(name, to, ctx):
o = InlineCSSTemplateMail(name)
ctx["SITE_ROOT"] = settings.SITE_ROOT
o.send(to, ctx) o.send(to, ctx)
def login(to, ctx):
send("login", to, ctx)
def set_password(to, ctx): def set_password(to, ctx):
o = InlineCSSTemplateMail("set-password")
o.send(to, ctx)
send("set-password", to, ctx)
def alert(to, ctx): def alert(to, ctx):
o = InlineCSSTemplateMail("alert")
o.send(to, ctx)
send("alert", to, ctx)
def verify_email(to, ctx): def verify_email(to, ctx):
o = InlineCSSTemplateMail("verify-email")
o.send(to, ctx)
send("verify-email", to, ctx)
def report(to, ctx): def report(to, ctx):
o = InlineCSSTemplateMail("report")
o.send(to, ctx)
send("report", to, ctx)

+ 8
- 3
templates/emails/base.html View File

@ -79,7 +79,10 @@
text-align: center; text-align: center;
} }
.email-footer p { .email-footer p {
color: #AEAEAE;
color: #74787E;
}
.email-footer a {
color: #74787E;
} }
.body-action { .body-action {
width: 100%; width: 100%;
@ -181,7 +184,7 @@
<!-- Logo --> <!-- Logo -->
<tr> <tr>
<td class="email-masthead"> <td class="email-masthead">
<a class="email-masthead_name">Healthchecks</a>
<img src="{{ SITE_ROOT }}/img/logo-full.png" alt="" />
</td> </td>
</tr> </tr>
<!-- Email Body --> <!-- Email Body -->
@ -202,7 +205,9 @@
<table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0"> <table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0">
<tr> <tr>
<td class="content-cell"> <td class="content-cell">
<p class="sub center">&copy; 2016 healthchecks<span>.</span>io. All rights reserved.</p>
<p class="sub center">&copy; 2016 healthchecks<span>.</span>io. All rights reserved.
{% block unsub %}{% endblock %}
</p>
</td> </td>
</tr> </tr>
</table> </table>


+ 28
- 15
templates/emails/report-body-html.html View File

@ -1,13 +1,23 @@
{% extends "emails/base.html" %}
{% load humanize hc_extras %} {% load humanize hc_extras %}
{% block content %}
<style> <style>
th {
.checks {
margin: 30px 0;
width: 100%;
font-size: 16px;
}
.checks th {
text-align: left; text-align: left;
padding: 8px; padding: 8px;
font-size: 12px;
} }
td {
border-top: 1px solid #ddd;
.checks td {
border-top: 1px solid #EDEFF2;
padding: 8px; padding: 8px;
} }
@ -25,16 +35,20 @@
.unnamed { .unnamed {
color: #888;
color: #74787E;
font-style: italic; font-style: italic;
} }
.view-log {
font-size: 13px;
}
</style> </style>
<p>Hello,</p>
<h1>Hello,</h1>
<p>This is a monthly report sent by <a href="https://healthchecks.io">healthchecks.io</a>.</p> <p>This is a monthly report sent by <a href="https://healthchecks.io">healthchecks.io</a>.</p>
<table>
<table class="checks" cellpadding="0" cellspacing="0">
<tr> <tr>
<th></th> <th></th>
<th>Name</th> <th>Name</th>
@ -76,7 +90,7 @@
{% endif %} {% endif %}
</td> </td>
<td> <td>
<a href="{{ check.log_url }}">View Log</a>
<a class="view-log" href="{{ check.log_url }}">View Log</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -87,12 +101,11 @@ Do you have more cron jobs,
not yet on this list, that would benefit from monitoring? not yet on this list, that would benefit from monitoring?
Get the ball rolling by adding one more!</p> Get the ball rolling by adding one more!</p>
<p>
--<br />
Regards,<br />
healthchecks.io
</p>
<p>Cheers,<br>The Healthchecks<span>.</span>io</a> Team</p>
{% endblock %}
<p>
<a href="{{ unsub_link }}">Unsubscribe from future monthly reports</a>
</p>
{% block unsub %}
<br />
<a href="{{ unsub_link }}">Unsubscribe from future monthly reports</a>
{% endblock %}

Loading…
Cancel
Save