Skip to content

Commit

Permalink
Simplify templated e-mails folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mad-anne committed Feb 6, 2018
1 parent 1d652a0 commit 6f268e6
Show file tree
Hide file tree
Showing 22 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ dist/
/static/
/saleor/static/assets/
webpack-bundle.json
/templates/templated_email/html/compiled/
/templates/templated_email/compiled/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@
"build-assets": "node ./node_modules/webpack/bin/webpack.js -p --progress",
"heroku-postbuild": "npm run build-assets",
"start": "UV_THREADPOOL_SIZE=8 node ./node_modules/webpack/bin/webpack.js -d --watch --progress",
"build-emails": "mkdir -p templates/templated_email/html/compiled/ && find templates -name \"*.mjml\" -not -path \"templates/templated_email/html/source/*partials/*\" -not -path \"templates/templated_email/html/source/*shared/*\" -exec ./node_modules/.bin/mjml -l skip {} -o templates/templated_email/html/compiled/ \\;"
"build-emails": "mkdir -p templates/templated_email/compiled/ && find templates -name \"*.mjml\" -not -path \"templates/templated_email/source/*partials/*\" -not -path \"templates/templated_email/source/*shared/*\" -exec ./node_modules/.bin/mjml -l skip {} -o templates/templated_email/compiled/ \\;"
}
}
4 changes: 2 additions & 2 deletions saleor/dashboard/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def send_set_password_email(staff):
'uid': urlsafe_base64_encode(force_bytes(staff.pk)).decode(),
'token': default_token_generator.make_token(staff)}
send_templated_mail(
template_name='dashboard/staff/set_password',
template_name='source/dashboard/staff/set_password',
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[staff.email],
context=ctx)
Expand All @@ -35,7 +35,7 @@ def send_promote_customer_to_staff_email(staff):
'url': build_absolute_uri(reverse('dashboard:index')),
'site_name': site.name}
send_templated_mail(
template_name='dashboard/staff/promote_customer',
template_name='source/dashboard/staff/promote_customer',
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[staff.email],
context=ctx)
6 changes: 3 additions & 3 deletions saleor/order/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from django.contrib.sites.models import Site
from templated_email import send_templated_mail

CONFIRM_ORDER_TEMPLATE = 'order/confirm_order'
CONFIRM_PAYMENT_TEMPLATE = 'order/payment/confirm_payment'
CONFIRM_NOTE_TEMPLATE = 'order/note/confirm_note'
CONFIRM_ORDER_TEMPLATE = 'source/order/confirm_order'
CONFIRM_PAYMENT_TEMPLATE = 'source/order/payment/confirm_payment'
CONFIRM_NOTE_TEMPLATE = 'source/order/note/confirm_note'


def _send_confirmation(email, url, template, context=None):
Expand Down
2 changes: 1 addition & 1 deletion saleor/registration/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def send_password_reset_email(context, recipient):
kwargs={'uidb64': context['uid'], 'token': context['token']}))
context['reset_url'] = reset_url
send_templated_mail(
template_name='account/password_reset',
template_name='source/account/password_reset',
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=[recipient],
context=context)
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ Sincerely,
{% endblock %}

{% block html %}
{% include 'templated_email/html/compiled/password_reset.html' %}
{% include 'templated_email/compiled/password_reset.html' %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ This is an automatically generated email, please do not reply.
{% endblock %}

{% block html %}
{% include 'templated_email/html/compiled/promote_customer.html' %}
{% include 'templated_email/compiled/promote_customer.html' %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ This is an automatically generated email, please do not reply.
{% endblock %}

{% block html %}
{% include 'templated_email/html/compiled/set_password.html' %}
{% include 'templated_email/compiled/set_password.html' %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ Sincerely,
{% endblock %}

{% block html %}
{% include 'templated_email/html/compiled/confirm_order.html' %}
{% include 'templated_email/compiled/confirm_order.html' %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Sincerely,
{% endblock %}

{% block html %}
{% include 'templated_email/html/compiled/confirm_note.html' %}
{% include 'templated_email/compiled/confirm_note.html' %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Sincerely,
{% endblock %}

{% block html %}
{% include 'templated_email/html/compiled/confirm_payment.html' %}
{% include 'templated_email/compiled/confirm_payment.html' %}
{% endblock %}
2 changes: 1 addition & 1 deletion tests/dashboard/test_staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_send_set_password_email(staff_user):
'uid': urlsafe_base64_encode(force_bytes(staff_user.pk)).decode(),
'token': default_token_generator.make_token(staff_user)}
send_templated_mail(
template_name='dashboard/staff/set_password',
template_name='source/dashboard/staff/set_password',
from_email=DEFAULT_FROM_EMAIL,
recipient_list=[staff_user.email],
context=ctx)
Expand Down

0 comments on commit 6f268e6

Please sign in to comment.