From 28e55ad9db74291ea3ca8380fb2bf96280336f55 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 14 Nov 2013 10:32:18 +0100 Subject: [PATCH 1/1] Allow for only one item in a bucket in questions of type "przyporzadkuj" --- wtem/static/wtem/edumed.coffee | 3 +++ wtem/static/wtem/edumed.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/wtem/static/wtem/edumed.coffee b/wtem/static/wtem/edumed.coffee index f4c5c28..ae7aea9 100644 --- a/wtem/static/wtem/edumed.coffee +++ b/wtem/static/wtem/edumed.coffee @@ -415,6 +415,9 @@ class Przyporzadkuj extends Exercise draggable_equal: (d1, d2) -> return d1.data("no") == d2.data("no") + draggable_accept: ($draggable, $droppable) -> + dropped = $droppable.closest("ul, ol").find(".draggable") + return (super $draggable, $droppable) && dropped.length == 0 check_question: (question) -> # subjects placed in predicates diff --git a/wtem/static/wtem/edumed.js b/wtem/static/wtem/edumed.js index df98753..940ca54 100644 --- a/wtem/static/wtem/edumed.js +++ b/wtem/static/wtem/edumed.js @@ -543,6 +543,12 @@ return d1.data("no") === d2.data("no"); }; + Przyporzadkuj.prototype.draggable_accept = function($draggable, $droppable) { + var dropped; + dropped = $droppable.closest("ul, ol").find(".draggable"); + return (Przyporzadkuj.__super__.draggable_accept.call(this, $draggable, $droppable)) && dropped.length === 0; + }; + Przyporzadkuj.prototype.check_question = function(question) { var all, bad_count, count, mandatory, minimum, optional, pn, pred, qp, self, v, _i, _j, _len, _len1, _ref, _ref1; minimum = $(question).data("minimum"); -- 2.20.1