From ae10d36297797ffc53275eabe3acfa0cb4bf3b11 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Mon, 7 Sep 2015 18:03:49 +0530 Subject: Change app name, related paths in views and readme --- .../static/yaksh_app/js/question_filter.js | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 testapp/yaksh_app/static/yaksh_app/js/question_filter.js (limited to 'testapp/yaksh_app/static') diff --git a/testapp/yaksh_app/static/yaksh_app/js/question_filter.js b/testapp/yaksh_app/static/yaksh_app/js/question_filter.js new file mode 100644 index 0000000..065b06b --- /dev/null +++ b/testapp/yaksh_app/static/yaksh_app/js/question_filter.js @@ -0,0 +1,47 @@ +$(document).ready(function(){ + $question_type = $("#id_question_type"); + $marks = $("#id_marks"); + $language = $("#id_language"); + + function question_filter() { + $.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); + } + }); + } + + $question_type.change(function() { + question_filter() + }); + + $language.change(function() { + question_filter() + }); + + $marks.change(function() { + question_filter() + }); + + $("#checkall").live("click", function(){ + if($(this).attr("checked")) { + $("#filtered-questions input:checkbox").each(function(index, element) { + $(this).attr('checked', true); + }); + } + else { + $("#filtered-questions input:checkbox").each(function(index, element) { + $(this).attr('checked', false); + }); + } + }); +}); \ No newline at end of file -- cgit