From 2c29cc5cf878a27f7fd16f4ac2c10472263bcfc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 31 Oct 2013 10:50:33 +0100 Subject: [PATCH 1/1] First exercise of type przyporzadkuj --- edumed/settings.d/50-static.py | 1 + wtem/static/wtem/edumed.coffee | 9 ++++ wtem/static/wtem/edumed.js | 17 +++++++ .../wtem/exercises/edumed_przyporzadkuj.html | 44 +++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 wtem/templates/wtem/exercises/edumed_przyporzadkuj.html diff --git a/edumed/settings.d/50-static.py b/edumed/settings.d/50-static.py index 5b6c079..ce1d1da 100644 --- a/edumed/settings.d/50-static.py +++ b/edumed/settings.d/50-static.py @@ -50,6 +50,7 @@ PIPELINE_JS = { }, 'wtem': { 'source_filenames': ( + 'catalogue/js/jquery-ui-1.10.0.custom.js', 'wtem/edumed.js', 'wtem/wtem.js', ), diff --git a/wtem/static/wtem/edumed.coffee b/wtem/static/wtem/edumed.coffee index baae08e..d70ce8a 100644 --- a/wtem/static/wtem/edumed.coffee +++ b/wtem/static/wtem/edumed.coffee @@ -459,6 +459,15 @@ class Przyporzadkuj extends Exercise $ph = $pr.find ".placeholder:visible" @draggable_move $(qp), $ph.eq(0), @multiple + get_answer: (question) -> + answer = {} + $(".predicate [data-predicate]", question).each (i, subjects) => + predicate = $(subjects).attr('data-predicate') + answer[predicate] = [] + $('.question-piece', subjects).each (i, qpiece) => + $qpiece = $(qpiece) + answer[predicate].push($qpiece.attr('data-id')) + return answer class PrawdaFalsz extends Exercise diff --git a/wtem/static/wtem/edumed.js b/wtem/static/wtem/edumed.js index 58b5114..2a6ddb0 100644 --- a/wtem/static/wtem/edumed.js +++ b/wtem/static/wtem/edumed.js @@ -600,6 +600,23 @@ return _results; }; + Przyporzadkuj.prototype.get_answer = function(question) { + var answer, + _this = this; + answer = {}; + $(".predicate [data-predicate]", question).each(function(i, subjects) { + var predicate; + predicate = $(subjects).attr('data-predicate'); + answer[predicate] = []; + return $('.question-piece', subjects).each(function(i, qpiece) { + var $qpiece; + $qpiece = $(qpiece); + return answer[predicate].push($qpiece.attr('data-id')); + }); + }); + return answer; + }; + return Przyporzadkuj; })(Exercise); diff --git a/wtem/templates/wtem/exercises/edumed_przyporzadkuj.html b/wtem/templates/wtem/exercises/edumed_przyporzadkuj.html new file mode 100644 index 0000000..85122e0 --- /dev/null +++ b/wtem/templates/wtem/exercises/edumed_przyporzadkuj.html @@ -0,0 +1,44 @@ +
+ +

Zadanie {{no}}

+ +
+ +
+

+ {{exercise.description}} + Przeciągnij odpowiedzi i upuść w wybranym polu. +

+
+ +

{{exercise.buckets_name|default:"kategorie"|capfirst}}:

+ +
    + {% for bucket in exercise.buckets %} +
  • + {{bucket.title}} +
      +
    • +
    +
  • + {% endfor %} +
+
+ +
+

{{exercise.items_name|capfirst}}:

+
+ +
    + {% for item in exercise.items %} + +
  • {{item.text}}
  • + {% endfor %} +
+ +
+ +
+ +
+ -- 2.20.1