From: Aleksander Łukasz Date: Thu, 31 Oct 2013 09:50:33 +0000 (+0100) Subject: First exercise of type przyporzadkuj X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/2c29cc5cf878a27f7fd16f4ac2c10472263bcfc1?ds=inline;hp=0ee9781c2a535b72bdae7979ae38707eaf22d791 First exercise of type przyporzadkuj --- 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 %} +
+ +
+ +
+ +
+