Commit 700eb8b7 by Matt Drayer

mattdrayer/fix-progress/template: Improved web certificates support

parent 754eb9af
...@@ -858,7 +858,8 @@ class ProgressPageTests(ModuleStoreTestCase): ...@@ -858,7 +858,8 @@ class ProgressPageTests(ModuleStoreTestCase):
resp = views.progress(self.request, course_id=unicode(self.course.id)) resp = views.progress(self.request, course_id=unicode(self.course.id))
self.assertContains(resp, u"View Certificate") self.assertContains(resp, u"View Certificate")
self.assertContains(resp, u"You can now view your certificate")
self.assertContains(resp, u"You can now access your certificate")
cert_url = certs_api.get_certificate_url( cert_url = certs_api.get_certificate_url(
user_id=self.user.id, user_id=self.user.id,
course_id=self.course.id, course_id=self.course.id,
......
...@@ -51,28 +51,24 @@ from django.utils.http import urlquote_plus ...@@ -51,28 +51,24 @@ from django.utils.http import urlquote_plus
%if show_generate_cert_btn: %if show_generate_cert_btn:
<div class="wrapper-msg wrapper-auto-cert"> <div class="wrapper-msg wrapper-auto-cert">
<div id="errors-info" class="errors-info"></div> <div id="errors-info" class="errors-info"></div>
%if passed: %if passed:
<div class="auto-cert-message" id="course-success"> <div class="auto-cert-message" id="course-success">
<div class="has-actions"> <div class="has-actions">
% if is_downloadable and download_url: <% post_url = reverse('generate_user_cert', args=[unicode(course.id)]) %>
% if is_downloadable:
<div class="msg-content"> <div class="msg-content">
<h2 class="title">${_("Your certificate is available")}</h2> <h2 class="title">${_("Your certificate is available")}</h2>
%if show_cert_web_view: <p class="copy">
<p class="copy">${_("You can now view your certificate.")}</p> ${_("You can now access your certificate. If you keep working and receive a higher grade,you can request an {link_start} updated certificate {link_end}.").format(
%else: link_start=u"<a class='generate_certs' href='#' data-endpoint={}>".format(post_url), link_end=u"</a>")}
<p class="copy">${_(
"You can now download your certificate as a PDF. If you keep working and receive a higher grade, you can request an updated certificate.")}
</p> </p>
%endif
</div> </div>
<div class="msg-actions"> <div class="msg-actions">
%if show_cert_web_view: %if show_cert_web_view and cert_web_view_url:
<a class="btn" href="${cert_web_view_url}" target="_blank" title="${_('View certificate in a new browser window or tab.')}"> <a class="btn" href="${cert_web_view_url}" target="_blank" title="${_('View certificate in a new browser window or tab.')}">
${_("View Certificate")} ${_("View Certificate")}
</a> </a>
%else: %elif download_url:
<a class="btn" href="${download_url}" target="_blank" title="${_('PDF will open in a new browser window or tab.')}"> <a class="btn" href="${download_url}" target="_blank" title="${_('PDF will open in a new browser window or tab.')}">
${_("Download Your Certificate")} ${_("Download Your Certificate")}
</a> </a>
...@@ -90,7 +86,7 @@ from django.utils.http import urlquote_plus ...@@ -90,7 +86,7 @@ from django.utils.http import urlquote_plus
<p class="copy">${_("You can keep working for a higher grade, or request your certificate now.")}</p> <p class="copy">${_("You can keep working for a higher grade, or request your certificate now.")}</p>
</div> </div>
<div class="msg-actions"> <div class="msg-actions">
<button class="btn generate_certs" data-endpoint="${reverse('generate_user_cert', args=[unicode(course.id)])}" id="btn_generate_cert">${_('Request Certificate')}</button> <button class="btn generate_certs" data-endpoint="${post_url}" id="btn_generate_cert">${_('Request Certificate')}</button>
</div> </div>
%endif %endif
</div> </div>
......
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