added an switch to reset the data if the thing is moved into the original group

This commit is contained in:
ilya 2010-08-27 18:17:08 -07:00
parent cf161cb8cf
commit 990be921f3

View file

@ -12,13 +12,18 @@ $(function() {
$(".group ul").droppable({
drop: function(event, ui) {
$(this).closest("ul").append(ui.draggable)
//$("<li class='person ui-draggable'></li>").text(ui.draggable.text()).appendTo(this).draggable();
var move = {};
move[ 'friend_id' ] = ui.draggable[0].id
move[ 'to' ] = $(this)[0].id;
move[ 'from' ] = ui.draggable[0].getAttribute('from_group_id');
$('#group_list').data( ui.draggable[0].id, move);
if (move['to'] == move['from']){
$('#group_list').data( ui.draggable[0].id, []);
} else{
$('#group_list').data( ui.draggable[0].id, move);
}
$(this).closest("ul").append(ui.draggable)
}
});