From de072f8d2474474bd7e524e6f20eeda6ad98b249 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Wed, 18 Oct 2017 16:59:16 -0400 Subject: [PATCH] Update upgrade_reminder template for multi-course --- openedx/core/djangoapps/schedules/tasks.py | 10 ++- .../edx_ace/upgradereminder/email/body.html | 83 +++++++++++++------ .../edx_ace/upgradereminder/email/body.txt | 19 ++++- .../upgradereminder/email/from_name.txt | 6 +- .../edx_ace/upgradereminder/email/subject.txt | 6 +- 5 files changed, 93 insertions(+), 31 deletions(-) diff --git a/openedx/core/djangoapps/schedules/tasks.py b/openedx/core/djangoapps/schedules/tasks.py index 1a26ad14c7..d878a3454d 100644 --- a/openedx/core/djangoapps/schedules/tasks.py +++ b/openedx/core/djangoapps/schedules/tasks.py @@ -232,8 +232,14 @@ def _upgrade_reminder_schedules_for_bin(site, current_datetime, target_datetime, 'student_name': user.profile.name, 'user_personal_address': user.profile.name if user.profile.name else user.username, - 'course_name': first_schedule.enrollment.course.display_name, - 'course_url': absolute_url(site, reverse('course_root', args=[str(first_schedule.enrollment.course_id)])), + 'course_links': [ + { + 'url': absolute_url(site, reverse('course_root', args=[str(s.enrollment.course_id)])), + 'name': s.enrollment.course.display_name + } for s in user_schedules + ], + + 'first_course_name': first_schedule.enrollment.course.display_name, # This is used by the bulk email optout policy 'course_ids': course_id_strs, diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html index 5c21e314e8..32d1762709 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/body.html @@ -3,11 +3,22 @@ {% load static %} {% block preview_text %} - {% blocktrans trimmed %} - We hope you are enjoying learning with us so far in {{ course_name }}! A verified certificate - will allow you to highlight your new knowledge and skills. It's official, and easily shareable. + {% if course_ids|length > 1 %} + {% blocktrans trimmed %} + We hope you are enjoying learning with us so far on {{ platform_name }}! A verified certificate + will allow you to highlight your new knowledge and skills. It's official, and easily shareable. - Upgrade by {{ user_schedule_upgrade_deadline_time }}. + Upgrade by {{ user_schedule_upgrade_deadline_time }}. + {% endblocktrans %} + {% else %} + {% blocktrans trimmed %} + We hope you are enjoying learning with us so far in {{ first_course_name }}! A verified certificate + will allow you to highlight your new knowledge and skills. It's official, and easily shareable. + + Upgrade by {{ user_schedule_upgrade_deadline_time }}. + {% endblocktrans %} + {% endif %} + {% blocktrans trimmed %} {% endblocktrans %} {% endblock %} @@ -18,11 +29,19 @@

{% trans "Upgrade now" %}

- {% blocktrans trimmed %} - We hope you are enjoying learning with us so far in {{ course_name }}! A - verified certificate will allow you to highlight your new knowledge and skills. It's official, - and easily shareable. - {% endblocktrans %} + {% if course_ids|length > 1 %} + {% blocktrans trimmed %} + We hope you are enjoying learning with us so far on {{ platform_name }}! A + verified certificate will allow you to highlight your new knowledge and skills. It's official, + and easily shareable. + {% endblocktrans %} + {% else %} + {% blocktrans trimmed %} + We hope you are enjoying learning with us so far in {{ first_course_name }}! A + verified certificate will allow you to highlight your new knowledge and skills. It's official, + and easily shareable. + {% endblocktrans %} + {% endif %}

{% blocktrans trimmed %} @@ -30,27 +49,39 @@ {% endblocktrans %}

- - {% trans 'Example print-out of a verified certificate' %} - + {% if course_ids|length > 1 and course_ids|length < 10 %} + + {% endif %} + + {% trans 'Example print-out of a verified certificate' %}

{# email client support for style sheets is pretty spotty, so we have to inline all of these styles #} +{% else %} +{% blocktrans trimmed %} +We hope you are enjoying learning with us so far in {{ first_course_name }}! A verified certificate will allow you to highlight your new knowledge and skills. It's official, and easily shareable. Upgrade by {{ user_schedule_upgrade_deadline_time }}. {% endblocktrans %} {% trans "Upgrade now at" %} <{{ upsell_link }}> +{% endif %} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/from_name.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/from_name.txt index 08e86bddd0..9a58dc516b 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/from_name.txt +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/from_name.txt @@ -1 +1,5 @@ -{{ course_name }} +{% if course_ids|length > 1 %} +{{ platform_name }} +{% else %} +{{ first_course_name }} +{% endif %} diff --git a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/subject.txt b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/subject.txt index 7daea3543a..585253a0d1 100644 --- a/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/subject.txt +++ b/openedx/core/djangoapps/schedules/templates/schedules/edx_ace/upgradereminder/email/subject.txt @@ -1,3 +1,7 @@ {% load i18n %} -{% blocktrans %}Upgrade to earn a verified certificate in {{ course_name }}{% endblocktrans %} +{% if course_ids|length > 1 %} +{% blocktrans %}Upgrade to earn a verified certificate on {{ platform_name }}{% endblocktrans %} +{% else %} +{% blocktrans %}Upgrade to earn a verified certificate in {{ first_course_name }}{% endblocktrans %} +{% endif %}