Make the SHOW_PROGRESS_SUCCESS_BUTTON feature more flexible
The button text default is now in the template and i18n-able, a PROGRESS_SUCCESS_BUTTON_TEXT_OVERRIDE option is offered in settings. The button url now uses string formatting.
This commit is contained in:
@@ -1288,9 +1288,9 @@ GRADES_DOWNLOAD = {
|
||||
}
|
||||
|
||||
######################## 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"
|
||||
# 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 #####
|
||||
|
||||
|
||||
@@ -48,15 +48,17 @@ 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']:
|
||||
%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="${settings.PROGRESS_SUCCESS_BUTTON_URL}${course.id}">
|
||||
${settings.PROGRESS_SUCCESS_BUTTON_TEXT}
|
||||
<a href="${SUCCESS_BUTTON_URL}">
|
||||
${settings.PROGRESS_SUCCESS_BUTTON_TEXT_OVERRIDE or _("Download your certificate")}
|
||||
</a>
|
||||
</div>
|
||||
%endif
|
||||
|
||||
Reference in New Issue
Block a user