From 483d8df91b443a20a614eb5864cabb2a66ac72d2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 29 Aug 2009 16:33:22 -0700 Subject: 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. --- modules/organize/js/organize.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'modules/organize/js/organize.js') 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 -- cgit v1.2.3