summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
authorankitjavalkar2016-06-06 18:04:33 +0530
committerankitjavalkar2016-06-07 18:04:25 +0530
commit1b83aa2da97212cb839086ef5c91a6f9e68a3a36 (patch)
treee407530e371106ba37a78fcbb980659f7a75721a /yaksh/templates
parent42a77fcf968c532dc1cb61fab9f45a9903067e61 (diff)
downloadonline_test-1b83aa2da97212cb839086ef5c91a6f9e68a3a36.tar.gz
online_test-1b83aa2da97212cb839086ef5c91a6f9e68a3a36.tar.bz2
online_test-1b83aa2da97212cb839086ef5c91a6f9e68a3a36.zip
Escape quotes in codemirror
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/yaksh/question.html21
1 files changed, 3 insertions, 18 deletions
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index 110c422..b8be99f 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load custom_filters %}
<!DOCTYPE html>
@@ -66,15 +67,6 @@ updateClock();
var timeinterval = setInterval(updateClock,1000);
}
-// function setSnippetHeight()
-// {
-// var ta = document.getElementById('snippet');
-// var height = ta.scrollHeight+'px';
-// ta.style.height = 'auto';
-// ta.style.height = height;
-// autoresize();
-// }
-
function validate(){
uploaded_file = document.getElementById("assignment").value;
if(uploaded_file == ""){
@@ -186,15 +178,9 @@ function call_skip(url)
{% if question.type == "code" %}
<h4>Program:</h4>
-<!-- <textarea rows="1" class="bash" readonly="yes" name="snippet" id="snippet" wrap="off" >{% if last_attempt %}{{ question.snippet }}{% else %}{% if question.type == "bash" %} #!/bin/bash&#13;&#10;{{ question.snippet }}{% else %}{{ question.snippet }}{% endif %}{% endif %}</textarea> -->
-<!-- <textarea rows="10" class="bash" name="answer" id="answer" wrap="off" onkeydown="return catchTab(this,event)">{% if last_attempt %}{{last_attempt}}{% else %}{% if question.type == "bash" %}{% else %}{% endif %}{% endif %}</textarea> -->
<textarea name="answer" id="answer"></textarea>
<br>
-<!-- <script type="text/javascript">
- addLineNumbers('answer');
- </script>
- <script>addLineNumbers('snippet');</script> -->
{% endif %}
{% if question.type == "mcq" or question.type == "mcc "%}
@@ -234,7 +220,6 @@ function call_skip(url)
<script>
// Codemirror object, language modes and initial content
-
// Get the textarea node
var textarea_node = document.querySelector('#answer');
@@ -253,10 +238,10 @@ function call_skip(url)
var editor = CodeMirror.fromTextArea(textarea_node, options);
// Setting code editors initial content
- editor.setValue('{{last_attempt|safe}}') //.replace(/\"|\'/g, "\'") // .replace(/^\"|\"$/g, "")
+ editor.setValue('{{ last_attempt|escape_quotes|safe }}')
function reset_editor() {
- // editor.setValue('{{ last_attempt|safe }}');
+ editor.setValue('{{ last_attempt|escape_quotes|safe }}');
editor.clearHistory();
}