diff options
author | Prabhu Ramachandran | 2018-01-03 22:23:19 +0530 |
---|---|---|
committer | GitHub | 2018-01-03 22:23:19 +0530 |
commit | feb295b4107a95621e9430f5c7042cfde4674cc0 (patch) | |
tree | 098c7cdc1e97d5e7bd859e35107a4733e800a586 /yaksh/static | |
parent | e566d54239efcb46f253e324b7295a676378f656 (diff) | |
parent | 4310d5905a9cc702198e42830c1b670957cd7360 (diff) | |
download | online_test-feb295b4107a95621e9430f5c7042cfde4674cc0.tar.gz online_test-feb295b4107a95621e9430f5c7042cfde4674cc0.tar.bz2 online_test-feb295b4107a95621e9430f5c7042cfde4674cc0.zip |
Merge pull request #408 from prathamesh920/exercise
Exercise feature in video lessons
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 | 8 |
2 files changed, 12 insertions, 0 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 639dc81..f98ab12 100644 --- a/yaksh/static/yaksh/js/requesthandler.js +++ b/yaksh/static/yaksh/js/requesthandler.js @@ -36,6 +36,11 @@ function unlock_screen() { document.getElementById("ontop").style.display = "none"; } +function show_solution() { + document.getElementById("solution").style.display = "block"; + document.getElementById("skip_ex").style.visibility = "visible"; +} + function get_result(uid){ var url = "/exam/get_result/" + uid + "/" + course_id + "/" + module_id + "/"; ajax_check_code(url, "GET", "html", null, uid) @@ -119,6 +124,9 @@ function ajax_check_code(url, method_type, data_type, data, uid) var global_editor = {}; var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val(); $(document).ready(function(){ + if(is_exercise == "True" && can_skip == "False"){ + setTimeout(function() {show_solution();}, delay_time*1000); + } // Codemirror object, language modes and initial content // Get the textarea node |