summaryrefslogtreecommitdiff
path: root/yaksh/templates
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/templates')
-rw-r--r--yaksh/templates/base.html6
-rw-r--r--yaksh/templates/yaksh/question.html56
2 files changed, 16 insertions, 46 deletions
diff --git a/yaksh/templates/base.html b/yaksh/templates/base.html
index 35c6976..cbe396f 100644
--- a/yaksh/templates/base.html
+++ b/yaksh/templates/base.html
@@ -19,6 +19,7 @@
<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/theme.css" type="text/css" />
<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/sticky-footer.css" type="text/css" />
<link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/dashboard.css" type="text/css" />
+ <link rel="stylesheet" href="{{ URL_ROOT }}/static/yaksh/css/ontop.css" type="text/css" />
{% block meta %}
@@ -36,6 +37,11 @@
</head>
<body {% block onload %} {% endblock %}>
+ <div id="ontop">
+ <div id="state">
+ Checking...
+ </div>
+ </div>
{% block nav %}
{% endblock %}
<div class="container">
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index 74dd8c3..3a3066c 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -15,7 +15,7 @@
{% endblock %}
{% block script %}
-<script src="{{ URL_ROOT }}/static/yaksh/js/question.js"></script>
+<script src="{{ URL_ROOT }}/static/yaksh/js/requesthandler.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/lib/codemirror.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/python/python.js"></script>
<script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/clike/clike.js"></script>
@@ -79,7 +79,7 @@ function validate(){
}
else
{
- return true;
+ send_request();
}
}
@@ -89,47 +89,8 @@ function call_skip(url)
form.action = url
form.submit();
}
-</script>
-<script>
-
- var init_val = '{{ last_attempt|escape_quotes|safe }}';
- var global_editor = {};
- $(document).ready(function(){
- // Codemirror object, language modes and initial content
- // Get the textarea node
- var textarea_node = document.querySelector('#answer');
-
- var lang = "{{ question.language }}"
- var mode_dict = {
- 'python': 'python',
- 'c': 'text/x-csrc',
- 'cpp': 'text/x-c++src',
- 'java': 'text/x-java',
- 'bash': 'text/x-sh',
- 'scilab': 'text/x-csrc'
- }
-
- // Code mirror Options
- var options = {
- mode: mode_dict[lang],
- gutter: true,
- lineNumbers: true,
- onChange: function (instance, changes) {
- render();
- }
- };
-
- // Initialize the codemirror editor
- global_editor.editor = CodeMirror.fromTextArea(textarea_node, options);
-
- // Setting code editors initial content
- global_editor.editor.setValue(init_val);
-
- function reset_editor() {
- global_editor.editor.setValue(init_val);
- global_editor.editor.clearHistory();
- }
- });
+init_val = '{{ last_attempt|escape_quotes|safe }}';
+lang = "{{ question.language }}"
</script>
{% endblock script %}
@@ -140,14 +101,17 @@ function call_skip(url)
<p id="status"></p>
{% if notification %}
{% if question.type == "code" %}
- <div class="alert alert-success" role="alert">
+ <div id="notification" class="alert alert-success" role="alert">
<strong>Note:</strong> {{ notification }}
</div>
{% else %}
- <div class="alert alert-warning" role="alert">
+ <div id="notification" class="alert alert-warning" role="alert">
<strong>Note:</strong> {{ notification }}
</div>
{% endif %}
+ {% else %}
+ <div id="notification" role="alert">
+ </div>
{% endif %}
<form id="code" action="{{URL_ROOT}}/exam/{{ question.id }}/check/{{ paper.attempt_number }}/{{ paper.question_paper.id }}/" method="post" enctype="multipart/form-data">
{% csrf_token %}
@@ -245,7 +209,7 @@ function call_skip(url)
{% else %}
{% if question in paper.get_questions_unanswered %}
- <button class="btn btn-primary" type="submit" name="check" id="check" onClick="submitCode();">Check Answer <span class="glyphicon glyphicon-cog"></span></button>&nbsp;&nbsp;
+ <button class="btn btn-primary" type="submit" name="check" id="check" >Check Answer <span class="glyphicon glyphicon-cog"></span></button>&nbsp;&nbsp;
{% endif %}
{% endif %}