{% extends 'oscar/dashboard/layout.html' %} {% load i18n %} {% block body_class %}{{ block.super }} create-page{% endblock %} {% block title %} {{ commtype.name }} | {{ block.super }} {% endblock %} {% block breadcrumbs %} {% endblock %} {% block header %} {% endblock header %} {% block dashboard_content %}
{% if preview %} {% else %}

{% trans "Edit email" %}

{% endif %}
{% csrf_token %} {% include 'oscar/dashboard/partials/form_field.html' with field=form.name %}

{% trans "Email content" %}

{% trans "These fields are rendered using Django's template system." %}

{% trans "You can use the following variables:" %}

{% templatetag openvariable %} user.get_full_name {% templatetag closevariable %}
{% trans "The full name of the user (if they have one)" %}
{% templatetag openvariable %} user.email {% templatetag closevariable %}
{% trans "The user's email address" %}
{% templatetag openvariable %} site.name {% templatetag closevariable %}
{% trans "The name of the site (eg example.com)" %}
{% if commtype.is_order_related %}
{% templatetag openvariable %} order.number {% templatetag closevariable %}
{% trans "Order number" %}
{% endif %}
{% include 'oscar/dashboard/partials/form_field.html' with field=form.email_subject_template %} {% include 'oscar/dashboard/partials/form_field.html' with field=form.email_body_template %} {% include 'oscar/dashboard/partials/form_field.html' with field=form.email_body_html_template %}

{% trans "Preview" %}

{% if commtype.is_order_related %}

{% trans "View a preview of this email using order:" %}

{% include 'oscar/dashboard/partials/form_field.html' with field=form.preview_order_number %} {% endif %}

{% trans "or send a preview to:" %}

{% include 'oscar/dashboard/partials/form_field.html' with field=form.preview_email %}
{% trans "Subject" %} {{ preview.subject }}
{% trans "Body text" %}
{{ preview.body }}
{% trans "Body HTML" %}
{% trans "or" %} {% trans "cancel" %}.
{% endblock dashboard_content %} {% block onbodyload %} {{ block.super }} $(function() { // Sets the HTML email preview so it's css doesn't touch the page. var el_preview_html = document.getElementById('preview_box'); var html = $(el_preview_html).text(); var doc = el_preview_html.contentWindow.document; doc.open(); doc.write(html); doc.close(); }); {% endblock %}