diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index 6f25e4351..89ff7d1c8 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -61,6 +61,23 @@ ] ) +# Django templates (edx-ace emails) and compiled gettext catalogs must not go through Tutor's +# Jinja pass: locally Jinja would choke on {% blocktrans %} / {% include %}, and production +# builds clone this repo raw (PICASSO_THEME_DIRS) where Jinja never runs, so {% raw %} wrappers +# would reach Django verbatim. Copy them byte-for-byte in both worlds. +FX_VERBATIM_TEMPLATE_PREFIXES = ( + "indigo/lms/templates/ace_common/", + "indigo/lms/templates/instructor/edx_ace/", + "indigo/lms/templates/bulk_email/", +) + + +@hooks.Filters.IS_FILE_RENDERED.add() +def _do_not_render_django_email_templates(rendered: bool, path: str) -> bool: + if path.startswith(FX_VERBATIM_TEMPLATE_PREFIXES) or path.endswith(".mo"): + return False + return rendered + # init script: set theme automatically with open( diff --git a/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.mo b/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.mo index 5571b8db5..4b55e781d 100644 Binary files a/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.mo and b/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.mo differ diff --git a/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.po b/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.po index 19143c2a8..fa6406b3e 100644 --- a/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.po +++ b/tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.po @@ -683,3 +683,25 @@ msgstr "" #: lms/templates/learner_dashboard/program_card.underscore:68 msgid "Subscribed" msgstr "" + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html lms/templates/bulk_email/edx_ace/bulkemail/email/body.html +#, python-format +msgid "Hello %(name)s," +msgstr "مرحبًا %(name)s،" + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html lms/templates/instructor/edx_ace/allowedenroll/email/body.html lms/templates/bulk_email/edx_ace/bulkemail/email/body.html +msgid "Hello," +msgstr "مرحبًا،" + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html +msgid "You have been enrolled in" +msgstr "لقد تم تسجيلك في" + +#: lms/templates/instructor/edx_ace/allowedenroll/email/body.html +msgid "You have been invited to" +msgstr "لقد تمت دعوتك إلى" + +#: lms/templates/ace_common/edx_ace/common/fx_base_body.html +#, python-format +msgid "All rights reserved to %(platform_name)s © %(year)s" +msgstr "جميع الحقوق محفوظة لـ%(platform_name)s © %(year)s" diff --git a/tutorindigo/templates/indigo/conf/locale/en/LC_MESSAGES/django.po b/tutorindigo/templates/indigo/conf/locale/en/LC_MESSAGES/django.po index 593aae3bd..e98b34713 100644 --- a/tutorindigo/templates/indigo/conf/locale/en/LC_MESSAGES/django.po +++ b/tutorindigo/templates/indigo/conf/locale/en/LC_MESSAGES/django.po @@ -683,3 +683,25 @@ msgstr "" #: lms/templates/learner_dashboard/program_card.underscore:68 msgid "Subscribed" msgstr "" + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html lms/templates/bulk_email/edx_ace/bulkemail/email/body.html +#, python-format +msgid "Hello %(name)s," +msgstr "" + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html lms/templates/instructor/edx_ace/allowedenroll/email/body.html lms/templates/bulk_email/edx_ace/bulkemail/email/body.html +msgid "Hello," +msgstr "" + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html +msgid "You have been enrolled in" +msgstr "" + +#: lms/templates/instructor/edx_ace/allowedenroll/email/body.html +msgid "You have been invited to" +msgstr "" + +#: lms/templates/ace_common/edx_ace/common/fx_base_body.html +#, python-format +msgid "All rights reserved to %(platform_name)s © %(year)s" +msgstr "" diff --git a/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.mo b/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.mo index 1cabded4b..623051bb7 100644 Binary files a/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.mo and b/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.mo differ diff --git a/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.po b/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.po index db6f0c7e9..408111cd8 100644 --- a/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.po +++ b/tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.po @@ -683,3 +683,25 @@ msgstr "" #: lms/templates/learner_dashboard/program_card.underscore:68 msgid "Subscribed" msgstr "" + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html lms/templates/bulk_email/edx_ace/bulkemail/email/body.html +#, python-format +msgid "Hello %(name)s," +msgstr "Bonjour %(name)s," + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html lms/templates/instructor/edx_ace/allowedenroll/email/body.html lms/templates/bulk_email/edx_ace/bulkemail/email/body.html +msgid "Hello," +msgstr "Bonjour," + +#: lms/templates/instructor/edx_ace/enrollenrolled/email/body.html +msgid "You have been enrolled in" +msgstr "Vous avez été inscrit(e) à" + +#: lms/templates/instructor/edx_ace/allowedenroll/email/body.html +msgid "You have been invited to" +msgstr "Vous avez été invité(e) à" + +#: lms/templates/ace_common/edx_ace/common/fx_base_body.html +#, python-format +msgid "All rights reserved to %(platform_name)s © %(year)s" +msgstr "Tous droits réservés à %(platform_name)s © %(year)s" diff --git a/tutorindigo/templates/indigo/lms/templates/ace_common/edx_ace/common/fx_base_body.html b/tutorindigo/templates/indigo/lms/templates/ace_common/edx_ace/common/fx_base_body.html new file mode 100644 index 000000000..4b03ab9bb --- /dev/null +++ b/tutorindigo/templates/indigo/lms/templates/ace_common/edx_ace/common/fx_base_body.html @@ -0,0 +1,133 @@ +{% load i18n %} +{% load ace %} +{% load ednx %} +{% get_current_language as LANGUAGE_CODE %} +{% get_current_language_bidi as LANGUAGE_BIDI %} +{% tenant_get_value "logo_image_url" as fx_logo_image_url %} +{% tenant_get_value "PLATFORM_NAME" as fx_platform_name %} +{% get_lms_root_url as fx_lms_root %} +{% comment %} +Tenant logo = the theme-editor logo (lms_configs.logo_image_url, what the site header shows), else the +platform logo. It is used only when absolute http(s) and not SVG (Gmail/Outlook do not render SVG). A +root-relative value is what the browser resolves against the tenant host; emails need it absolute, so +the tenant root is prefixed first. Tenant name = lms_configs.PLATFORM_NAME, the same key the stock +emails use, falling back to the context's platform_name. +{% endcomment %} +{% if fx_logo_image_url|slice:":1" == "/" %}{% firstof fx_lms_root|add:fx_logo_image_url as fx_logo_abs %}{% else %}{% firstof fx_logo_image_url as fx_logo_abs %}{% endif %} +{% if fx_logo_abs|slice:":4" == "http" and fx_logo_abs|lower|slice:"-4:" != ".svg" %}{% firstof fx_logo_abs as fx_tenant_logo %}{% else %}{% firstof "" as fx_tenant_logo %}{% endif %} +{% now "Y" as fx_year %} + +{# Inbox preview text: visible in the message list of most clients, hidden in the body. #} +
+ {% block preview_text %}{% endblock %} +
+ +{% for image_src in channel.tracker_image_sources %} + +{% endfor %} + +{% google_analytics_tracking_pixel %} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +{# Debug info that is not user-visible #} + + + diff --git a/tutorindigo/templates/indigo/lms/templates/ace_common/edx_ace/common/fx_cta.html b/tutorindigo/templates/indigo/lms/templates/ace_common/edx_ace/common/fx_cta.html new file mode 100644 index 000000000..b69b61bbb --- /dev/null +++ b/tutorindigo/templates/indigo/lms/templates/ace_common/edx_ace/common/fx_cta.html @@ -0,0 +1,12 @@ +{% load ace %} +{# Filled call-to-action button. Usage: {% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=text fx_cta_url=url %} #} + + + + +
+ + {{ fx_cta_text }} + +
diff --git a/tutorindigo/templates/indigo/lms/templates/bulk_email/edx_ace/bulkemail/email/body.html b/tutorindigo/templates/indigo/lms/templates/bulk_email/edx_ace/bulkemail/email/body.html new file mode 100644 index 000000000..dc0ca511e --- /dev/null +++ b/tutorindigo/templates/indigo/lms/templates/bulk_email/edx_ace/bulkemail/email/body.html @@ -0,0 +1,48 @@ +{% extends "ace_common/edx_ace/common/fx_base_body.html" %} + +{% load i18n %} +{% load ace %} + +{% block preview_text %}{{ course_email.subject }}{% endblock %} + +{% block greeting %} + {% if name %}{% blocktrans %}Hello {{ name }},{% endblocktrans %}{% else %}{% trans "Hello," %}{% endif %} +{% endblock %} + +{% block title %}{{ course_email.subject }}{% endblock %} + +{% block highlight %} + {{ course_title }} +{% endblock %} + +{% block content %} + {% autoescape off %} + {{ formatted_html_message }} + {% endautoescape %} +{% endblock %} + +{% block cta %} + {% trans "Go to course" as cta_text %} + {% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=cta_text fx_cta_url=course_url %} +{% endblock %} + +{% block small_print %} + {% filter force_escape %} + {% blocktrans %} + This email was automatically sent from {{ platform_name }}. + {% endblocktrans %} + {% endfilter %} +
+ {% filter force_escape %} + {% blocktrans %} + You are receiving this email at address {{ email }} because you are enrolled in + {% endblocktrans %} + {% endfilter %} {{ course_title }}. +
+ {% filter force_escape %} + {% blocktrans %} + To stop receiving email like this, update your course email settings + {% endblocktrans %} + {% endfilter %} {% trans "here" as transhere %}{{transhere|force_escape}}. +
{% trans "unsubscribe" as transunsub %}{{transunsub|force_escape}} +{% endblock %} diff --git a/tutorindigo/templates/indigo/lms/templates/instructor/edx_ace/allowedenroll/email/body.html b/tutorindigo/templates/indigo/lms/templates/instructor/edx_ace/allowedenroll/email/body.html new file mode 100644 index 000000000..31d0eca1f --- /dev/null +++ b/tutorindigo/templates/indigo/lms/templates/instructor/edx_ace/allowedenroll/email/body.html @@ -0,0 +1,57 @@ +{% extends "ace_common/edx_ace/common/fx_base_body.html" %} + +{% load i18n %} +{% load ace %} + +{% block preview_text %}{% blocktrans %}You have been invited to register for {{ course_name }}{% endblocktrans %}{% endblock %} + +{% block greeting %}{% trans "Hello," %}{% endblock %} + +{% block title %}{% trans "You have been invited to" %}{% endblock %} + +{% block highlight %}{{ course_name }}{% endblock %} + +{% block content %} +

+ {% blocktrans %}You have been invited to join {{ course_name }} at {{ site_name }} by a member of the course staff.{% endblocktrans %} +

+ {% if is_shib_course %} + {% if auto_enroll %} +

{% blocktrans %}To access this course click on the button below and login:{% endblocktrans %}

+ {% elif course_about_url is not None %} +

{% blocktrans %}To access this course visit it and register:{% endblocktrans %}

+ {% endif %} + {% else %} +

{% blocktrans %}Please finish your registration and fill out the registration form making sure to use {{ email_address }} in the Email field:{% endblocktrans %}

+ {% endif %} +{% endblock %} + +{% block cta %} + {% if is_shib_course %} + {% if auto_enroll %} + {% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=course_name fx_cta_url=course_url %} + {% elif course_about_url is not None %} + {% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=course_name fx_cta_url=course_about_url %} + {% endif %} + {% else %} + {% trans "Finish Your Registration" as button_cta_text %} + {% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=button_cta_text fx_cta_url=registration_url %} + {% endif %} +{% endblock %} + +{% block after_cta %} + {% if not is_shib_course %} + {% if auto_enroll %} +

{% blocktrans %}Once you have registered and activated your account, you will see {{ course_name }} listed on your dashboard.{% endblocktrans %}

+ {% elif course_about_url is not None %} +

{% blocktrans %}Once you have registered and activated your account, you will be able to access this course:{% endblocktrans %}

+ {% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=course_name fx_cta_url=course_about_url %} + {% else %} +

{% blocktrans %}You can then enroll in {{ course_name }}.{% endblocktrans %}

+ {% endif %} + {% endif %} +{% endblock %} + +{% block small_print %} + {% blocktrans %}This email was automatically sent from {{ site_name }} to {{ email_address }}{% endblocktrans %} +{% endblock %} diff --git a/tutorindigo/templates/indigo/lms/templates/instructor/edx_ace/enrollenrolled/email/body.html b/tutorindigo/templates/indigo/lms/templates/instructor/edx_ace/enrollenrolled/email/body.html new file mode 100644 index 000000000..d194f556d --- /dev/null +++ b/tutorindigo/templates/indigo/lms/templates/instructor/edx_ace/enrollenrolled/email/body.html @@ -0,0 +1,31 @@ +{% extends "ace_common/edx_ace/common/fx_base_body.html" %} + +{% load i18n %} +{% load ace %} + +{% block preview_text %}{% blocktrans %}You have been enrolled in {{ course_name }}{% endblocktrans %}{% endblock %} + +{% block greeting %} + {% if full_name %}{% blocktrans with name=full_name %}Hello {{ name }},{% endblocktrans %}{% else %}{% trans "Hello," %}{% endif %} +{% endblock %} + +{% block title %}{% trans "You have been enrolled in" %}{% endblock %} + +{% block highlight %} + {{ course_name }} +{% endblock %} + +{% block content %} +

+ {% blocktrans %}You have been enrolled in {{ course_name }} at {{ site_name }} by a member of the course staff. This course will now appear on your {{ site_name }} dashboard.{% endblocktrans %} +

+{% endblock %} + +{% block cta %} + {% trans "Access the Course Materials Now" as cta_text %} + {% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=cta_text fx_cta_url=course_url %} +{% endblock %} + +{% block small_print %} + {% blocktrans %}This email was automatically sent from {{ site_name }} to {{ full_name }}{% endblocktrans %} +{% endblock %}