Commit ccf8d137 by Gabe Mulley Committed by GitHub

Merge pull request #15941 from edx/ret/update-nudge-templates

update recurring nudge templates
parents 28fd39f7 8a8c9747
......@@ -33,6 +33,7 @@ import imp
import sys
import os
import dealer.git
from path import Path as path
from warnings import simplefilter
from django.utils.translation import ugettext_lazy as _
......@@ -3297,3 +3298,12 @@ ACE_CHANNEL_SAILTHRU_API_KEY = None
ACE_CHANNEL_SAILTHRU_API_SECRET = None
ACE_ROUTING_KEY = LOW_PRIORITY_QUEUE
EDX_PLATFORM_REVISION = os.environ.get('EDX_PLATFORM_REVISION')
if not EDX_PLATFORM_REVISION:
try:
# Get git revision of the current file
EDX_PLATFORM_REVISION = dealer.git.Backend(path=REPO_ROOT).revision
except TypeError:
# Not a git repository
EDX_PLATFORM_REVISION = 'unknown'
import datetime
from subprocess import check_output, CalledProcessError
from urlparse import urlparse
from celery.task import task
from django.conf import settings
......@@ -10,6 +12,8 @@ from edx_ace import ace
from edx_ace.message import MessageType, Message
from edx_ace.recipient import Recipient
from edx_ace.utils.date import deserialize
from edxmako.shortcuts import marketing_link
from openedx.core.djangoapps.schedules.models import Schedule, ScheduleConfig
......@@ -77,18 +81,47 @@ def _recurring_nudge_schedules_for_hour(target_hour, org_list, exclude_orgs=Fals
course_id_str = str(enrollment.course_id)
course = enrollment.course
course_root = reverse('course_root', args=[course_id_str])
def absolute_url(relative_path):
return u'{}{}'.format(settings.LMS_ROOT_URL, urlquote(relative_path))
course_root_relative_url = reverse('course_root', args=[course_id_str])
dashboard_relative_url = reverse('dashboard')
template_context = {
'student_name': user.profile.name,
'course_name': course.display_name,
'course_url': absolute_url(course_root),
'course_url': absolute_url(course_root_relative_url),
# Platform information
'homepage_url': encode_url(marketing_link('ROOT')),
'dashboard_url': absolute_url(dashboard_relative_url),
'template_revision': settings.EDX_PLATFORM_REVISION,
'platform_name': settings.PLATFORM_NAME,
'contact_mailing_address': settings.CONTACT_MAILING_ADDRESS,
'social_media_urls': encode_urls_in_dict(getattr(settings, 'SOCIAL_MEDIA_FOOTER_URLS', {})),
'mobile_store_urls': encode_urls_in_dict(getattr(settings, 'MOBILE_STORE_URLS', {})),
# This is used by the bulk email optout policy
'course_id': course_id_str,
}
yield (user, course.language, template_context)
def encode_url(url):
# Sailthru has a bug where URLs that contain "+" characters in their path components are misinterpreted
# when GA instrumentation is enabled. We need to percent-encode the path segments of all URLs that are
# injected into our templates to work around this issue.
parsed_url = urlparse(url)
modified_url = parsed_url._replace(path=urlquote(parsed_url.path))
return modified_url.geturl()
def absolute_url(relative_path):
root = settings.LMS_ROOT_URL.rstrip('/')
relative_path = relative_path.lstrip('/')
return encode_url(u'{root}/{path}'.format(root=root, path=relative_path))
def encode_urls_in_dict(mapping):
urls = {}
for key, value in mapping.iteritems():
urls[key] = encode_url(value)
return urls
{% load i18n %}
<!-- This is preview text that is visible in the inbox view of many email clients but not visible in the actual
email itself. -->
<div style="
display:none;
font-size:1px;
line-height:1px;
max-height:0px;
max-width:0px;
opacity:0;
overflow:hidden;
visibility:hidden;
">
{% block preview_text %}{% endblock %}
</div>
{# This "View on Web" link must appear in the document before any layout tables so that accessible email clients can #}
{# send the user to a proper web browser which can parse the email correctly. #}
{# Note {view_url} is not a template variable that is evaluated by the Django template engine. It is evaluated by #}
{# Sailthru when the email is sent. Other email providers would need to replace this variable in the HTML as well. #}
<a href="{view_url}">{% trans "View on Web" %}</a>
{# Note this is another late-bound variable #}
<img src="{beacon_src}" alt="" role="presentation" aria-hidden="true" />
{% get_current_language as LANGUAGE_CODE %}
<div bgcolor="#f5f5f5" lang="{{ LANGUAGE_CODE|default:"en" }}" style="
margin: 0;
padding: 0;
min-width: 100%;
">
<!-- This is preview text that is visible in the inbox view of many email clients but not visible in the actual
email itself. -->
<div style="
display:none;
font-size:1px;
line-height:1px;
max-height:0px;
max-width:0px;
opacity:0;
overflow:hidden;
visibility:hidden;
">
{% block preview_text %}{% endblock %}
</div>
<!-- Hack for outlook 2010, which wants to render everything in Times New Roman -->
<!--[if mso]>
<style type="text/css">
......@@ -49,12 +59,12 @@
<table role="presentation" width="100%" align="left" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="70">
<a href="http://www.edx.org"><img
<a href="{{ homepage_url }}"><img
src="https://media.sailthru.com/595/1k1/8/o/599f355101b3f.png" width="70"
height="30" alt="edX Home Page"/></a>
height="30" alt="{% blocktrans %}{{ platform_name }} Home Page{% endblocktrans %}"/></a>
</td>
<td align="right" style="text-align: right;">
<a class="login" href="https://courses.edx.org/dashboard" style="color: #005686;">Sign In</a>
<a class="login" href="{{ dashboard_url }}" style="color: #005686;">{% trans "Sign In" %}</a>
</td>
</tr>
</table>
......@@ -80,46 +90,50 @@
<!-- LOGO / SOCIAL -->
<table role="presentation" width="100%" align="left" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="70">
<!-- LOGO -->
<a href="http://www.edx.org"><img
src="https://media.sailthru.com/595/1k1/8/o/599f355101b3f.png"
width="70" height="30" alt="edX Home Page"/></a>
</td>
<td align="right">
<!-- SOCIAL -->
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="210">
<tr>
<td height="32" width="42" align="right">
<a href="https://www.linkedin.com/company/edx">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354ec70cb.png"
width="32" height="32" alt="edX on LinkedIn"/>
</a>
</td>
<td height="32" width="42" align="right">
<a href="https://www.twitter.com/edXOnline/">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354d9c26e.png"
width="32" height="32" alt="edX on Twitter"/>
</a>
</td>
<td height="32" width="42" align="right">
<a href="http://www.facebook.com/edX">
<img src="https://media.sailthru.com/595/1k1/8/o/599f355052c8e.png"
width="32" height="32" alt="edX on Facebook"/>
</a>
</td>
<td height="32" width="42" align="right">
<a href="https://plus.google.com/%2BedXOnline">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354fc554a.png"
width="32" height="32" alt="edX on Google Plus"/>
</a>
</td>
<td height="32" width="42" align="right">
<a href="https://www.reddit.com/r/edX/">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354e326b9.png"
width="32" height="32" alt="edX on Reddit"/>
</a>
</td>
{% if social_media_urls.linkedin %}
<td height="32" width="42" align="right">
<a href="{{ social_media_urls.linkedin }}">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354ec70cb.png"
width="32" height="32" alt="{% blocktrans %}{{ platform_name }} on LinkedIn{% endblocktrans %}"/>
</a>
</td>
{% endif %}
{% if social_media_urls.twitter %}
<td height="32" width="42" align="right">
<a href="{{ social_media_urls.twitter }}">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354d9c26e.png"
width="32" height="32" alt="{% blocktrans %}{{ platform_name }} on Twitter{% endblocktrans %}"/>
</a>
</td>
{% endif %}
{% if social_media_urls.facebook %}
<td height="32" width="42" align="right">
<a href="{{ social_media_urls.facebook }}">
<img src="https://media.sailthru.com/595/1k1/8/o/599f355052c8e.png"
width="32" height="32" alt="{% blocktrans %}{{ platform_name }} on Facebook{% endblocktrans %}"/>
</a>
</td>
{% endif %}
{% if social_media_urls.google_plus %}
<td height="32" width="42" align="right">
<a href="{{ social_media_urls.google_plus }}">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354fc554a.png"
width="32" height="32" alt="{% blocktrans %}{{ platform_name }} on Google Plus{% endblocktrans %}"/>
</a>
</td>
{% endif %}
{% if social_media_urls.reddit %}
<td height="32" width="42" align="right">
<a href="{{ social_media_urls.reddit }}">
<img src="https://media.sailthru.com/595/1k1/8/o/599f354e326b9.png"
width="32" height="32" alt="{% blocktrans %}{{ platform_name }} on Reddit{% endblocktrans %}"/>
</a>
</td>
{% endif %}
</tr>
</table>
</td>
......@@ -132,17 +146,33 @@
<td>
<table role="presentation" width="100%" align="left" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="col" width="100%" align="center" valign="top">
<table role="presentation" width="100%" align="left" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-bottom: 10px;">
{# Note that this variable is evaluated by Sailthru, not the Django template engine #}
<a href="{optout_confirm_url}" style="color: #005686">
<font color="#005686"><b>{% trans "Unsubscribe from this list" %}</b></font>
</a>
</td>
</tr>
</table>
</td>
<!-- APP BUTTONS -->
<td class="col" width="148" valign="top" align="right" style="padding-bottom: 20px;">
<a href="https://itunes.apple.com/us/app/edx/id945480667?mt=8" style="text-decoration: none">
<img src="https://media.sailthru.com/595/1k1/6/2/5931cfbba391b.png"
alt="Download the iOS app on the Apple Store" width="136" height="50"/>
</a>
<a href="https://play.google.com/store/apps/details?id=org.edx.mobile" style="text-decoration: none">
<img src="https://media.sailthru.com/595/1k1/6/2/5931cf879a033.png"
alt="Download the Android app on the Google Play Store"
width="136" height="50" style="margin: 10px 0 0 5px"/>
</a>
{% if mobile_store_urls.apple %}
<a href="{{ mobile_store_urls.apple }}" style="text-decoration: none">
<img src="https://media.sailthru.com/595/1k1/6/2/5931cfbba391b.png"
alt="{% trans "Download the iOS app on the Apple Store" %}" width="136" height="50"/>
</a>
{% endif %}
{% if mobile_store_urls.google %}
<a href="{{ mobile_store_urls.google }}" style="text-decoration: none">
<img src="https://media.sailthru.com/595/1k1/6/2/5931cf879a033.png"
alt="{% trans "Download the Android app on the Google Play Store" %}"
width="136" height="50" style="margin: 10px 0 0 5px"/>
</a>
{% endif %}
</td>
</tr>
</table>
......@@ -154,11 +184,12 @@
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<p><small>Copyright &copy; 2017 edX, All rights
reserved.</small></p>
<p>
Our mailing address is:<br/>
141 Portland St. 9th Floor, Cambridge, MA 02139
&copy; {% now "Y" %} {{ platform_name }}, {% trans "All rights reserved" %}.
</p>
<p>
{% trans "Our mailing address is" %}:<br/>
{{ contact_mailing_address }}
</p>
</td>
</tr>
......@@ -177,3 +208,7 @@
<![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>
......@@ -2,19 +2,23 @@
{% load i18n %}
{% block preview_text %}
{% blocktrans %} Learning isn't easy - but it's worth it! Complete some problems and learn something new in {{course_name}}. {% endblocktrans %}
{% blocktrans trimmed %}
Keep up the momentum! Many edX learners in {{course_name}} are completing more problems every week, and
participating in the discussion forums. What do you want to do to keep learning?
{% endblocktrans %}
{% endblock %}
{% block content %}
<table width="100%" align="left" border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td>
<h1>{% blocktrans %} Keep up the momentum! {% endblocktrans %}</h1>
<h1>{% trans "Keep up the momentum!" %}</h1>
<p>
{% blocktrans %} Many edX learners in <strong>{{course_name}}</strong> are
completing more problems every week, and participating in the discussion forums. What do you want to do
to keep learning? {% endblocktrans %}
{% blocktrans trimmed %}
Many edX learners in <strong>{{course_name}}</strong> are completing more problems every week, and
participating in the discussion forums. What do you want to do to keep learning?
{% endblocktrans %}
</p>
<p>
<!-- email client support for style sheets is pretty spotty, so we have to inline all of these styles -->
......@@ -31,7 +35,8 @@
border-left: 16px solid #005686;
display: inline-block;
">
<font color="#ffffff"><b>{% blocktrans %} Keep learning {% endblocktrans %}</b></font>
<!-- old email clients require the use of the font tag :( -->
<font color="#ffffff"><b>{% trans "Keep learning" %}</b></font>
</a>
</p>
</td>
......
{% load i18n %}
{% blocktrans %} Keep up the momentum! Many edX learners in {{course_name}} are completing more problems every week, and participating in the discussion forums. What do you want to do to keep learning? {% endblocktrans %}
{% blocktrans trimmed %}
Keep up the momentum! Many edX learners in {{course_name}} are completing more problems every week, and
participating in the discussion forums. What do you want to do to keep learning?
{% endblocktrans %}
{% blocktrans %} Keep learning {% endblocktrans %} <{{course_url}}>
\ No newline at end of file
{% trans "Keep learning" %} <{{course_url}}>
\ No newline at end of file
{% load i18n %}
{% blocktrans %}What do you want to do to keep learning?{% endblocktrans %}
\ No newline at end of file
{% trans "Keep up the momentum!" %}
\ No newline at end of file
......@@ -2,16 +2,24 @@
{% load i18n %}
{% block preview_text %}
{% blocktrans %} Learning isn't easy - but it's worth it! Learn something new in {{course_name}}. {% endblocktrans %}
{% blocktrans trimmed %}
Keep learning today. Remember when you enrolled in {{course_name}} on edX.org? We do, and we’re glad
to have you! Come see what everyone is learning.
{% endblocktrans %}
{% endblock %}
{% block content %}
<table width="100%" align="left" border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td>
<h1>{% blocktrans %} Remember when you enrolled in <strong>{{course_name}}</strong> on edX.org? {% endblocktrans %}</h1>
<h1>{% trans "Keep learning today" %}.</h1>
<p>{% blocktrans %} We do! Come see what everyone is learning. {% endblocktrans %}</p>
<p>
{% blocktrans trimmed %}
Remember when you enrolled in <strong>{{ course_name }}</strong> on edX.org? We do, and we’re glad
to have you! Come see what everyone is learning.
{% endblocktrans %}
</p>
<p>
<!-- email client support for style sheets is pretty spotty, so we have to inline all of these styles -->
......@@ -28,7 +36,8 @@
border-left: 16px solid #005686;
display: inline-block;
">
<font color="#ffffff"><b>{% blocktrans %} Start learning now {% endblocktrans %}</b></font>
<!-- old email clients require the use of the font tag :( -->
<font color="#ffffff"><b>{% trans "Keep learning" %}</b></font>
</a>
</p>
</td>
......
{% load i18n %}
{% blocktrans %} Remember when you enrolled in {{course_name}} on edX.org? We do! Come see what everyone is learning. {% endblocktrans %}
{% blocktrans trimmed %}
Keep learning today. Remember when you enrolled in {{course_name}} on edX.org? We do, and we’re glad
to have you! Come see what everyone is learning.
{% endblocktrans %}
{% blocktrans %} Start learning now {% endblocktrans %} <{{course_url}}>
\ No newline at end of file
{% trans "Keep learning" %} <{{course_url}}>
\ No newline at end of file
{% load i18n %}
{% blocktrans %} {{course_name}} has started on edX {% endblocktrans %}
\ No newline at end of file
{% blocktrans %}Keep learning in {{course_name}}!{% endblocktrans %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment