- return false
- return self.draggable_accept $draggable, $(this)
-
- drop: (ev, ui) ->
- added = $(ui.draggable).clone()
- $added = added
- $added.data("original", ui.draggable)
- if not ismultiple
- $(ui.draggable).addClass('disabled').draggable('disable')
-
- $(ev.target).after(added)
- if not $(ev.target).hasClass('multiple')
- $(ev.target).hide()
- $added.append('<span class="remove">x</span>')
- $('.remove', added).click (ev) =>
- $added.prev(".placeholder:not(.multiple)").show()
- if not ismultiple
- $added.data('original').removeClass('disabled').draggable('enable')
- $(added).remove()
-
-
-
-# $(".droppable", question).each (i, droppable) =>
-# $droppable = $(droppable)
-# $droppable.droppable
-# accept: (draggable) =>
-# return false
-# $draggable = $(draggable)
-# if not $draggable.is(".draggable")
-# console.log('not draggable?')
-# return false
-
-# for added in $droppable.children(".draggable")
-# if @draggable_equal($(added), $draggable)
-# console.log('already here:' + $draggable.text())
-# return false
-
-# return @draggable_accept $draggable
-
-# drop: (ev, ui) =>
-# added = ui.draggable.clone()
-# # added.attr('style', '')
-# $(ev.target).append(added)
-# added.draggable(draggable_opts)
-# @draggable_dropped added
-
-# if not @multiple
-# $(ui.draggable).draggable("disable")
-
-
- # if issortable
- # $(".droppable", question).sortable
- # items: "> li"
-
- # receive: (event, ui) =>
- # console.log("receive " + $(ui.item).text())
- # if not accept(ui.item, event.target)
- # console.log("REVERT")
- # $(event.target).sortable('cancel')
-
- # over: (event, ui) =>
- # if not accept(ui.item, event.target)
- # $(event.target).sortable('disable')
- # out: (event, ui) =>
- # $(event.target).sortable('enable')
-
-
-class Wybor extends Excercise
+ is_accepted = false
+
+ if is_accepted
+ is_accepted= self.draggable_accept $draggable, $(this)
+
+ if is_accepted
+ $(this).addClass 'accepting'
+ else
+ $(this).removeClass 'accepting'
+ return is_accepted
+
+ drop: (ev, ui) =>
+ $(ev.target).removeClass 'accepting dragover'
+
+ @draggable_move $(ui.draggable), $(ev.target), ismultiple
+
+ # $added = $(ui.draggable).clone()
+ # $added.data("original", ui.draggable)
+ # if not ismultiple
+ # $(ui.draggable).addClass('disabled').draggable('disable')
+
+ # $(ev.target).after(added)
+ # if not $(ev.target).hasClass('multiple')
+ # $(ev.target).hide()
+ # $added.append('<span class="remove">x</span>')
+ # $('.remove', added).click (ev) =>
+ # $added.prev(".placeholder:not(.multiple)").show()
+ # if not ismultiple
+ # $added.data('original').removeClass('disabled').draggable('enable')
+ # $(added).remove()
+
+ over: (ev, ui) ->
+ $(ev.target).addClass 'dragover'
+
+
+ out: (ev, ui) ->
+ $(ev.target).removeClass 'dragover'
+
+
+
+class Wybor extends Exercise