summaryrefslogtreecommitdiff
path: root/testapp/templates
diff options
context:
space:
mode:
authorprathamesh2014-02-12 13:01:30 +0530
committerprathamesh2014-02-12 13:01:30 +0530
commitb2a95b4f99debc4d165bb0122b03b8e67f26b669 (patch)
tree4c6ba9e85a8e30e5f00e4d70435bd47120b96ef1 /testapp/templates
parent3244b69143adb3f86ca2bbdfbbc1b8a93489de29 (diff)
downloadonline_test-b2a95b4f99debc4d165bb0122b03b8e67f26b669.tar.gz
online_test-b2a95b4f99debc4d165bb0122b03b8e67f26b669.tar.bz2
online_test-b2a95b4f99debc4d165bb0122b03b8e67f26b669.zip
Modified snippet
Snippet textarea extends according to the length of the snippet with numbering. The textarea to write code is dynamic with numbering. The textarea extends as per the length of the code.
Diffstat (limited to 'testapp/templates')
-rw-r--r--testapp/templates/exam/question.html18
1 files changed, 14 insertions, 4 deletions
diff --git a/testapp/templates/exam/question.html b/testapp/templates/exam/question.html
index 529b620..c8454ff 100644
--- a/testapp/templates/exam/question.html
+++ b/testapp/templates/exam/question.html
@@ -39,12 +39,22 @@ function update_time()
document.forms["code"].submit();
}
}
+
+function setSnippetHeight()
+{
+ var ta = document.getElementById('snippet');
+ var height = ta.scrollHeight+'px';
+ ta.style.height = 'auto';
+ ta.style.height = height;
+ autoresize();
+}
+
</script>
{% endblock script %}
-{% block onload %} onload="update_time()" {% endblock %}
+{% block onload %} onload="update_time();setSnippetHeight()" {% endblock %}
{% block pagetitle %}
@@ -98,15 +108,15 @@ function update_time()
{% endfor %}
{% else %}
- <textarea tabindex=1 rows="3" style="width:750px;margin-bottom:15px;height:auto;" 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="1" style="padding:0;height:auto;width:750px;overflow:hidden;background-color:white;border: 0 none white;" 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 tabindex=1 rows="10" style="width:750px;margin-bottom:10px;" 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 tabindex=1 rows="10" style="padding:0;height:auto; box-shadow: none;width:750px;margin-bottom:10px;overflow:hidden;border:none;" 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>
<br>
<script type="text/javascript">
addLineNumbers('answer');
</script>
- <script>addLineNumbers('snippet');</Script>
+ <script>addLineNumbers('snippet');</script>
{% endif %}
{% if question.type == "mcq" %}