summaryrefslogtreecommitdiff
path: root/testapp/exam/static
diff options
context:
space:
mode:
authorPrabhu Ramachandran2015-09-01 13:03:56 +0530
committerPrabhu Ramachandran2015-09-01 13:03:56 +0530
commitc9abbadbb0e6a4a60edb7ef2a14d6c74648b0677 (patch)
tree8a140c6e2869885b5f53ac8204a8b6ed4a2436a2 /testapp/exam/static
parent44cb800dec3fb81fa084ef59ebe4b54f0b389bc1 (diff)
parentdbab99bc13b8483c24706e47a9a0926508e3c332 (diff)
downloadonline_test-c9abbadbb0e6a4a60edb7ef2a14d6c74648b0677.tar.gz
online_test-c9abbadbb0e6a4a60edb7ef2a14d6c74648b0677.tar.bz2
online_test-c9abbadbb0e6a4a60edb7ef2a14d6c74648b0677.zip
Merge pull request #54 from ankitjavalkar/filter-sort
Filter fields for questions
Diffstat (limited to 'testapp/exam/static')
-rw-r--r--testapp/exam/static/exam/js/question_filter.js47
1 files changed, 47 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..065b06b
--- /dev/null
+++ b/testapp/exam/static/exam/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