diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-08-29 16:33:22 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-08-29 16:33:22 -0700 |
commit | 483d8df91b443a20a614eb5864cabb2a66ac72d2 (patch) | |
tree | 385851fc3bfc080199e2e201b8aa2f56fd17f6b1 /modules/organize/js | |
parent | 0aceba6f48e5542d3edfbb1f195af50187adbac4 (diff) |
Change the organize tree to expand/collapse. It doesn't properly open
up to the album that you're viewing, and if you move a photo to a
different album it'll reload the entire album tree.
Diffstat (limited to 'modules/organize/js')
-rw-r--r-- | modules/organize/js/organize.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 04e14a2f..3dbd0c89 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -159,8 +159,34 @@ $(".gMicroThumbGridCell").mousemove($.organize.mouse_move_handler); $(".gOrganizeAlbum").droppable($.organize.branch_droppable); $(".gAlbumText").click($.organize.show_album); + $("#gOrganizeAlbumTree .ui-icon-plus,#gOrganizeAlbumTree .ui-icon-minus").click($.organize.toggle_branch); }, + toggle_branch: function(event) { + event.preventDefault(); + var target = $(event.currentTarget); + var branch = $(target).parent(); + var id = $(event.currentTarget).parent().attr("ref"); + + if ($(target).hasClass("ui-icon-plus")) { + // Expanding + if (!branch.find("ul").length) { + $.get(tree_url.replace("__ALBUM_ID__", id), { }, + function(data) { + branch.replaceWith(data); + $.organize.set_handlers(); + } + ); + } else { + branch.find("ul:eq(0)").slideDown(); + } + } else { + // Contracting + branch.find("ul:eq(0)").slideUp(); + } + $(target).toggleClass("ui-icon-plus"); + $(target).toggleClass("ui-icon-minus"); + }, /** * When the text of a selection is clicked, then show that albums contents |