$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
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);
--- /dev/null
+<div class="exercise przyporzadkuj" data-type="przyporzadkuj">
+
+ <h3>Zadanie {{no}}</h3>
+
+ <div class="question" data-no="1">
+
+ <div class="description">
+ <p class="paragraph">
+ {{exercise.description}}
+ <span class="instruction">Przeciągnij odpowiedzi i upuść w wybranym polu.</span>
+ </p>
+ </div>
+
+ <p class="paragraph">{{exercise.buckets_name|default:"kategorie"|capfirst}}:</p>
+
+ <ul class="lista punkt predicate" data-name="kategorie">
+ {% for bucket in exercise.buckets %}
+ <li data-predicate="{{bucket.id}}">
+ {{bucket.title}}
+ <ul class="subjects">
+ <li class="placeholder multiple ui-droppable accepting"></li>
+ </ul>
+ </li>
+ {% endfor %}
+ </ul>
+ <br class="clr">
+
+ <div class="description">
+ <p class="paragraph">{{exercise.items_name|capfirst}}:</p>
+ </div>
+
+ <ul class="lista punkt subject" data-target="kategorie">
+ {% for item in exercise.items %}
+ <!-- data-solution set to single bogus value only to indicate that this piece has no multiple solutions, not used otherwise (see: is_multiple in edumed.coffee). -->
+ <li data-solution="1" data-no="{{forloop.counter}}" data-id="{{item.id}}" class="question-piece draggable ui-draggable">{{item.text}}</li>
+ {% endfor %}
+ </ul>
+
+ <br class="clr">
+
+ </div>
+
+</div>
+