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
10e9fed6
Commit
10e9fed6
authored
Mar 18, 2015
by
Matt Drayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass required values via context to invalid template
parent
76bc375f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
lms/djangoapps/certificates/views.py
+10
-5
lms/templates/certificates/certificate-base.html
+2
-1
No files found.
lms/djangoapps/certificates/views.py
View file @
10e9fed6
...
...
@@ -241,13 +241,21 @@ def render_html_view(request):
This view generates an HTML representation of the specified student's certificate
If a certificate is not available, we display a "Sorry!" screen instead
"""
# Initialize the template context and bootstrap with default values from configuration
context
=
{}
configuration
=
CertificateHtmlViewConfiguration
.
get_config
()
context
=
configuration
.
get
(
'default'
,
{})
invalid_template_path
=
'certificates/invalid.html'
# 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"
)
# Feature Flag check
if
not
settings
.
FEATURES
.
get
(
'CERTIFICATES_HTML_VIEW'
,
False
):
return
render_to_response
(
invalid_template_path
)
return
render_to_response
(
invalid_template_path
,
context
)
context
=
{}
course_id
=
request
.
GET
.
get
(
'course'
,
None
)
context
[
'course'
]
=
course_id
if
not
course_id
:
...
...
@@ -271,9 +279,6 @@ def render_html_view(request):
except
GeneratedCertificate
.
DoesNotExist
:
return
render_to_response
(
invalid_template_path
,
context
)
# Load static output values from configuration,
configuration
=
CertificateHtmlViewConfiguration
.
get_config
()
context
=
configuration
.
get
(
'default'
,
{})
# Override the defaults with any mode-specific static values
context
.
update
(
configuration
.
get
(
certificate
.
mode
,
{}))
# Override further with any course-specific static values
...
...
lms/templates/certificates/certificate-base.html
View file @
10e9fed6
...
...
@@ -6,6 +6,7 @@
#
set
doc
language
direction
from
django
.
utils
.
translation
import
get_language_bidi
dir_rtl =
'rtl'
if
get_language_bidi
()
else
'
ltr
'
document_body_class =
document_body_class_append
if
document_body_class_append
else
''
%
>
<!DOCTYPE html>
...
...
@@ -20,7 +21,7 @@
<
%
include
file=
"_assets-primary.html"
/>
</head>
<body
class=
"view-certificate view-valid-certificate ${dir_rtl} ${document_body_class
_append
}"
data-view=
"valid-certificate"
>
<body
class=
"view-certificate view-valid-certificate ${dir_rtl} ${document_body_class}"
data-view=
"valid-certificate"
>
<div
class=
"wrapper-view"
>
${self.body()}
...
...
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