Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add shared MJML footer and header

Anna Siwikf21c76c11890
diff --git a/saleor/order/emails.py b/saleor/order/emails.py
index 5cda2a9961..2ea6a99524 100644
--- a/saleor/order/emails.py
+++ b/saleor/order/emails.py
@@ -10,7 +10,11 @@ CONFIRM_NOTE_TEMPLATE = 'order/note/confirm_note'
def _send_confirmation(email, url, template, context=None):
site = Site.objects.get_current()
- ctx = {'site_name': site.name, 'url': url}
+ ctx = {
+ 'protocol': 'http',
+ 'site_name': site.name,
+ 'domain': site.domain,
+ 'url': url}
if context:
ctx.update(context)
send_templated_mail(
diff --git a/templates/templated_email/html/source/shared/footer.mjml b/templates/templated_email/html/source/shared/footer.mjml
new file mode 100644
index 0000000000..c11201c32a
--- /dev/null
+++ b/templates/templated_email/html/source/shared/footer.mjml
@@ -0,0 +1,18 @@
+<mj-section>
+ <mj-column>
+ <mj-text>
+ {% blocktrans context "Base e-mail text" %}
+ This is an automatically generated e-mail, please do not reply.
+ {% endblocktrans %}
+ </mj-text>
+ </mj-column>
+</mj-section>
+<mj-section background-color="#D3D1D0">
+ <mj-column>
+ <mj-text align="center">
+ {% blocktrans trimmed context "Base e-mail footer" %}
+ Sincerely, {{ site_name }}
+ {% endblocktrans %}
+ </mj-text>
+ </mj-column>
+</mj-section>
diff --git a/templates/templated_email/html/source/shared/header.mjml b/templates/templated_email/html/source/shared/header.mjml
new file mode 100644
index 0000000000..71646f11c5
--- /dev/null
+++ b/templates/templated_email/html/source/shared/header.mjml
@@ -0,0 +1,10 @@
+<mj-section css-class="no-display">
+ <mj-column>
+ <mj-text>{% load staticfiles %}</mj-text>
+ </mj-column>
+</mj-section>
+<mj-section background-color="#F2F2F2">
+ <mj-column>
+ <mj-image src="{{ protocol}}://{{ domain }}{% static 'images/logo.svg' %}" height="38px" width="176px"></mj-image>
+ </mj-column>
+</mj-section>
diff --git a/templates/templated_email/html/source/shared/styles.mjml b/templates/templated_email/html/source/shared/styles.mjml
new file mode 100644
index 0000000000..6e02be786b
--- /dev/null
+++ b/templates/templated_email/html/source/shared/styles.mjml
@@ -0,0 +1,5 @@
+<mj-style inline="inline">
+ .no-display {
+ display: none;
+ }
+</mj-style>