Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tutorindigo/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Binary file modified tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.mo
Binary file not shown.
22 changes: 22 additions & 0 deletions tutorindigo/templates/indigo/conf/locale/ar/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
22 changes: 22 additions & 0 deletions tutorindigo/templates/indigo/conf/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Binary file modified tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
22 changes: 22 additions & 0 deletions tutorindigo/templates/indigo/conf/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
@@ -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. #}
<div lang="{{ LANGUAGE_CODE|default:"en" }}" style="display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;visibility:hidden;">
{% block preview_text %}{% endblock %}
</div>

{% for image_src in channel.tracker_image_sources %}
<img src="{{ image_src }}" alt="" role="presentation" aria-hidden="true" />
{% endfor %}

{% google_analytics_tracking_pixel %}

<div bgcolor="#f3f4f6" lang="{{ LANGUAGE_CODE|default:"en" }}" dir="{{ LANGUAGE_BIDI|yesno:"rtl,ltr" }}" style="margin:0;padding:24px 12px;min-width:100%;background-color:#f3f4f6;">
<!--[if mso]>
<style type="text/css">
body, table, td {font-family: Arial, Helvetica, sans-serif !important;}
</style>
<![endif]-->

<!--[if (gte mso 9)|(IE)]>
<table role="presentation" width="600" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<![endif]-->

<!-- CARD -->
<table class="content" role="presentation" align="center" width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff"
style="max-width:600px;margin:0 auto;background-color:#ffffff;border:1px solid #e5e7eb;border-radius:12px;font-family:'IBM Plex Sans Arabic','Segoe UI',Tahoma,Arial,Helvetica,sans-serif;">

<!-- LOGO -->
<tr>
<td align="center" style="padding:36px 32px 8px 32px;">
{% if fx_tenant_logo %}
<img src="{{ fx_tenant_logo }}" alt="{% firstof fx_platform_name platform_name %}" height="56" style="display:block;margin:0 auto;max-height:56px;max-width:220px;width:auto;height:auto;border:0;" />
{% elif logo_url %}
<img src="{{ logo_url }}" alt="{% firstof fx_platform_name platform_name %}" height="56" style="display:block;margin:0 auto;max-height:56px;max-width:220px;width:auto;height:auto;border:0;" />
{% endif %}
</td>
</tr>

<!-- GREETING -->
<tr>
<td style="padding:16px 32px 0 32px;text-align:center;font-size:16px;line-height:24px;color:#4b5563;">
{% block greeting %}{% endblock %}
</td>
</tr>

<!-- TITLE -->
<tr>
<td style="padding:12px 32px 0 32px;text-align:center;font-size:24px;line-height:32px;font-weight:700;color:#111827;">
{% block title %}{% endblock %}
</td>
</tr>

<!-- HIGHLIGHT (course / program name) -->
<tr>
<td style="padding:8px 32px 0 32px;text-align:center;font-size:18px;line-height:28px;font-weight:600;color:#1B8354;">
{% block highlight %}{% endblock %}
</td>
</tr>

<!-- CONTENT -->
<tr>
<td style="padding:16px 32px 0 32px;text-align:center;font-size:15px;line-height:24px;color:#374151;">
{% block content %}{% endblock %}
</td>
</tr>

<!-- CTA -->
<tr>
<td align="center" style="padding:24px 32px 8px 32px;">
{% block cta %}{% endblock %}
</td>
</tr>

<!-- AFTER CTA (follow-up paragraphs, optional) -->
<tr>
<td style="padding:8px 32px 0 32px;text-align:center;font-size:15px;line-height:24px;color:#374151;">
{% block after_cta %}{% endblock %}
</td>
</tr>

<!-- SMALL PRINT -->
<tr>
<td style="padding:16px 32px 0 32px;text-align:center;font-size:12px;line-height:18px;color:#6b7280;">
{% block small_print %}{% endblock %}
</td>
</tr>

<!-- DIVIDER -->
<tr>
<td style="padding:24px 32px 0 32px;">
<div style="border-top:1px solid #e5e7eb;font-size:0;line-height:0;">&nbsp;</div>
</td>
</tr>

<!-- COPYRIGHT -->
<tr>
<td align="center" style="padding:16px 32px 32px 32px;text-align:center;font-size:12px;line-height:18px;color:#6b7280;">
{% blocktrans with platform_name=fx_platform_name|default:platform_name year=fx_year %}All rights reserved to {{ platform_name }} © {{ year }}{% endblocktrans %}
</td>
</tr>
</table>

<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</div>

{# Debug info that is not user-visible #}
<span id="ace-message-id" style="display:none;">{{ message.log_id }}</span>
<span id="template-revision" style="display:none;">{{ template_revision }}</span>
<span id="fx-email-frame" style="display:none;">indigo/fx_base_body</span>
Original file line number Diff line number Diff line change
@@ -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 %} #}
<table role="presentation" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" bgcolor="#1B8354" style="border-radius:8px;background-color:#1B8354;">
<a href="{% with_link_tracking fx_cta_url %}" target="_blank"
style="display:inline-block;padding:14px 36px;font-size:15px;line-height:20px;font-weight:700;color:#ffffff;text-decoration:none;border-radius:8px;">
<font color="#ffffff"><b>{{ fx_cta_text }}</b></font>
</a>
</td>
</tr>
</table>
Original file line number Diff line number Diff line change
@@ -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 %}
<a href="{{ course_url }}" style="color:inherit;text-decoration:none;">{{ course_title }}</a>
{% 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 %}
<br>
{% filter force_escape %}
{% blocktrans %}
You are receiving this email at address {{ email }} because you are enrolled in
{% endblocktrans %}
{% endfilter %} <a href='{{ course_url }}'>{{ course_title }}</a>.
<br>
{% filter force_escape %}
{% blocktrans %}
To stop receiving email like this, update your course email settings
{% endblocktrans %}
{% endfilter %} <a href='{{ email_settings_url }}'>{% trans "here" as transhere %}{{transhere|force_escape}}</a>.
<br><a href='{{ unsubscribe_link }}'>{% trans "unsubscribe" as transunsub %}{{transunsub|force_escape}}</a>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -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 %}
<p style="margin:0;">
{% blocktrans %}You have been invited to join {{ course_name }} at {{ site_name }} by a member of the course staff.{% endblocktrans %}
</p>
{% if is_shib_course %}
{% if auto_enroll %}
<p style="margin:16px 0 0 0;">{% blocktrans %}To access this course click on the button below and login:{% endblocktrans %}</p>
{% elif course_about_url is not None %}
<p style="margin:16px 0 0 0;">{% blocktrans %}To access this course visit it and register:{% endblocktrans %}</p>
{% endif %}
{% else %}
<p style="margin:16px 0 0 0;">{% blocktrans %}Please finish your registration and fill out the registration form making sure to use {{ email_address }} in the Email field:{% endblocktrans %}</p>
{% 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 %}
<p style="margin:0;">{% blocktrans %}Once you have registered and activated your account, you will see {{ course_name }} listed on your dashboard.{% endblocktrans %}</p>
{% elif course_about_url is not None %}
<p style="margin:0 0 16px 0;">{% blocktrans %}Once you have registered and activated your account, you will be able to access this course:{% endblocktrans %}</p>
{% include "ace_common/edx_ace/common/fx_cta.html" with fx_cta_text=course_name fx_cta_url=course_about_url %}
{% else %}
<p style="margin:0;">{% blocktrans %}You can then enroll in {{ course_name }}.{% endblocktrans %}</p>
{% endif %}
{% endif %}
{% endblock %}

{% block small_print %}
{% blocktrans %}This email was automatically sent from {{ site_name }} to {{ email_address }}{% endblocktrans %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -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 %}
<a href="{% with_link_tracking course_url %}" style="color:inherit;text-decoration:none;">{{ course_name }}</a>
{% endblock %}

{% block content %}
<p style="margin:0;">
{% 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 %}
</p>
{% 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 %}
Loading