Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
803a73fd
Commit
803a73fd
authored
Jun 04, 2015
by
Matt Drayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mattdrayer/SOL-953: Remove Mako UNDEFINED overrides
parent
44dfecf7
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
28 deletions
+31
-28
lms/djangoapps/certificates/tests/factories.py
+1
-0
lms/djangoapps/certificates/tests/test_views.py
+2
-1
lms/djangoapps/certificates/views.py
+21
-15
lms/templates/certificates/_accomplishment-banner.html
+3
-1
lms/templates/certificates/_accomplishment-rendering.html
+1
-1
lms/templates/certificates/accomplishment-base.html
+1
-3
lms/templates/certificates/invalid.html
+1
-4
lms/templates/certificates/valid.html
+1
-3
No files found.
lms/djangoapps/certificates/tests/factories.py
View file @
803a73fd
...
...
@@ -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",
...
...
lms/djangoapps/certificates/tests/test_views.py
View file @
803a73fd
...
...
@@ -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
()
...
...
lms/djangoapps/certificates/views.py
View file @
803a73fd
...
...
@@ -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
)
...
...
lms/templates/certificates/_accomplishment-banner.html
View file @
803a73fd
...
...
@@ -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>
...
...
lms/templates/certificates/_accomplishment-rendering.html
View file @
803a73fd
...
...
@@ -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"
>
...
...
lms/templates/certificates/accomplishment-base.html
View file @
803a73fd
<
%!
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
...
...
lms/templates/certificates/invalid.html
View file @
803a73fd
<
%!
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"
>
...
...
lms/templates/certificates/valid.html
View file @
803a73fd
<
%
inherit
file=
"accomplishment-base.html"
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%!
import
mako
.
runtime
%
>
<
%
mako
.
runtime
.
UNDEFINED =
''
%
>
<
%
inherit
file=
"accomplishment-base.html"
/>
% if user.is_authenticated() and user.id == int(accomplishment_user_id):
<
%
include
file=
"_accomplishment-banner.html"
/>
% endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment