diff options
author | Prabhu Ramachandran | 2017-10-25 17:47:41 +0530 |
---|---|---|
committer | GitHub | 2017-10-25 17:47:41 +0530 |
commit | 840c00b9e939d2b33058d236ef4170923e0a018b (patch) | |
tree | b8afd6da3fd6810641d2d32aca566e8c985d182e | |
parent | 48f8c2b504f028e3b73622e47ba357c643f05174 (diff) | |
parent | 8b65fe7674b0d6d01253d51be605777e4e9b5a82 (diff) | |
download | online_test-840c00b9e939d2b33058d236ef4170923e0a018b.tar.gz online_test-840c00b9e939d2b33058d236ef4170923e0a018b.tar.bz2 online_test-840c00b9e939d2b33058d236ef4170923e0a018b.zip |
Merge pull request #368 from ankitjavalkar/fix-reset-button
Fix the Reset Answer javascript and rename it to Clear Text Area
-rw-r--r-- | yaksh/static/yaksh/js/requesthandler.js | 18 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js index 9fcf5b6..7ff90df 100644 --- a/yaksh/static/yaksh/js/requesthandler.js +++ b/yaksh/static/yaksh/js/requesthandler.js @@ -83,6 +83,7 @@ function ajax_check_code(url, method_type, data_type, data, uid) { } var global_editor = {}; + $(document).ready(function(){ // Codemirror object, language modes and initial content // Get the textarea node @@ -113,14 +114,17 @@ $(document).ready(function(){ // Setting code editors initial content global_editor.editor.setValue(init_val); - function reset_editor() { + $('#code').submit(function(e) { + lock_screen(); + var data = $(this).serializeArray(); + ajax_check_code($(this).attr("action"), "POST", "html", data, null) + e.preventDefault(); // To stop the default form submission. + }); + + reset_editor = function() { global_editor.editor.setValue(init_val); global_editor.editor.clearHistory(); } - $('#code').submit(function(e) { - lock_screen(); - var data = $(this).serializeArray(); - ajax_check_code($(this).attr("action"), "POST", "html", data, null) - e.preventDefault(); // To stop the default form submission. - }); + + }); diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index fa69b76..c9c4e28 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -204,7 +204,7 @@ lang = "{{ question.language }}" <h4>Write your program below:</h4> </div> <div class="col-md-3"> - <a href="#" class="pull-right" onclick="reset_editor()" name="reset" id="reset">Reset Answer <span class="glyphicon glyphicon-refresh"></span></a> + <a href="#answer" class="pull-right" onclick="reset_editor()" name="reset" id="reset">Undo Changes <span class="glyphicon glyphicon-refresh"></span></a> </div> </div> <textarea name="answer" id="answer"></textarea> |