Merge pull request #2780 from FiloSottile/progress_success_button

Show a success button at the top of the Progress page
This commit is contained in:
David Baumgold
2014-04-25 16:56:58 -04:00
3 changed files with 43 additions and 0 deletions

View File

@@ -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
@@ -1289,6 +1293,11 @@ GRADES_DOWNLOAD = {
'ROOT_PATH': '/tmp/edx-s3/grades',
}
######################## PROGRESS SUCCESS BUTTON ##############################
# The following fields are available in the URL: {course_id} {student_id}
PROGRESS_SUCCESS_BUTTON_URL = 'http://<domain>/<path>/{course_id}'
PROGRESS_SUCCESS_BUTTON_TEXT_OVERRIDE = None
#### PASSWORD POLICY SETTINGS #####
PASSWORD_MIN_LENGTH = None

View File

@@ -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%;

View File

@@ -48,6 +48,22 @@ from django.conf import settings
<h1>${_("Course Progress for Student '{username}' ({email})").format(username=student.username, email=student.email)}</h1>
</header>
%if settings.FEATURES.get("SHOW_PROGRESS_SUCCESS_BUTTON"):
<%
SUCCESS_BUTTON_URL = settings.PROGRESS_SUCCESS_BUTTON_URL.format(
course_id=course.id, student_id=student.id)
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="${SUCCESS_BUTTON_URL}">
${settings.PROGRESS_SUCCESS_BUTTON_TEXT_OVERRIDE or _("Download your certificate")}
</a>
</div>
%endif
%endif
%if not course.disable_progress_graph:
<div id="grade-detail-graph" aria-hidden="true"></div>
%endif