Add in messaging for 403 error cases on about pages and update error color for a11y

This commit is contained in:
Farhanah Sheets
2019-06-07 11:22:52 -04:00
parent 221dc99d23
commit 6bd3f2ff51
2 changed files with 8 additions and 4 deletions

View File

@@ -188,8 +188,8 @@
#register_error {
background: $error-color;
border: 1px solid rgb(202, 17, 17);
color: rgb(143, 14, 14);
border: 1px $error-color;
color: $white;
display: none;
padding: 12px;
margin-top: ($baseline/4);

View File

@@ -50,7 +50,7 @@ from six import string_types
$.ajax({
url: "${reverse('add_course_to_cart', args=[text_type(course.id)]) | n, js_escaped_string}",
type: "POST",
/* Rant: HAD TO USE COMPLETE B/C PROMISE.DONE FOR SOME REASON DOES NOT WORK ON THIS PAGE. */
/* Using `complete` as promise.done did not work on this page */
complete: add_course_complete_handler
})
event.preventDefault();
@@ -58,13 +58,17 @@ from six import string_types
% endif
$('#class_enroll_form').on('ajax:complete', function(event, xhr) {
if(xhr.status == 200) {
if (xhr.status == 200) {
if (xhr.responseText == "") {
location.href = "${reverse('dashboard') | n, js_escaped_string}";
}
else {
location.href = xhr.responseText;
}
} else if (xhr.status == 403) {
$('#register_error').text(
(xhr.responseText ? xhr.responseText : "${_("An error has occurred. Please ensure that you are logged in to enroll.") | n, js_escaped_string}")
).css("display", "block");
} else {
$('#register_error').text(
(xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, js_escaped_string}")