From da5ab6d222e629c58741024edf7a014dfc29bd41 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Mon, 3 Mar 2014 01:21:25 +0100 Subject: [PATCH] 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" --- lms/envs/common.py | 9 +++++++++ lms/static/sass/course/_profile.scss | 18 ++++++++++++++++++ lms/templates/courseware/progress.html | 14 ++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/lms/envs/common.py b/lms/envs/common.py index 2d6cd4b525..8d3f205cd2 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -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:////' +PROGRESS_SUCCESS_BUTTON_TEXT = "Download your certificate" + #### PASSWORD POLICY SETTINGS ##### PASSWORD_MIN_LENGTH = None diff --git a/lms/static/sass/course/_profile.scss b/lms/static/sass/course/_profile.scss index 87272963be..00615a07a6 100644 --- a/lms/static/sass/course/_profile.scss +++ b/lms/static/sass/course/_profile.scss @@ -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%; diff --git a/lms/templates/courseware/progress.html b/lms/templates/courseware/progress.html index 762d4dcea1..a1ef13debf 100644 --- a/lms/templates/courseware/progress.html +++ b/lms/templates/courseware/progress.html @@ -48,6 +48,20 @@ from django.conf import settings

${_("Course Progress for Student '{username}' ({email})").format(username=student.username, email=student.email)}

+ %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: + + %endif + %endif + %if not course.disable_progress_graph: %endif