Merge pull request #10901 from edx/saleem-latif/SOL-1418
saleem-latif/SOL-1418: Revised Generate Certificates Section and added Certificate Generation UI
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
user_name: '',
|
||||
user_email: '',
|
||||
created: '',
|
||||
certificate_generated: '',
|
||||
notes: ''
|
||||
},
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
if (event && event.preventDefault) { event.preventDefault(); }
|
||||
if (event.currentTarget.files.length === 1) {
|
||||
this.$el.find(DOM_SELECTORS.upload_csv_button).removeClass('is-disabled')
|
||||
.addClass('button-blue');
|
||||
.addClass('btn-blue');
|
||||
this.$el.find(DOM_SELECTORS.browse_file).val(
|
||||
event.currentTarget.value.substring(event.currentTarget.value.lastIndexOf("\\") + 1));
|
||||
}
|
||||
|
||||
@@ -81,23 +81,20 @@ var onCertificatesReady = null;
|
||||
success: function (data) {
|
||||
$btn_regenerating_certs.attr('disabled','disabled');
|
||||
if(data.success){
|
||||
$certificate_regeneration_status.text(data.message).
|
||||
removeClass('msg-error').addClass('msg-success');
|
||||
$certificate_regeneration_status.text(data.message).addClass("message");
|
||||
}
|
||||
else{
|
||||
$certificate_regeneration_status.text(data.message).
|
||||
removeClass('msg-success').addClass("msg-error");
|
||||
$certificate_regeneration_status.text(data.message).addClass("message");
|
||||
}
|
||||
},
|
||||
error: function(jqXHR) {
|
||||
try{
|
||||
var response = JSON.parse(jqXHR.responseText);
|
||||
$certificate_regeneration_status.text(gettext(response.message)).
|
||||
removeClass('msg-success').addClass("msg-error");
|
||||
$certificate_regeneration_status.text(gettext(response.message)).addClass("message");
|
||||
}catch(error){
|
||||
$certificate_regeneration_status.
|
||||
text(gettext('Error while regenerating certificates. Please try again.')).
|
||||
removeClass('msg-success').addClass("msg-error");
|
||||
addClass("message");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -98,7 +98,7 @@ define([
|
||||
{
|
||||
id: 1, user_id: 1, user_name: 'test1', user_email: 'test1@test.com',
|
||||
course_id: 'edX/test/course', created: "Thursday, October 29, 2015",
|
||||
notes: 'test notes for test certificate exception'
|
||||
notes: 'test notes for test certificate exception', certificate_generated: ''
|
||||
}
|
||||
);
|
||||
|
||||
@@ -106,7 +106,7 @@ define([
|
||||
{
|
||||
id: 2, user_id: 2, user_name: 'test2', user_email: 'test2@test.com',
|
||||
course_id: 'edX/test/course', created: "Thursday, October 29, 2015",
|
||||
notes: 'test notes for test certificate exception'
|
||||
notes: 'test notes for test certificate exception', certificate_generated: ''
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -142,6 +142,7 @@ define([
|
||||
user_email: "",
|
||||
created: "",
|
||||
notes: "test3 notes",
|
||||
certificate_generated : '',
|
||||
new: true}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -17,8 +17,6 @@ define([
|
||||
server_error_message: "Error while regenerating certificates. Please try again."
|
||||
};
|
||||
var expected = {
|
||||
error_class: 'msg-error',
|
||||
success_class: 'msg-success',
|
||||
url: 'test/url/',
|
||||
postData : [],
|
||||
selected_statuses: ['downloadable', 'error'],
|
||||
@@ -27,29 +25,37 @@ define([
|
||||
|
||||
var select_options = function(option_values){
|
||||
$.each(option_values, function(index, element){
|
||||
$("#certificate-statuses option[value=" + element + "]").attr('selected', 'selected');
|
||||
$("#certificate-regenerating-form input[value=" + element + "]").click();
|
||||
});
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
var fixture = '<section id = "certificates"><h2>Regenerate Certificates</h2>' +
|
||||
var fixture = '<section id="certificates">' +
|
||||
'<form id="certificate-regenerating-form" method="post" action="' + expected.url + '">' +
|
||||
' <p id="status-multi-select-tip">Select one or more certificate statuses ' +
|
||||
' below using your mouse and ctrl or command key.</p>' +
|
||||
' <select class="multi-select" multiple id="certificate-statuses" ' +
|
||||
' name="certificate_statuses" aria-describedby="status-multi-select-tip">' +
|
||||
' <option value="downloadable">Downloadable (2)</option>' +
|
||||
' <option value="error">Error (2)</option>' +
|
||||
' <option value="generating">Generating (1)</option>' +
|
||||
' </select>' +
|
||||
' <label for="certificate-statuses">' +
|
||||
' Select certificate statuses that need regeneration and click Regenerate ' +
|
||||
' Certificates button.' +
|
||||
' </label>' +
|
||||
' <input type="button" id="btn-start-regenerating-certificates" value="Regenerate Certificates"' +
|
||||
' data-endpoint="' + expected.url + '"/>' +
|
||||
'<p class="under-heading">To regenerate certificates for your course, ' +
|
||||
' chose the learners who will receive regenerated certificates and click <br> ' +
|
||||
' Regenerate Certificates.' +
|
||||
'</p>' +
|
||||
'<input id="certificate_status_downloadable" type="checkbox" name="certificate_statuses" ' +
|
||||
' value="downloadable">' +
|
||||
'<label style="display: inline" for="certificate_status_downloadable">' +
|
||||
' Regenerate for learners who have already received certificates. (3)' +
|
||||
'</label><br>' +
|
||||
'<input id="certificate_status_notpassing" type="checkbox" name="certificate_statuses" ' +
|
||||
' value="notpassing">' +
|
||||
'<label style="display: inline" for="certificate_status_notpassing"> ' +
|
||||
' Regenerate for learners who have not received certificates. (1)' +
|
||||
'</label><br>' +
|
||||
'<input id="certificate_status_error" type="checkbox" name="certificate_statuses" ' +
|
||||
' value="error">' +
|
||||
'<label style="display: inline" for="certificate_status_error"> ' +
|
||||
' Regenerate for learners in an error state. (0)' +
|
||||
'</label><br>' +
|
||||
'<input type="button" class="btn-blue" id="btn-start-regenerating-certificates" ' +
|
||||
' value="Regenerate Certificates" data-endpoint="' + expected.url + '">' +
|
||||
'</form>' +
|
||||
'<div class="message certificate-regeneration-status"></div></section>';
|
||||
'<div class="message certificate-regeneration-status"></div>' +
|
||||
'</section>';
|
||||
|
||||
setFixtures(fixture);
|
||||
onCertificatesReady();
|
||||
@@ -87,7 +93,6 @@ define([
|
||||
|
||||
$regenerate_certificates_button.click();
|
||||
AjaxHelpers.respondWithError(requests, 500, {message: MESSAGES.server_error_message});
|
||||
expect($certificate_regeneration_status).toHaveClass(expected.error_class);
|
||||
expect($certificate_regeneration_status.text()).toEqual(MESSAGES.server_error_message);
|
||||
});
|
||||
|
||||
@@ -97,7 +102,6 @@ define([
|
||||
|
||||
$regenerate_certificates_button.click();
|
||||
AjaxHelpers.respondWithError(requests, 400, {message: MESSAGES.error_message});
|
||||
expect($certificate_regeneration_status).toHaveClass(expected.error_class);
|
||||
expect($certificate_regeneration_status.text()).toEqual(MESSAGES.error_message);
|
||||
});
|
||||
|
||||
@@ -107,7 +111,6 @@ define([
|
||||
|
||||
$regenerate_certificates_button.click();
|
||||
AjaxHelpers.respondWithJson(requests, {message: MESSAGES.success_message, success: true});
|
||||
expect($certificate_regeneration_status).toHaveClass(expected.success_class);
|
||||
expect($certificate_regeneration_status.text()).toEqual(MESSAGES.success_message);
|
||||
});
|
||||
|
||||
|
||||
@@ -2105,7 +2105,7 @@ input[name="subject"] {
|
||||
// --------------------
|
||||
.instructor-dashboard-wrapper-2 section.idash-section#certificates {
|
||||
|
||||
%btn-blue {
|
||||
.btn-blue {
|
||||
@extend %btn-primary-blue;
|
||||
padding: ($baseline/2.5) ($baseline/2);
|
||||
text-shadow: none;
|
||||
@@ -2118,6 +2118,46 @@ input[name="subject"] {
|
||||
border-top-style: groove;
|
||||
color: $black;
|
||||
}
|
||||
.certificates-wrapper{
|
||||
.message{
|
||||
@extend %exception-message;
|
||||
}
|
||||
}
|
||||
|
||||
p.under-heading {
|
||||
margin: 12px 0 12px 0;
|
||||
line-height: 23px;
|
||||
}
|
||||
|
||||
hr.section-divider{
|
||||
margin: 25px 0;
|
||||
border-top: 7px solid #646464;
|
||||
}
|
||||
|
||||
.certificate-generation-history{
|
||||
table{
|
||||
thead{
|
||||
tr{
|
||||
td.task-name{
|
||||
width: 150px;
|
||||
}
|
||||
td.task-date{
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tbody{
|
||||
tr{
|
||||
td{
|
||||
padding: 5px;
|
||||
vertical-align: middle;
|
||||
text-align: left;;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#certificate-white-list-editor {
|
||||
.certificate-exception-inputs {
|
||||
@@ -2134,10 +2174,6 @@ input[name="subject"] {
|
||||
.message {
|
||||
@extend %exception-message;
|
||||
}
|
||||
|
||||
.button-blue {
|
||||
@extend %btn-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2155,16 +2191,15 @@ input[name="subject"] {
|
||||
text-align: left;
|
||||
color: $gray;
|
||||
|
||||
&.date, &.email {
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
&.user-id {
|
||||
width: 60px;
|
||||
&.date{
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
&.user-name {
|
||||
width: 150px;
|
||||
width: 120px;
|
||||
}
|
||||
&.user-email {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
&.action {
|
||||
@@ -2211,10 +2246,6 @@ input[name="subject"] {
|
||||
}
|
||||
}
|
||||
|
||||
.button-blue {
|
||||
@extend %btn-blue;
|
||||
}
|
||||
|
||||
.message {
|
||||
@extend %exception-message;
|
||||
}
|
||||
@@ -2225,10 +2256,6 @@ input[name="subject"] {
|
||||
border-bottom: 1px groove black;
|
||||
display: inline-block;
|
||||
}
|
||||
p.under-heading {
|
||||
margin: 12px 0 12px 0;
|
||||
line-height: 23px;
|
||||
}
|
||||
}
|
||||
|
||||
.bulk-white-list-exception {
|
||||
@@ -2250,10 +2277,6 @@ input[name="subject"] {
|
||||
.arrow {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.button-blue {
|
||||
@extend %btn-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user