From 1dea7861d053ad699c51531dac446b81946c1eb0 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 2 Nov 2021 14:43:57 +1100 Subject: [PATCH] Refactor email body out into a template - Will be useful in the future when more email functionality is implemented --- InvenTree/templates/email/email.html | 43 +++++++++++++++ .../email/low_stock_notification.html | 52 ++++++++----------- 2 files changed, 66 insertions(+), 29 deletions(-) create mode 100644 InvenTree/templates/email/email.html diff --git a/InvenTree/templates/email/email.html b/InvenTree/templates/email/email.html new file mode 100644 index 0000000000..97e9a40f37 --- /dev/null +++ b/InvenTree/templates/email/email.html @@ -0,0 +1,43 @@ +{% load i18n %} +{% load static %} +{% load inventree_extras %} + + + + {% block header %} + + + + + {% endblock %} + + {% block body %} + + {% block body_row %} + + {% endblock %} + + {% endblock %} + + {% block footer %} + + + + {% endblock %} + +
+ {% block header_row %} +

{% block title %}{% endblock %}

+ {% block subtitle %} + + {% endblock %} + {% endblock %} +
+ {% block footer_prefix %} + + {% endblock %} +

{% trans "InvenTree version" %}: {% inventree_version %} - inventree.readthedocs.io

+ {% block footer_suffix %} + + {% endblock %} +
diff --git a/InvenTree/templates/email/low_stock_notification.html b/InvenTree/templates/email/low_stock_notification.html index 4fa4e55295..ecb350925a 100644 --- a/InvenTree/templates/email/low_stock_notification.html +++ b/InvenTree/templates/email/low_stock_notification.html @@ -1,35 +1,29 @@ +{% extends "email/email.html" %} + {% load i18n %} {% load inventree_extras %} - +{% block title %} +{% blocktrans with part=part.name %} The available stock for {{ part }} has fallen below the configured minimum level{% endblocktrans %} +{% if link %} +

{% trans "Click on the following link to view this part" %}: {{ link }}

+{% endif %} +{% endblock %} - - - +{% block subtitle %} +

{% blocktrans with part=part.name %}You are receiving this email because you are subscribed to notifications for this part {% endblocktrans %}.

+{% endblock %} - - - - - - - - - - - - - - - - -
-

{% blocktrans with part=part.name %} The available stock for {{ part }} has fallen below the configured minimum level{% endblocktrans %}

- {% if link %} -

{% trans "Click on the following link to view this part" %}: {{ link }}

- {% endif %} -
{% trans "Part Name" %}{% trans "Available Quantity" %}{% trans "Minimum Quantity" %}
{{ part.full_name }}{{ part.total_stock }}{{ part.minimum_stock }}
-

{% blocktrans with part=part.name %}You are receiving this email because you are subscribed to notifications for this part {% endblocktrans %}.

-

{% trans "InvenTree version" %}: {% inventree_version %}

-
+{% block body %} + + {% trans "Part Name" %} + {% trans "Available Quantity" %} + {% trans "Minimum Quantity" %} + + + {{ part.full_name }} + {{ part.total_stock }} + {{ part.minimum_stock }} + +{% endblock %}