From 8d956b3365b3050f3dfdf50c801b7c7c4f21d16e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C4=93teris=20Caune?=
Date: Sun, 15 Jan 2017 13:10:08 +0200
Subject: [PATCH] email template from Litmus. CSS already inlined, so dropping
premailer dependency.
---
hc/accounts/models.py | 8 +-
hc/front/templatetags/hc_extras.py | 6 +
hc/lib/emails.py | 4 +-
requirements.txt | 1 -
templates/emails/alert-body-html.html | 24 +-
templates/emails/base.html | 388 +++++++++----------
templates/emails/login-body-html.html | 60 +--
templates/emails/login-body-text.html | 2 +-
templates/emails/report-body-html.html | 20 +-
templates/emails/set-password-body-html.html | 18 +-
templates/emails/set-password-body-text.html | 2 +-
templates/emails/summary-html.html | 117 ++----
12 files changed, 302 insertions(+), 348 deletions(-)
diff --git a/hc/accounts/models.py b/hc/accounts/models.py
index 63522dde..1b311ab0 100644
--- a/hc/accounts/models.py
+++ b/hc/accounts/models.py
@@ -35,7 +35,8 @@ class Profile(models.Model):
path = reverse("hc-check-token", args=[self.user.username, token])
ctx = {
- "login_link": settings.SITE_ROOT + path,
+ "button_text": "Log In",
+ "button_url": settings.SITE_ROOT + path,
"inviting_profile": inviting_profile
}
emails.login(self.user.email, ctx)
@@ -46,7 +47,10 @@ class Profile(models.Model):
self.save()
path = reverse("hc-set-password", args=[token])
- ctx = {"set_password_link": settings.SITE_ROOT + path}
+ ctx = {
+ "button_text": "Set Password",
+ "button_url": settings.SITE_ROOT + path
+ }
emails.set_password(self.user.email, ctx)
def set_api_key(self):
diff --git a/hc/front/templatetags/hc_extras.py b/hc/front/templatetags/hc_extras.py
index 3014db9a..4a61d181 100644
--- a/hc/front/templatetags/hc_extras.py
+++ b/hc/front/templatetags/hc_extras.py
@@ -1,5 +1,6 @@
from django import template
from django.conf import settings
+from django.utils.safestring import mark_safe
from hc.lib.date import format_duration
@@ -21,6 +22,11 @@ def site_name():
return settings.SITE_NAME
+@register.simple_tag
+def escaped_site_name():
+ return mark_safe(settings.SITE_NAME.replace(".", "."))
+
+
@register.simple_tag
def site_root():
return settings.SITE_ROOT
diff --git a/hc/lib/emails.py b/hc/lib/emails.py
index 086478a6..a6b4b5a6 100644
--- a/hc/lib/emails.py
+++ b/hc/lib/emails.py
@@ -1,9 +1,9 @@
from django.conf import settings
-from djmail.template_mail import InlineCSSTemplateMail
+from djmail.template_mail import TemplateMail
def send(name, to, ctx):
- o = InlineCSSTemplateMail(name)
+ o = TemplateMail(name)
ctx["SITE_ROOT"] = settings.SITE_ROOT
o.send(to, ctx)
diff --git a/requirements.txt b/requirements.txt
index d6b4d835..4620f2ec 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,7 +4,6 @@ django-ses-backend==0.1.1
Django==1.10.1
django_compressor==2.1
djmail==0.11.0
-premailer==2.9.6
psycopg2==2.6.1
pytz==2016.7
requests==2.9.1
diff --git a/templates/emails/alert-body-html.html b/templates/emails/alert-body-html.html
index 6c9b9a37..f97c5b87 100644
--- a/templates/emails/alert-body-html.html
+++ b/templates/emails/alert-body-html.html
@@ -2,24 +2,26 @@
{% load hc_extras %}
{% block content %}
-Hello,
-
- This is a notification sent by {% site_name %}.
-
- The check {{ check.name_then_code }}
- has gone {{ check.status|upper }}.
-
+Hello,
-Here is a summary of all your checks:
+This is a notification sent by {% site_name %}.
+
+The check {{ check.name_then_code }}
+has gone {{ check.status|upper }}.
+
+
+Here is a summary of all your checks:
+
{% include "emails/summary-html.html" %}
{% if show_upgrade_note %}
-P.S.
+P.S.
Find this service useful? Support it by upgrading to
a premium account!
-
+
{% endif %}
-Thanks,
The Healthchecks.io Team
+Thanks,
+The {% escaped_site_name %} Team
{% endblock %}
diff --git a/templates/emails/base.html b/templates/emails/base.html
index e6d68341..bf3ac81b 100644
--- a/templates/emails/base.html
+++ b/templates/emails/base.html
@@ -1,222 +1,208 @@
-{% load hc_extras %}
-
-
+{% load humanize hc_extras %}
+
-
-
- {% block title %}{% endblock %}
-
+
+ /* ANDROID CENTER FIX */
+ div[style*="margin: 16px 0;"] { margin: 0 !important; }
+
-
-
+
+
-
-
-
-
-
-
+ |
+
+
+
+
+
+
+
+ |
+
+
+
- |
-
-
+
+ |
+
+
+
+
+
-
- {% block content %}{% endblock %}
- |
+
+
+
+
+
+
+
+
+ {% block content %}{% endblock %}
+ |
+
+
+ |
+
+ {% if button_text %}
+
+
+
+ |
+
+ {% endif %}
+
+
+
+
+
+ {% block content_more %}{% endblock %}
+ |
+
+
+ |
+
+
+ |
-
+ |
+
+ |
+
+
+
+
+
+
-
- © 2017 healthchecks.io. All rights reserved.
- {% block unsub %}{% endblock %}
-
- |
+
+ © 2017 {% escaped_site_name %}. All rights reserved.
+ {% block unsub %}{% endblock %}
+ |
-
+ |
+
+
-
+
-
+
\ No newline at end of file
diff --git a/templates/emails/login-body-html.html b/templates/emails/login-body-html.html
index fba5a08f..d40d76e1 100644
--- a/templates/emails/login-body-html.html
+++ b/templates/emails/login-body-html.html
@@ -2,50 +2,32 @@
{% load hc_extras %}
{% block content %}
-Hello,
+Hello,
+
{% if inviting_profile %}
- {{ inviting_profile }} invites you to their
- {% site_name %} account.
+ {{ inviting_profile }} invites you to their
+ {% escaped_site_name %} account.
+
- You will be able to manage their
+ You will be able to manage their
existing monitoring checks and set up new ones. If you already have your
- own account on healthchecks.io, you will be able to switch
- between the two
- accounts.
+ own account on {% site_name %}, you will be able to switch
+ between the two accounts.
+
{% endif %}
-To log into {% site_name %}, please press the button below:
+To log into {% escaped_site_name %},
+please press the button below:
+{% endblock %}
+
+
+{% block content_more %}
+Thanks,
+The {% escaped_site_name %} Team
+
-
-
-Thanks,
The Healthchecks.io Team
-
- P.S. Need help getting started? Check out our
- help documentation.
- Or, just reply to this email with any questions or issues you have.
-
-
-
-
-
- If you’re having trouble clicking the log in button, copy and paste the URL below into your web browser.
-
- {{ login_link }}
- |
-
-
+P.S. Need help getting started? Check out our
+help documentation.
+Or, just reply to this email with any questions or issues you have.
{% endblock %}
diff --git a/templates/emails/login-body-text.html b/templates/emails/login-body-text.html
index 24dc49cd..d439abbe 100644
--- a/templates/emails/login-body-text.html
+++ b/templates/emails/login-body-text.html
@@ -8,7 +8,7 @@ ones. If you already have your own account on {% site_name %}, you will
be able to switch between the two accounts.{% endif %}
To log into {% site_name %}, please open the link below:
-{{ login_link }}
+{{ button_url }}
Thanks,
The {% site_name %} Team
diff --git a/templates/emails/report-body-html.html b/templates/emails/report-body-html.html
index f7bc118d..7e10c1ce 100644
--- a/templates/emails/report-body-html.html
+++ b/templates/emails/report-body-html.html
@@ -2,22 +2,26 @@
{% load humanize hc_extras %}
{% block content %}
+Hello,
+This is a monthly report sent by {% site_name %}.
-Hello,
-This is a monthly report sent by {% site_name %}.
-
+
{% include "emails/summary-html.html" %}
-Just one more thing to check:
+Just one more thing to check:
Do you have more cron jobs,
not yet on this list, that would benefit from monitoring?
-Get the ball rolling by adding one more!
+Get the ball rolling by adding one more!
+
-Cheers,
The Healthchecks.io Team
+Cheers,
+The {% escaped_site_name %} Team
{% endblock %}
{% block unsub %}
-
-Unsubscribe from future monthly reports
+
+
+ Unsubscribe from Monthly Reports
+
{% endblock %}
diff --git a/templates/emails/set-password-body-html.html b/templates/emails/set-password-body-html.html
index ef754add..df5aabfb 100644
--- a/templates/emails/set-password-body-html.html
+++ b/templates/emails/set-password-body-html.html
@@ -1,11 +1,13 @@
+{% extends "emails/base.html" %}
{% load hc_extras %}
-Hello,
-Here's a link to set a password for your account on {% site_name %}:
-{{ set_password_link }}
+{% block content %}
+Hello,
+To set up a password for your account on {% site_name %}, please press the
+button below:
+{% endblock %}
-
- --
- Regards,
- {% site_name %}
-
+{% block content_more %}
+Regards,
+The {% escaped_site_name %} Team
+{% endblock %}
diff --git a/templates/emails/set-password-body-text.html b/templates/emails/set-password-body-text.html
index fc7ea72b..c5fc3d06 100644
--- a/templates/emails/set-password-body-text.html
+++ b/templates/emails/set-password-body-text.html
@@ -3,7 +3,7 @@ Hello,
Here's a link to set a password for your account on {% site_name %}:
-{{ set_password_link }}
+{{ button_url }}
--
diff --git a/templates/emails/summary-html.html b/templates/emails/summary-html.html
index 9bccf6f8..ac24ed2e 100644
--- a/templates/emails/summary-html.html
+++ b/templates/emails/summary-html.html
@@ -1,73 +1,31 @@
{% load humanize hc_extras %}
-
-
-
-
+
+
- |
- Name |
- Last Ping |
+ |
+ Name |
+ Last Ping |
{% for check in checks %}
-
- {% if check.get_status == "new" %}
- NEW
- {% elif check.get_status == "paused" %}
- PAUSED
- {% elif check.in_grace_period %}
- LATE
- {% elif check.get_status == "up" %}
- UP
- {% elif check.get_status == "down" %}
- DOWN
- {% endif %}
+ |
+
+
+ {% if check.get_status == "new" %}
+ NEW |
+ {% elif check.get_status == "paused" %}
+ PAUSED |
+ {% elif check.in_grace_period %}
+ LATE |
+ {% elif check.get_status == "up" %}
+ UP |
+ {% elif check.get_status == "down" %}
+ DOWN |
+ {% endif %}
+
+
|
-
+ |
{% if check.name %}
{% if check.name|length > 20 %}
{{ check.name }}
@@ -75,26 +33,37 @@
{{ check.name }}
{% endif %}
{% else %}
- unnamed
+ unnamed
{% endif %}
{% if check.tags %}
- {% for tag in check.tags_list %}
- {{ tag }}
- {% endfor %}
+
+
+ {% for tag in check.tags_list %}
+
+
+ |
+ {% endfor %}
+
+
{% endif %}
|
-
+ |
{% if check.last_ping %}
{{ check.last_ping|naturaltime }}
+
+ Show Log…
{% else %}
Never
{% endif %}
-
- |
-
- Log
|
{% endfor %}
-
\ No newline at end of file
+
+
\ No newline at end of file