diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-10 07:59:29 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-10 07:59:29 -0700 |
commit | bea89be268f242a381e77f94f44b8bdbf3f90ff9 (patch) | |
tree | e5fa85495b63a5946ef01846cb007f0b9e1d92e0 | |
parent | eb345cb8702f3443087c7fab815301c0a08281a3 (diff) |
If the current drop target is not defined, in that we have moved out of the range of the current li elements, then assume the drop is occurring at the end of the list items. Fixes #742
-rw-r--r-- | modules/organize/js/organize.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index d4449b38..0aeb4f7c 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -56,11 +56,18 @@ tolerance: "pointer", greedy: true, drop: function(event, ui) { - var before_or_after = $(".currentDropTarget").css("borderLeftStyle") == "solid" ? "before" : "after"; + var before_or_after = null; + var target_id = null; + if ($(".currentDropTarget").length) { + before_or_after = $(".currentDropTarget").css("borderLeftStyle") == "solid" ? "before" : "after"; + target_id = $(".currentDropTarget").attr("ref"); + } else { + before_or_after = "after"; + target_id = $("#gOrganizeMicroThumbGrid li:last").attr("ref"); + } $.organize.do_drop({ url: rearrange_url - .replace("__TARGET_ID__", $(".currentDropTarget").attr("ref")) - .replace("__ALBUM_ID__", $(".currentDropTarget").attr("ref")) + .replace("__TARGET_ID__", target_id) .replace("__BEFORE__", before_or_after), source: $(ui.helper).children("img") }); @@ -119,8 +126,8 @@ $(".currentDropTarget").removeClass("currentDropTarget"); var borderStyle = event.pageX < $(this).offset().left + $(this).width() / 2 ? "borderLeftStyle" : "borderRightStyle"; - $(this).css(borderStyle, "solid"); - $(this).addClass("currentDropTarget"); + $(this).addClass("currentDropTarget") + .css(borderStyle, "solid"); } }, @@ -159,6 +166,7 @@ .droppable($.organize.content_droppable); $(".gOrganizeMicroThumbGridCell") .draggable($.organize.micro_thumb_draggable) + .mouseleave($.organize.mouse_leave_handler) .mousemove($.organize.mouse_move_handler); $(".gOrganizeAlbum").droppable($.organize.branch_droppable); $(".gOrganizeAlbumText").click($.organize.show_album); |