Files
gallery3/modules/organize/js/organize.js
Bharat Mediratta a245c57400 Further streamline the code.
Organize_Controller:
* Remove unnecessary constants
* Rename index() to dialog()
* Simplify _get_micro_thumb_grid

organize.js:
* Move sizing code in here from organize_dialog.html.php

organize_dialog.html.php:
* Move CSS and JS links in here so that we only load them when we need them.
* Move sizing code into organize.js

organize_thumb_grid.html.php:
* Move pagination logic in here, since it's view centric
* Collapse the css class determination code and inline it
2009-08-06 21:52:23 -07:00

55 lines
1.8 KiB
JavaScript

(function($) {
$.organize = {
/**
* Dynamically initialize the organize dialog when it is displayed
*/
init: function(data) {
// Resize with 50 pixels padding all around
var size = $.getViewportSize();
$("#gDialog").dialog("option", "height", size.height() - 100)
.dialog("option", "width", size.width() - 100)
.dialog("option", "position", "center");
// Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 (target 1.8?)
$(".sf-menu li.sfHover ul").css("z-index", 70);
var height = $("#gOrganizeDetail").innerHeight();
$("#gMicroThumbPanel").height(height - $("#gOrganizeEditDrawerHandle").outerHeight());
$("#gDialog #gMicroThumbDone").click(function(event) {
$("#gDialog").dialog("close");
window.location.reload();
});
$(".gBranchText span").click($.organize.collapse_or_expand_tree);
$(".gBranchText").click($.organize.show_album);
},
/**
* Open or close a branch.
*/
collapse_or_expand_tree: function(event) {
event.stopPropagation();
$(event.currentTarget).toggleClass("ui-icon-minus").toggleClass("ui-icon-plus");
$("#gOrganizeChildren-" + $(event.currentTarget).attr("ref")).toggle();
},
/**
* When the text of a selection is clicked, then show that albums contents
*/
show_album: function(event) {
event.preventDefault();
if ($(event.currentTarget).hasClass("gBranchSelected")) {
return;
}
var id = $(event.currentTarget).attr("ref");
$(".gBranchSelected").removeClass("gBranchSelected");
$("#gOrganizeBranch-" + id).addClass("gBranchSelected");
var url = $("#gMicroThumbPanel").attr("ref").replace("__ITEM_ID__", id).replace("__OFFSET__", 0);
$.get(url, function(data) {
$("#gMicroThumbGrid").html(data);
});
}
};
})(jQuery);