AJAX: Improve error display during debugging

Add message body display when the Django debug flag is True.
Add a CSS to simulate the appearence and legibility of the
debug message.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-13 00:21:35 -04:00
parent 2b52ee11b2
commit 68995adb7f
2 changed files with 14 additions and 1 deletions

View File

@@ -334,3 +334,10 @@ a i {
transform: rotate(360deg);
}
}
.pre-server-error {
background-color:#ffe7ae;
color: black;
font-size: 110%;
font-weight: bold;
}

View File

@@ -160,7 +160,13 @@ class PartialNavigation {
*/
if (djangoDEBUG) {
$('#ajax-content').html('<pre class="text-primary" style="background-color:#ffe7ae"><code>' + jqXHR.statusText + '</code></pre>');
$('#ajax-content').html(
' \
<h4>Server Error</h4> \
<pre class="pre-server-error"><code>' + jqXHR.responseText || jqXHR.statusText +'</code> \
</pre> \
'
);
} else {
if (jqXHR.status == 0) {
$('#modal-server-error .modal-body').html($('#template-error').html());