update template

parent 28fd39f7
...@@ -33,6 +33,7 @@ import imp ...@@ -33,6 +33,7 @@ import imp
import sys import sys
import os import os
import dealer.git
from path import Path as path from path import Path as path
from warnings import simplefilter from warnings import simplefilter
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -3297,3 +3298,12 @@ ACE_CHANNEL_SAILTHRU_API_KEY = None ...@@ -3297,3 +3298,12 @@ ACE_CHANNEL_SAILTHRU_API_KEY = None
ACE_CHANNEL_SAILTHRU_API_SECRET = None ACE_CHANNEL_SAILTHRU_API_SECRET = None
ACE_ROUTING_KEY = LOW_PRIORITY_QUEUE 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 import datetime
from subprocess import check_output, CalledProcessError
from urlparse import urlparse
from celery.task import task from celery.task import task
from django.conf import settings from django.conf import settings
...@@ -10,6 +12,8 @@ from edx_ace import ace ...@@ -10,6 +12,8 @@ from edx_ace import ace
from edx_ace.message import MessageType, Message from edx_ace.message import MessageType, Message
from edx_ace.recipient import Recipient from edx_ace.recipient import Recipient
from edx_ace.utils.date import deserialize from edx_ace.utils.date import deserialize
from edxmako.shortcuts import marketing_link
from openedx.core.djangoapps.schedules.models import Schedule, ScheduleConfig 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 ...@@ -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_id_str = str(enrollment.course_id)
course = enrollment.course course = enrollment.course
course_root = reverse('course_root', args=[course_id_str]) course_root_relative_url = reverse('course_root', args=[course_id_str])
dashboard_relative_url = reverse('dashboard')
def absolute_url(relative_path):
return u'{}{}'.format(settings.LMS_ROOT_URL, urlquote(relative_path))
template_context = { template_context = {
'student_name': user.profile.name, 'student_name': user.profile.name,
'course_name': course.display_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 # This is used by the bulk email optout policy
'course_id': course_id_str, 'course_id': course_id_str,
} }
yield (user, course.language, template_context) 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
...@@ -2,19 +2,23 @@ ...@@ -2,19 +2,23 @@
{% load i18n %} {% load i18n %}
{% block preview_text %} {% 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 %} {% endblock %}
{% block content %} {% block content %}
<table width="100%" align="left" border="0" cellpadding="0" cellspacing="0" role="presentation"> <table width="100%" align="left" border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr> <tr>
<td> <td>
<h1>{% blocktrans %} Keep up the momentum! {% endblocktrans %}</h1> <h1>{% trans "Keep up the momentum!" %}</h1>
<p> <p>
{% blocktrans %} Many edX learners in <strong>{{course_name}}</strong> are {% blocktrans trimmed %}
completing more problems every week, and participating in the discussion forums. What do you want to do Many edX learners in <strong>{{course_name}}</strong> are completing more problems every week, and
to keep learning? {% endblocktrans %} participating in the discussion forums. What do you want to do to keep learning?
{% endblocktrans %}
</p> </p>
<p> <p>
<!-- email client support for style sheets is pretty spotty, so we have to inline all of these styles --> <!-- email client support for style sheets is pretty spotty, so we have to inline all of these styles -->
...@@ -31,7 +35,8 @@ ...@@ -31,7 +35,8 @@
border-left: 16px solid #005686; border-left: 16px solid #005686;
display: inline-block; 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> </a>
</p> </p>
</td> </td>
......
{% load i18n %} {% 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}}> {% trans "Keep learning" %} <{{course_url}}>
\ No newline at end of file \ No newline at end of file
{% load i18n %} {% load i18n %}
{% blocktrans %}What do you want to do to keep learning?{% endblocktrans %} {% trans "Keep up the momentum!" %}
\ No newline at end of file \ No newline at end of file
...@@ -2,16 +2,24 @@ ...@@ -2,16 +2,24 @@
{% load i18n %} {% load i18n %}
{% block preview_text %} {% 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 %} {% endblock %}
{% block content %} {% block content %}
<table width="100%" align="left" border="0" cellpadding="0" cellspacing="0" role="presentation"> <table width="100%" align="left" border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr> <tr>
<td> <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> <p>
<!-- email client support for style sheets is pretty spotty, so we have to inline all of these styles --> <!-- email client support for style sheets is pretty spotty, so we have to inline all of these styles -->
...@@ -28,7 +36,8 @@ ...@@ -28,7 +36,8 @@
border-left: 16px solid #005686; border-left: 16px solid #005686;
display: inline-block; 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> </a>
</p> </p>
</td> </td>
......
{% load i18n %} {% 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}}> {% trans "Keep learning" %} <{{course_url}}>
\ No newline at end of file \ No newline at end of file
{% load i18n %} {% load i18n %}
{% blocktrans %} {{course_name}} has started on edX {% endblocktrans %} {% blocktrans %}Keep learning in {{course_name}}!{% endblocktrans %}
\ No newline at end of file \ 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