diff options
author | ankitjavalkar | 2019-02-18 13:06:21 +0530 |
---|---|---|
committer | GitHub | 2019-02-18 13:06:21 +0530 |
commit | 01c476c535611c671c8b17ad1cb2e8f2b41a4378 (patch) | |
tree | 5cfa0f76bb3609b400d5181461f9176fed7a40ea | |
parent | 51fc3bfee398da2781228a3b3bf32cb5ef3abc6b (diff) | |
parent | a4f7af5aada784384b3a65696596b54e5fd3f612 (diff) | |
download | online_test-01c476c535611c671c8b17ad1cb2e8f2b41a4378.tar.gz online_test-01c476c535611c671c8b17ad1cb2e8f2b41a4378.tar.bz2 online_test-01c476c535611c671c8b17ad1cb2e8f2b41a4378.zip |
Merge pull request #572 from CruiseDevice/alert_on_undo
Show alert on clicking Undo Changes button
-rw-r--r-- | yaksh/static/yaksh/js/requesthandler.js | 5 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 21 |
2 files changed, 25 insertions, 1 deletions
diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js index 952de3a..7ccdef0 100644 --- a/yaksh/static/yaksh/js/requesthandler.js +++ b/yaksh/static/yaksh/js/requesthandler.js @@ -197,6 +197,11 @@ if (question_type == 'upload' || question_type == 'code') { reset_editor = function() { global_editor.editor.setValue(init_val); global_editor.editor.clearHistory(); + $('#undo_changes').modal('hide'); + } + + confirm = function(){ + $("#undo_changes").modal("show"); } }); function user_arranged_options(){ diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index da77702..59dfaef 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -271,7 +271,7 @@ question_type = "{{ question.type }}" <h5>Write your program below:</h5> </div> <div class="col-md-3 ml-auto"> - <a href="#answer" class=" btn btn-outline-primary" onclick="reset_editor()" name="reset" id="reset">Undo Changes <span class="glyphicon glyphicon-refresh"></span></a> + <a href="#answer" class=" btn btn-outline-primary" onclick="confirm()" name="reset" id="reset">Undo Changes <span class="glyphicon glyphicon-refresh"></span></a> </div> </div> <div class="yakshwell"> @@ -335,5 +335,24 @@ question_type = "{{ question.type }}" </div> </div> </div> + + <!-- UNDO CHANGES Modal --> + <div class="modal" id="undo_changes" > + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title" id="myModalLabel">Are you Sure?</h4> + </div> + <div id = "modal_body"class="modal-body"> + <font color="brown"><b>Your code will be reset.</b></font> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-warning" onclick="reset_editor()">OK</button> + <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button> + </div> + </div> + </div> + </div> + {% endblock main %} |