+ Przyporzadkuj = (function(_super) {
+
+ __extends(Przyporzadkuj, _super);
+
+ function Przyporzadkuj(element) {
+ var _this = this;
+ Przyporzadkuj.__super__.constructor.call(this, element);
+ if (this.element.attr('multiple') != null) {
+ this.multiple = true;
+ } else {
+ this.multiple = false;
+ }
+ $(".question", this.element).each(function(i, question) {
+ var draggable_opts;
+ draggable_opts = {
+ revert: 'invalid',
+ helper: _this.multiple ? "clone" : null
+ };
+ $(".draggable", question).draggable(draggable_opts).droppable({
+ accept: ".draggable"
+ });
+ $(".predicate .droppable", question).droppable({
+ accept: ".draggable",
+ drop: function(ev, ui) {
+ var added, is_multiple;
+ is_multiple = ui.draggable.is(".multiple");
+ added = ui.draggable.clone();
+ added.attr('style', '');
+ $(this).append(added);
+ added.draggable(draggable_opts);
+ if (!is_multiple) return ui.draggable.remove();
+ }
+ });
+ return $(".subject", question).droppable({
+ accept: ".draggable",
+ drop: function(ev, ui) {
+ var added, is_multiple;
+ is_multiple = ui.draggable.is(".multiple");
+ added = ui.draggable.clone();
+ added.attr('style', '');
+ if (!is_multiple) {
+ $(this).append(added);
+ added.draggable(draggable_opts);
+ }
+ return ui.draggable.remove();
+ }
+ });
+ });
+ }
+
+ return Przyporzadkuj;
+
+ })(Excercise);
+