Commit da5ab6d2 by Filippo Valsorda

Add SHOW_PROGRESS_SUCCESS_BUTTON feature

Show a button at the top of lms/templates/courseware/progress.html if the
lowest nonzero grade cutoff has been reached. Introduce two settings:
PROGRESS_SUCCESS_BUTTON_URL is the href of that button (the course id is
appended); PROGRESS_SUCCESS_BUTTON_TEXT is the text, defaults to
"Download your certificate"
parent 2f16bbe1
......@@ -243,6 +243,10 @@ FEATURES = {
# Turn off Advanced Security by default
'ADVANCED_SECURITY': False,
# Show a "Download your certificate" on the Progress page if the lowest
# nonzero grade cutoff is met
'SHOW_PROGRESS_SUCCESS_BUTTON': False,
}
# Used for A/B testing
......@@ -1283,6 +1287,11 @@ GRADES_DOWNLOAD = {
'ROOT_PATH': '/tmp/edx-s3/grades',
}
######################## PROGRESS SUCCESS BUTTON ##############################
# The course id will be appended to the following url
PROGRESS_SUCCESS_BUTTON_URL = 'http://<domain>/<path>/'
PROGRESS_SUCCESS_BUTTON_TEXT = "Download your certificate"
#### PASSWORD POLICY SETTINGS #####
PASSWORD_MIN_LENGTH = None
......
......@@ -148,6 +148,24 @@
}
}
#course-success {
margin-bottom: 30px;
text-align: center;
> a {
@include button(simple, $button-color);
@include box-sizing(border-box);
border-radius: 3px;
font: normal 15px/1.6rem $sans-serif;
letter-spacing: 0;
padding: 5px 18px 6px;
text-align: center;
&:hover, &:focus {
text-decoration: none;
}
}
}
#grade-detail-graph {
min-height: 400px;
width: 100%;
......
......@@ -48,6 +48,20 @@ from django.conf import settings
<h1>${_("Course Progress for Student '{username}' ({email})").format(username=student.username, email=student.email)}</h1>
</header>
%if settings.FEATURES['SHOW_PROGRESS_SUCCESS_BUTTON']:
<%
nonzero_cutoffs = [cutoff for cutoff in course.grade_cutoffs.values() if cutoff > 0]
success_cutoff = min(nonzero_cutoffs) if nonzero_cutoffs else None
%>
%if success_cutoff and grade_summary['percent'] > success_cutoff:
<div id="course-success">
<a href="${settings.PROGRESS_SUCCESS_BUTTON_URL}${course.id}">
${settings.PROGRESS_SUCCESS_BUTTON_TEXT}
</a>
</div>
%endif
%endif
%if not course.disable_progress_graph:
<div id="grade-detail-graph" aria-hidden="true"></div>
%endif
......
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