summaryrefslogtreecommitdiff
path: root/testapp/exam/static
diff options
context:
space:
mode:
authorankitjavalkar2015-07-21 18:02:56 +0530
committerankitjavalkar2015-08-05 12:00:54 +0530
commit214d8696fafee4e38c6bf039315aac37e4cd2e2b (patch)
treef7bc823ab005a9791f020c0eeb7a0a1f828b28fe /testapp/exam/static
parent0225aad1492600ed53504b0986fd13da24c28ae9 (diff)
downloadonline_test-214d8696fafee4e38c6bf039315aac37e4cd2e2b.tar.gz
online_test-214d8696fafee4e38c6bf039315aac37e4cd2e2b.tar.bz2
online_test-214d8696fafee4e38c6bf039315aac37e4cd2e2b.zip
Add filters to question display
Diffstat (limited to 'testapp/exam/static')
-rw-r--r--testapp/exam/static/exam/js/question_filter.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/testapp/exam/static/exam/js/question_filter.js b/testapp/exam/static/exam/js/question_filter.js
new file mode 100644
index 0000000..7dc92a6
--- /dev/null
+++ b/testapp/exam/static/exam/js/question_filter.js
@@ -0,0 +1,69 @@
+$(document).ready(function(){
+ $question_type = $("#id_question_type");
+ $marks = $("#id_marks");
+ $language = $("#id_language");
+
+ $question_type.change(function() {
+ $.ajax({
+ url: "/exam/ajax/questions/filter/",
+ type: "POST",
+ data: {
+ question_type: $question_type.val(),
+ marks: $marks.val(),
+ language: $language.val()
+ },
+ dataType: "html",
+ success: function(output) {
+ var questions = $(output).filter("#questions").html();
+ $("#filtered-questions").html(questions);
+ }
+ });
+ });
+
+ $language.change(function() {
+ $.ajax({
+ url: "/exam/ajax/questions/filter/",
+ type: "POST",
+ data: {
+ question_type: $question_type.val(),
+ marks: $marks.val(),
+ language: $language.val()
+ },
+ dataType: "html",
+ success: function(output) {
+ var questions = $(output).filter("#questions").html();
+ $("#filtered-questions").html(questions);
+ }
+ });
+ });
+
+ $marks.change(function() {
+ $.ajax({
+ url: "/exam/ajax/questions/filter/",
+ type: "POST",
+ data: {
+ question_type: $question_type.val(),
+ marks: $marks.val(),
+ language: $language.val()
+ },
+ dataType: "html",
+ success: function(output) {
+ var questions = $(output).filter("#questions").html();
+ $("#filtered-questions").html(questions);
+ }
+ });
+ });
+
+ $("#checkall").live("click", function(){
+ if($(this).attr("checked")) {
+ $("#filtered-questions input:checkbox").each(function(index, element) {
+ $(this).attr('checked','checked');
+ });
+ }
+ else {
+ $("#filtered_questions input:checkbox").each(function(index, element) {
+ $(this).removeAttr('checked');
+ });
+ }
+ });
+}); \ No newline at end of file