summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2017-02-22 14:58:12 +0530
committeradityacp2017-03-10 15:41:07 +0530
commit344b6441017f72225a0d89f41c6cde38f4bbe187 (patch)
tree147e8f10c44ab1edafeec35c34b3e488e9d395e8
parentce7238aef6d5080d8f7ea79b96c9569bf191f0b8 (diff)
downloadonline_test-344b6441017f72225a0d89f41c6cde38f4bbe187.tar.gz
online_test-344b6441017f72225a0d89f41c6cde38f4bbe187.tar.bz2
online_test-344b6441017f72225a0d89f41c6cde38f4bbe187.zip
Allow moderator to select questions in any order required
-rw-r--r--yaksh/static/yaksh/js/question_paper_creation.js14
-rw-r--r--yaksh/templates/yaksh/design_questionpaper.html8
2 files changed, 19 insertions, 3 deletions
diff --git a/yaksh/static/yaksh/js/question_paper_creation.js b/yaksh/static/yaksh/js/question_paper_creation.js
index 898e491..430ec4b 100644
--- a/yaksh/static/yaksh/js/question_paper_creation.js
+++ b/yaksh/static/yaksh/js/question_paper_creation.js
@@ -46,4 +46,18 @@ $(document).ready(function(){
$("#random").click();
});
+ var checked_vals = [];
+ $('input:checkbox[name="questions"]').click(function() {
+ if($(this).prop("checked") == true){
+ checked_vals.push(parseInt($(this).val()));
+ }
+ else{
+ checked_vals.pop(parseInt($(this).val()));
+ }
+ });
+ $('#design_q').submit(function(eventObj) {
+ $(this).append('<input type="hidden" name="checked_ques" value='+checked_vals+'>');
+ return true;
+});
+
});//document
diff --git a/yaksh/templates/yaksh/design_questionpaper.html b/yaksh/templates/yaksh/design_questionpaper.html
index 4418c27..829e27f 100644
--- a/yaksh/templates/yaksh/design_questionpaper.html
+++ b/yaksh/templates/yaksh/design_questionpaper.html
@@ -23,7 +23,7 @@ select
{% block content %}
<input type=hidden id="url_root" value={{ URL_ROOT }}>
-<form action="{{ URL_ROOT }}/exam/manage/designquestionpaper/{{ qpaper.quiz.id }}/{{ qpaper.id }}/" method="POST">
+<form action="{{ URL_ROOT }}/exam/manage/designquestionpaper/{{ qpaper.quiz.id }}/{{ qpaper.id }}/" method="POST" id="design_q">
<input class ="btn primary small" type="submit" name="back" id="back" value="Cancel">
{% csrf_token %}
<input type=hidden name="is_active" id="is_active" value="{{ state }}">
@@ -95,8 +95,10 @@ select
{% for question in fixed_questions %}
<li>
<label>
- <input type="checkbox" name="added-questions" data-qid="{{question.id}}" value={{question.id}}>
- <span> {{ question.summary }} </span> <span> {{ question.points }} </span>
+ <input type="checkbox" name="added-questions"
+ data-qid="{{question.id}}" value={{question.id}}>
+ <span> {{ question.summary }} </span>
+ <span> {{ question.points }} </span>
</label>
</li>
{% endfor %}