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
bed7d807
Commit
bed7d807
authored
Jul 16, 2015
by
Zia Fazal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable certificate generation for html certificates
Enable Student-Generated Certificates for HTML certs flow
parent
d3cb2e94
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
13 deletions
+38
-13
lms/djangoapps/instructor/tests/test_certificates.py
+17
-0
lms/djangoapps/instructor/views/instructor_dashboard.py
+19
-13
lms/templates/instructor/instructor_dashboard_2/certificates.html
+2
-0
No files found.
lms/djangoapps/instructor/tests/test_certificates.py
View file @
bed7d807
...
...
@@ -7,6 +7,7 @@ import json
from
nose.plugins.attrib
import
attr
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
from
django.conf
import
settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
config_models.models
import
cache
...
...
@@ -94,6 +95,22 @@ class CertificatesInstructorDashTest(ModuleStoreTestCase):
certs_api
.
set_cert_generation_enabled
(
self
.
course
.
id
,
True
)
self
.
_assert_enable_certs_button
(
False
)
@mock.patch.dict
(
settings
.
FEATURES
,
{
'CERTIFICATES_HTML_VIEW'
:
True
})
def
test_show_enabled_button_for_html_certs
(
self
):
"""
Tests `Enable Student-Generated Certificates` button is enabled
and `Generate Example Certificates` button is not available if
course has Web/HTML certificates view enabled.
"""
self
.
course
.
cert_html_view_enabled
=
True
self
.
course
.
save
()
self
.
store
.
update_item
(
self
.
course
,
self
.
global_staff
.
id
)
# pylint: disable=no-member
self
.
client
.
login
(
username
=
self
.
global_staff
.
username
,
password
=
"test"
)
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertContains
(
response
,
'Enable Student-Generated Certificates'
)
self
.
assertContains
(
response
,
'enable-certificates-submit'
)
self
.
assertNotContains
(
response
,
'Generate Example Certificates'
)
def
_assert_certificates_visible
(
self
,
is_visible
):
"""Check that the certificates section is visible on the instructor dash. """
response
=
self
.
client
.
get
(
self
.
url
)
...
...
lms/djangoapps/instructor/views/instructor_dashboard.py
View file @
bed7d807
...
...
@@ -231,20 +231,25 @@ def _section_certificates(course):
dict
"""
example_cert_status
=
certs_api
.
example_certificates_status
(
course
.
id
)
# Allow the user to enable self-generated certificates for students
# *only* once a set of example certificates has been successfully generated.
# If certificates have been misconfigured for the course (for example, if
# the PDF template hasn't been uploaded yet), then we don't want
# to turn on self-generated certificates for students!
can_enable_for_course
=
(
example_cert_status
is
not
None
and
all
(
cert_status
[
'status'
]
==
'success'
for
cert_status
in
example_cert_status
example_cert_status
=
None
html_cert_enabled
=
certs_api
.
has_html_certificates_enabled
(
course
.
id
,
course
)
if
html_cert_enabled
:
can_enable_for_course
=
True
else
:
example_cert_status
=
certs_api
.
example_certificates_status
(
course
.
id
)
# Allow the user to enable self-generated certificates for students
# *only* once a set of example certificates has been successfully generated.
# If certificates have been misconfigured for the course (for example, if
# the PDF template hasn't been uploaded yet), then we don't want
# to turn on self-generated certificates for students!
can_enable_for_course
=
(
example_cert_status
is
not
None
and
all
(
cert_status
[
'status'
]
==
'success'
for
cert_status
in
example_cert_status
)
)
)
instructor_generation_enabled
=
settings
.
FEATURES
.
get
(
'CERTIFICATES_INSTRUCTOR_GENERATION'
,
False
)
return
{
...
...
@@ -254,6 +259,7 @@ def _section_certificates(course):
'can_enable_for_course'
:
can_enable_for_course
,
'enabled_for_course'
:
certs_api
.
cert_generation_enabled
(
course
.
id
),
'instructor_generation_enabled'
:
instructor_generation_enabled
,
'html_cert_enabled'
:
html_cert_enabled
,
'urls'
:
{
'generate_example_certificates'
:
reverse
(
'generate_example_certificates'
,
...
...
lms/templates/instructor/instructor_dashboard_2/certificates.html
View file @
bed7d807
...
...
@@ -3,6 +3,7 @@
<div
class=
"certificates-wrapper"
>
<div
class=
"example-certificates"
>
% if not section_data['html_cert_enabled']:
<h2>
${_('Example Certificates')}
</h2>
<div
class=
"generate-example-certificates-wrapper"
>
...
...
@@ -13,6 +14,7 @@
<input
type=
"submit"
id=
"generate-example-certificates-submit"
value=
"${_('Generate Example Certificates')}"
/>
</form>
</div>
% endif
% if section_data['example_certificate_status'] is not None:
<div
class=
"example-certificate-status-wrapper"
>
...
...
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