diff options
author | prathamesh | 2018-01-02 16:46:52 +0530 |
---|---|---|
committer | prathamesh | 2018-01-02 16:46:52 +0530 |
commit | e14514e01052fb36cd9f14675cbe7ca940945a34 (patch) | |
tree | 994f3d5dd6d8c4f3614d3b1a655c91caa7426dcf /yaksh/static | |
parent | 7fe8e17438b8e67e7290f11ddcd29cda3953921b (diff) | |
download | online_test-e14514e01052fb36cd9f14675cbe7ca940945a34.tar.gz online_test-e14514e01052fb36cd9f14675cbe7ca940945a34.tar.bz2 online_test-e14514e01052fb36cd9f14675cbe7ca940945a34.zip |
Allowed user to skip and view solution if the answer is correct.
Added solution attribute to the Question model.
Diffstat (limited to 'yaksh/static')
-rw-r--r-- | yaksh/static/yaksh/js/add_question.js | 4 | ||||
-rw-r--r-- | yaksh/static/yaksh/js/requesthandler.js | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/yaksh/static/yaksh/js/add_question.js b/yaksh/static/yaksh/js/add_question.js index 5bec8c6..346991a 100644 --- a/yaksh/static/yaksh/js/add_question.js +++ b/yaksh/static/yaksh/js/add_question.js @@ -110,6 +110,9 @@ function textareaformat() document.getElementById('my').innerHTML = document.getElementById('id_description').value ; }); + $('#id_solution').bind('keypress', function (event){ + document.getElementById('rend_solution').innerHTML = document.getElementById('id_solution').value ; + }); $('#id_type').bind('focus', function(event){ var type = document.getElementById('id_type'); @@ -121,6 +124,7 @@ function textareaformat() language.style.border = '1px solid #ccc'; }); document.getElementById('my').innerHTML = document.getElementById('id_description').value ; + document.getElementById('rend_solution').innerHTML = document.getElementById('id_solution').value ; if (document.getElementById('id_grade_assignment_upload').checked || document.getElementById('id_type').value == 'upload'){ diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js index f50570b..a24c1f1 100644 --- a/yaksh/static/yaksh/js/requesthandler.js +++ b/yaksh/static/yaksh/js/requesthandler.js @@ -36,7 +36,8 @@ function unlock_screen() { document.getElementById("ontop").style.display = "none"; } -function show_skip() { +function show_solution() { + document.getElementById("solution").style.display = "block"; document.getElementById("skip_ex").style.visibility = "visible"; } @@ -109,7 +110,7 @@ var global_editor = {}; $(document).ready(function(){ if(is_exercise == "True" && can_skip == "False"){ - setTimeout(function() {show_skip();}, delay_time*1000); + setTimeout(function() {show_solution();}, delay_time*1000); } // Codemirror object, language modes and initial content // Get the textarea node |