@edx/edx-proctoring
Advanced tools
Comparing version 3.23.4 to 3.23.5
@@ -116,3 +116,3 @@ edx = edx || {}; | ||
}); | ||
$el.find('.close').css({ | ||
$el.find('.close-selected-exam').css({ | ||
'font-size': '16px', | ||
@@ -127,3 +127,2 @@ margin: '5px' | ||
return { | ||
proctored_exam: this.selectedExams, | ||
allowance_type: $('select#allowance_type').val(), | ||
@@ -155,3 +154,3 @@ allowance_value: $('#allowance_value').val(), | ||
addAllowance: function(event) { | ||
var $errorResponse, values, formHasErrors, exams; | ||
var $errorResponse, formValues, formHasErrors, examIdCollection; | ||
var self = this; | ||
@@ -161,26 +160,11 @@ event.preventDefault(); | ||
$errorResponse.html(); | ||
values = this.getCurrentFormValues(); | ||
formHasErrors = false; | ||
exams = ''; | ||
formValues = this.getCurrentFormValues(); | ||
examIdCollection = ''; | ||
$('.close').each(function() { | ||
exams += $(this).attr('data-item') + ','; | ||
$('.close-selected-exam').each(function() { | ||
examIdCollection += $(this).attr('data-item') + ','; | ||
}); | ||
$.each(values, function(key, value) { | ||
if (value === '') { | ||
formHasErrors = true; | ||
self.showError(self, key, gettext('Required field')); | ||
} else { | ||
self.hideError(self, key); | ||
} | ||
}); | ||
formHasErrors = this.checkFormErrors(formValues, examIdCollection); | ||
if (exams === '') { | ||
formHasErrors = true; | ||
self.showError(self, 'proctored_exam', gettext('Required field')); | ||
} else { | ||
self.hideError(self, 'proctored_exam'); | ||
} | ||
if (!formHasErrors) { | ||
@@ -193,6 +177,6 @@ self.model.fetch({ | ||
data: { | ||
exam_ids: exams, | ||
user_ids: values.user_info, | ||
allowance_type: values.allowance_type, | ||
value: values.allowance_value | ||
exam_ids: examIdCollection, | ||
user_ids: formValues.user_info, | ||
allowance_type: formValues.allowance_type, | ||
value: formValues.allowance_value | ||
}, | ||
@@ -228,3 +212,3 @@ success: function() { | ||
selectExamType: function() { | ||
$('.close').each(function() { | ||
$('.close-selected-exam').each(function() { | ||
$(this).trigger('click'); | ||
@@ -269,3 +253,3 @@ }); | ||
closeIcon.innerHTML = 'x'; | ||
closeIcon.setAttribute('class', 'close'); | ||
closeIcon.setAttribute('class', 'close-selected-exam'); | ||
closeIcon.setAttribute('data-item', examID); | ||
@@ -284,3 +268,23 @@ closeIcon.setAttribute('data-name', examName); | ||
}, | ||
checkFormErrors: function(formValues, examIdCollection) { | ||
var formHasErrors; | ||
var self = this; | ||
$.each(formValues, function(key, value) { | ||
if (value === '') { | ||
formHasErrors = true; | ||
self.showError(self, key, gettext('Required field')); | ||
} else { | ||
self.hideError(self, key); | ||
} | ||
}); | ||
if (examIdCollection === '') { | ||
formHasErrors = true; | ||
self.showError(self, 'proctored_exam', gettext('Required field')); | ||
} else { | ||
self.hideError(self, 'proctored_exam'); | ||
} | ||
return formHasErrors; | ||
}, | ||
render: function() { | ||
@@ -287,0 +291,0 @@ $(this.el).html(this.template({ |
{ | ||
"name": "@edx/edx-proctoring", | ||
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.", | ||
"version": "3.23.4", | ||
"version": "3.23.5", | ||
"main": "edx_proctoring/static/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
1011692
18427