mattdrayer/SOL-953: Remove Mako UNDEFINED overrides
This commit is contained in:
@@ -51,6 +51,7 @@ class CertificateHtmlViewConfigurationFactory(DjangoModelFactory):
|
||||
"default": {
|
||||
"accomplishment_class_append": "accomplishment-certificate",
|
||||
"platform_name": "edX",
|
||||
"company_about_url": "http://www.edx.org/about-us",
|
||||
"company_privacy_url": "http://www.edx.org/edx-privacy-policy",
|
||||
"company_tos_url": "http://www.edx.org/edx-terms-service",
|
||||
"company_verified_certificate_url": "http://www.edx.org/verified-certificate",
|
||||
|
||||
@@ -180,7 +180,7 @@ class UpdateExampleCertificateViewTest(TestCase):
|
||||
@attr('shard_1')
|
||||
class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
|
||||
"""
|
||||
Tests for the manual refund page
|
||||
Tests for the certificates web/html views
|
||||
"""
|
||||
def setUp(self):
|
||||
super(CertificatesViewsTests, self).setUp()
|
||||
@@ -421,6 +421,7 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
|
||||
response = self.client.get(test_url)
|
||||
self.assertIn("Invalid Certificate", response.content)
|
||||
|
||||
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
|
||||
def test_evidence_event_sent(self):
|
||||
test_url = get_certificate_url(user_id=self.user.id, course_id=self.course_id) + '?evidence_visit=1'
|
||||
self.recreate_tracker()
|
||||
|
||||
@@ -295,7 +295,6 @@ def _update_certificate_context(context, course, user, user_certificate):
|
||||
context['accomplishment_copy_username'] = user.username
|
||||
context['accomplishment_copy_course_org'] = course.org
|
||||
context['accomplishment_copy_course_name'] = course.display_name
|
||||
context['logo_alt'] = platform_name
|
||||
try:
|
||||
badge = BadgeAssertion.objects.get(user=user, course_id=course.location.course_key)
|
||||
except BadgeAssertion.DoesNotExist:
|
||||
@@ -389,23 +388,11 @@ def _update_certificate_context(context, course, user, user_certificate):
|
||||
|
||||
context['company_contact_urltext'] = _("Contact {platform_name}").format(platform_name=platform_name)
|
||||
|
||||
context['company_privacy_urltext'] = _("Privacy Policy")
|
||||
|
||||
context['company_tos_urltext'] = _("Terms of Service & Honor Code")
|
||||
|
||||
# Translators: This text appears near the top of the certficate and describes the guarantee provided by edX
|
||||
context['document_banner'] = _("{platform_name} acknowledges the following student accomplishment").format(
|
||||
platform_name=platform_name
|
||||
)
|
||||
|
||||
context['logo_subtitle'] = _("Certificate Validation")
|
||||
|
||||
# Translators: This is the copyright line which appears at the bottom of the certificate page/screen
|
||||
context['copyright_text'] = _('© {year} {platform_name}. All rights reserved.').format(
|
||||
year=datetime.now().year,
|
||||
platform_name=platform_name
|
||||
)
|
||||
|
||||
# Translators: This text represents the verification of the certificate
|
||||
context['document_meta_description'] = _('This is a valid {platform_name} certificate for {user_name}, '
|
||||
'who participated in {partner_name} {course_number}').format(
|
||||
@@ -472,7 +459,7 @@ def render_html_view(request, user_id, course_id):
|
||||
If a certificate is not available, we display a "Sorry!" screen instead
|
||||
"""
|
||||
|
||||
# Create the view context and bootstrap with Django settings and passed-in values
|
||||
# Create the initial view context, bootstrapping with Django settings and passed-in values
|
||||
context = {}
|
||||
context['platform_name'] = settings.PLATFORM_NAME
|
||||
context['course_id'] = course_id
|
||||
@@ -481,9 +468,27 @@ def render_html_view(request, user_id, course_id):
|
||||
configuration = CertificateHtmlViewConfiguration.get_config()
|
||||
context.update(configuration.get('default', {}))
|
||||
|
||||
# Translators: 'All rights reserved' is a legal term used in copyrighting to protect published content
|
||||
reserved = _("All rights reserved")
|
||||
context['copyright_text'] = '© {year} {platform_name}. {reserved}.'.format(
|
||||
year=settings.COPYRIGHT_YEAR,
|
||||
platform_name=settings.PLATFORM_NAME,
|
||||
reserved=reserved
|
||||
)
|
||||
|
||||
# Translators: This text is bound to the HTML 'title' element of the page and appears
|
||||
# in the browser title bar when a requested certificate is not found or recognized
|
||||
context['document_title'] = _("Invalid Certificate")
|
||||
|
||||
# Translators: The & characters represent an ampersand character and can be ignored
|
||||
context['company_tos_urltext'] = _("Terms of Service & Honor Code")
|
||||
|
||||
# Translators: A 'Privacy Policy' is a legal document/statement describing a website's use of personal information
|
||||
context['company_privacy_urltext'] = _("Privacy Policy")
|
||||
|
||||
# Translators: This line appears as a byline to a header image and describes the purpose of the page
|
||||
context['logo_subtitle'] = _("Certificate Validation")
|
||||
context['logo_alt'] = settings.PLATFORM_NAME
|
||||
invalid_template_path = 'certificates/invalid.html'
|
||||
|
||||
# Kick the user back to the "Invalid" screen if the feature is disabled
|
||||
@@ -521,8 +526,8 @@ def render_html_view(request, user_id, course_id):
|
||||
except (InvalidKeyError, CourseDoesNotExist, User.DoesNotExist):
|
||||
return render_to_response(invalid_template_path, context)
|
||||
|
||||
# Badge Request Event Tracking Logic
|
||||
if 'evidence_visit' in request.GET:
|
||||
print "Event request found!"
|
||||
try:
|
||||
badge = BadgeAssertion.objects.get(user=user, course_id=course_key)
|
||||
tracker.emit(
|
||||
@@ -566,6 +571,7 @@ def render_html_view(request, user_id, course_id):
|
||||
# Override further with any course-specific static values
|
||||
context.update(course.cert_html_view_overrides)
|
||||
|
||||
# FINALLY, generate and send the output the client
|
||||
return render_to_response("certificates/valid.html", context)
|
||||
|
||||
|
||||
|
||||
@@ -20,14 +20,16 @@
|
||||
<i class="icon fa fa-print" aria-hidden="true"></i>
|
||||
${_("Print Certificate")}
|
||||
</button>
|
||||
%if linked_in_url:
|
||||
<a class="action-linkedin-profile" target="_blank" href="${linked_in_url}"
|
||||
title="${_('Add Certificate to LinkedIn Profile')}"
|
||||
data-course-id="${course_id}"
|
||||
data-certificate-mode="${mode}">
|
||||
data-certificate-mode="${course_mode}">
|
||||
<img class="action-linkedin-profile-img"
|
||||
src="${static.url('images/linkedin_add_to_profile.png')}"
|
||||
alt="${_('Share on LinkedIn')}" />
|
||||
</a>
|
||||
%endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ course_mode_class = course_mode if course_mode else ''
|
||||
<img class="src" src="/static/certificates/images/ico-${course_mode_class}.svg" alt="">
|
||||
</span>
|
||||
|
||||
<span class="accomplishment-type-label hd-4">${certificate_title}</span>
|
||||
<span class="accomplishment-type-label hd-4">${document_title}</span>
|
||||
</div>
|
||||
|
||||
<div class="accomplishment-statement">
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
<%! import mako.runtime %>
|
||||
<% mako.runtime.UNDEFINED = '' %>
|
||||
<%namespace name='static' file='/static_content.html'/>
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
<%
|
||||
# set doc language direction
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
<%! import mako.runtime %>
|
||||
<% mako.runtime.UNDEFINED = '' %>
|
||||
|
||||
<%inherit file="accomplishment-base.html" />
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
<div class="wrapper-content">
|
||||
<div class="wrapper-content-grid">
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
<%! import mako.runtime %>
|
||||
<% mako.runtime.UNDEFINED = '' %>
|
||||
|
||||
<%inherit file="accomplishment-base.html" />
|
||||
<%! from django.utils.translation import ugettext as _ %>
|
||||
|
||||
% if user.is_authenticated() and user.id == int(accomplishment_user_id):
|
||||
<%include file="_accomplishment-banner.html" />
|
||||
% endif
|
||||
|
||||
Reference in New Issue
Block a user