diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-06 20:27:49 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-06 20:27:49 +0000 |
commit | a8879cfe89fca4e0fe20e19bb6e4551a08910487 (patch) | |
tree | 5258da106991d501e43dc245cd9ca5834b8b042a | |
parent | 2991831c035a944712f2d906fbb4d99c7e93e02f (diff) |
1) Improved selection processing.
2) Drawer closes if no images or albums are selected
-rw-r--r-- | modules/organize/js/organize.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 3b1a2cb6..9bfa7111 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -141,24 +141,20 @@ var treeDroppable = { var selectable = { filter: ".gMicroThumbContainer", selected: function(event, ui) { - $(ui.selected).addClass("gSelecting"); setDrawerButtonState(); }, unselected: function(event, ui) { setDrawerButtonState(); - }, - stop: function(event) { } }; // ************************************************************************** // Event Handlers -// MicroThumbContainer click -var onMicroThumbContainerClick = function(event) { - if (!$(this).hasClass("gSelecting") && $(this).hasClass("ui-selected")) { - $(this).removeClass("ui-selected"); - } - $(this).removeClass("gSelecting"); +// MicroThumbContainer mouseup +var onMicroThumbContainerMouseup = function(event) { + // For simplicity always remove the ui-selected class. If it was unselected + // it will get added back + $(this).removeClass("ui-selected"); setDrawerButtonState(); }; @@ -232,7 +228,7 @@ var getMicroThumbsCallback = function(json, textStatus) { if (json.count > 0) { $("#gMicroThumbGrid").append(json.data); retrieveMicroThumbs(); - $(".gMicroThumbContainer").click(onMicroThumbContainerClick); + $(".gMicroThumbContainer").mouseup(onMicroThumbContainerMouseup); $(".gMicroThumbContainer").mousemove(onMicroThumbContainerMousemove); $(".gMicroThumbContainer").draggable(draggable); } @@ -338,7 +334,7 @@ function organize_dialog_init() { //showLoading("#gDialog"); $("#gMicroThumbPanel").droppable(thumbDroppable); - $("#gMicroThumbGrid").selectable(selectable); + $("#gMicroThumbPanel").selectable(selectable); $("#gOrganizeEditDrawerHandle a").click(drawerHandleButtonsClick); } @@ -398,6 +394,9 @@ function get_url(uri, parms) { function setDrawerButtonState() { switch ($("#gMicroThumbGrid li.ui-selected").length) { case 0: + if ($("#gOrganizeEditDrawerPanel::visible").length) { + $("#gOrganizeEditHandleButtonsLeft a[ref='edit']").trigger("click"); + } $("#gOrganizeEditHandleButtonsLeft a").attr("disabled", true); $("#gOrganizeEditHandleButtonsLeft a").addClass("ui-state-disabled"); break; |