Added edx-themed certificate template partials for learner-1996

This commit is contained in:
Michael LoTurco
2017-10-06 14:56:28 -04:00
parent 3c4323010c
commit 96dbd26f83
7 changed files with 138 additions and 8 deletions

View File

@@ -253,16 +253,16 @@ def _update_course_context(request, context, course, course_key, platform_name):
if CertificateGenerationCourseSetting.is_language_specific_templates_enabled_for_course(course_key):
fields = ['start', 'end', 'max_effort', 'content_language']
course_run_data = get_course_run_details(course_key, fields)
if course_run_data['start'] and course_run_data['end'] and course_run_data['max_effort']:
if course_run_data.get('start') and course_run_data.get('end') and course_run_data.get('max_effort'):
# Calculate duration of the course run in weeks, multiplied by max_effort for total Hours of Effort
try:
start = parser.parse(course_run_data['start'])
end = parser.parse(course_run_data['end'])
max_effort = int(course_run_data['max_effort'])
start = parser.parse(course_run_data.get('start'))
end = parser.parse(course_run_data.get('end'))
max_effort = int(course_run_data.get('max_effort'))
context['hours_of_effort'] = ((end - start).days / 7) * max_effort
except ValueError:
log.exception('Error occurred while parsing course run details')
context['content_language'] = course_run_data['content_language']
context['content_language'] = course_run_data.get('content_language')
def _update_social_context(request, context, course, user, user_certificate, platform_name):

View File

@@ -15,10 +15,10 @@ course_mode_class = course_mode if course_mode else ''
<div class="accomplishment-type">
<span class="accomplishment-type-symbol">
<img class="src" src="/static/certificates/images/ico-${course_mode_class}.png" alt="">
<img class="src" src="/static/certificates/images/ico-${course_mode_class}.png" alt="Image for course mode of type ${course_mode_class}">
</span>
<span class="accomplishment-type-label hd-4">${document_title}</span>
<span class="accomplishment-type-label hd-3">${document_title}</span>
</div>
<div class="wrapper-statement-and-signatories">
@@ -93,7 +93,7 @@ course_mode_class = course_mode if course_mode else ''
<dt class="label sr-only">Awarded to:</dt>
<dd class="value copy copy-meta">
<span class="recipient-img">
<img class="src" src="/static/certificates/images/demo-user-profile.png" alt="">
<img class="src" src="/static/certificates/images/demo-user-profile.png" alt="Recipient Image">
</span>
<div class="recipient-details">
<h3 class="recipient-name">${accomplishment_copy_name | h}</h3>

View File

@@ -0,0 +1,17 @@
<%page expression_filter="h"/>
<%!
from django.utils.translation import ugettext as _
from openedx.core.djangolib.markup import HTML, Text
%>
<div class="wrapper-accomplishment-support">
<div class="accomplishment-support">
<div class="accomplishment-support-print">
<p class="accomplishment-metadata-copy">
${Text(_("For tips and tricks on printing your certificate, view the {link_start}Web Certificates help documentation{link_end}.")).format(
link_start=HTML('<a href="http://edx.readthedocs.org/projects/edx-guide-for-students/en/latest/SFD_certificates.html#web-certificates">'),
link_end=HTML('</a>'),
)}
</p>
</div>
</div>
</div>