diff options
Diffstat (limited to 'yaksh/static')
-rw-r--r-- | yaksh/static/yaksh/css/exam.css | 2 | ||||
-rw-r--r-- | yaksh/static/yaksh/js/requesthandler.js | 43 |
2 files changed, 12 insertions, 33 deletions
diff --git a/yaksh/static/yaksh/css/exam.css b/yaksh/static/yaksh/css/exam.css index ec48a14..7d10629 100644 --- a/yaksh/static/yaksh/css/exam.css +++ b/yaksh/static/yaksh/css/exam.css @@ -4,4 +4,4 @@ table td, table th { border: black solid 1px !important; } #stdio, #assertion { table-layout: fixed -}
\ No newline at end of file +} diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js index 1c9a290..5d72241 100644 --- a/yaksh/static/yaksh/js/requesthandler.js +++ b/yaksh/static/yaksh/js/requesthandler.js @@ -61,9 +61,9 @@ function response_handler(method_type, content_type, data, uid){ } else{ unlock_screen(); - error_array = res.error; - generic_error(error_array) - + var error_output = document.getElementById("error_panel"); + error_output.innerHTML = res.error; + focus_on_error(); } } else { reset_values(); @@ -71,35 +71,14 @@ function response_handler(method_type, content_type, data, uid){ } } -function generic_error(error_array){ - var error_output = document.getElementById("error_panel"); - error_output.innerHTML = "" - for (var i = 0; i < error_array.length; i++) { - var panel_danger = document.createElement('div'); - panel_danger.setAttribute('class', "panel panel-danger"); - - var panel_heading = document.createElement('div'); - panel_heading.setAttribute('class', "panel-heading"); - panel_heading.innerHTML = "Error no. " + (i + 1); - - var panel_body = document.createElement('div'); - panel_body.setAttribute('class', "panel-body"); - - var well = document.createElement('div'); - well.setAttribute('class', "well well-sm"); - - var pre = document.createElement('pre'); - var code = document.createElement('code'); - console.log(error_array[i]) - code.append(error_array[i]); - pre.appendChild(code); - well.appendChild(pre); - panel_body.appendChild(well); - panel_danger.appendChild(panel_heading); - panel_danger.appendChild(panel_body); - error_output.appendChild(panel_danger); - } -} +function focus_on_error(){ + var ele = document.getElementById('error_panel') + if (ele) { + ele.scrollIntoView(true); + window.scrollBy(0, -15); + } + } + function ajax_check_code(url, method_type, data_type, data, uid) { $.ajax({ method: method_type, |