Add in messaging for 403 error cases on about pages and update error color for a11y
This commit is contained in:
@@ -188,8 +188,8 @@
|
|||||||
|
|
||||||
#register_error {
|
#register_error {
|
||||||
background: $error-color;
|
background: $error-color;
|
||||||
border: 1px solid rgb(202, 17, 17);
|
border: 1px $error-color;
|
||||||
color: rgb(143, 14, 14);
|
color: $white;
|
||||||
display: none;
|
display: none;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
margin-top: ($baseline/4);
|
margin-top: ($baseline/4);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ from six import string_types
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: "${reverse('add_course_to_cart', args=[text_type(course.id)]) | n, js_escaped_string}",
|
url: "${reverse('add_course_to_cart', args=[text_type(course.id)]) | n, js_escaped_string}",
|
||||||
type: "POST",
|
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
|
complete: add_course_complete_handler
|
||||||
})
|
})
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -58,13 +58,17 @@ from six import string_types
|
|||||||
% endif
|
% endif
|
||||||
|
|
||||||
$('#class_enroll_form').on('ajax:complete', function(event, xhr) {
|
$('#class_enroll_form').on('ajax:complete', function(event, xhr) {
|
||||||
if(xhr.status == 200) {
|
if (xhr.status == 200) {
|
||||||
if (xhr.responseText == "") {
|
if (xhr.responseText == "") {
|
||||||
location.href = "${reverse('dashboard') | n, js_escaped_string}";
|
location.href = "${reverse('dashboard') | n, js_escaped_string}";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
location.href = xhr.responseText;
|
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 {
|
} else {
|
||||||
$('#register_error').text(
|
$('#register_error').text(
|
||||||
(xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, js_escaped_string}")
|
(xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, js_escaped_string}")
|
||||||
|
|||||||
Reference in New Issue
Block a user