From d7c7a06efe0171f65c120a8cf8fe7b41382d36c9 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 6 Aug 2009 09:46:39 -0700 Subject: Remove the complicated calculation to determine the height of the micro thumb grid, by setting all the parent elements to 100% in the css and then subtract the height of the button bar --- modules/organize/js/organize.js | 43 ++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'modules/organize/js') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 89549954..6a65bfa2 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -1,54 +1,45 @@ (function($) { - $.fn.organize = function(options) { + $.fn.organize = function() { var size = $.getViewportSize(); var height = size.height() - 100; // Leave 50 pixels on the top and bottom of the dialog var width = size.width() - 100; // Leave 50 pixels on the left and right of the dialog - var opts = $.extend({}, $.fn.organize.defaults, {width: width, height: height}, options); return this.each(function() { $(this).click(function(event) { var href = event.target.href; - var size = $.getViewportSize(); $("body").append('
'); - $("#gOrganizeDialog").dialog(opts); + $("#gOrganizeDialog").dialog({ + autoOpen: false, + modal: true, + resizable: false, + width: width, + height: height, + position: "center", + close: function () { + $("#gOrganizeDialog").trigger("organize_close"); + $("#gOrganizeDialog").dialog("destroy").remove(); + }, + zIndex: 75 + }); $.get(href, _init); return false; }); }); }; - $.fn.organize.defaults = { - autoOpen: false, - modal: true, - resizable: false, - minWidth: 600, - minHeight: 500, - position: "center", - close: function () { - $("#gOrganizeDialog").trigger("organize_close"); - $("#gOrganizeDialog").dialog("destroy").remove(); - }, - zIndex: 75 - }; - /** * Dynamically initialize the organize dialog when it is displayed */ function _init(data) { - // Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 + // Deal with ui.jquery bug: http://dev.jqueryui.com/ticket/4475 (target 1.8?) $(".sf-menu li.sfHover ul").css("z-index", 70); $("#gOrganizeDialog").html(data); $("#gOrganizeDialog").dialog("open"); - var heightMicroThumbPanel = $("#gOrganizeDialog").innerHeight(); - heightMicroThumbPanel -= 2 * parseFloat($("#gOrganizeDialog").css("padding-bottom")); - heightMicroThumbPanel = Math.floor(heightMicroThumbPanel - 10 - $("#gMessage").outerHeight()); - $("#gOrganizeTreeContainer").height(heightMicroThumbPanel); - - heightMicroThumbPanel -= $("#gOrganizeEditDrawerHandle").outerHeight(); - $("#gMicroThumbPanel").height(heightMicroThumbPanel); + var height = $("#gOrganizeDetail").innerHeight(); + $("#gMicroThumbPanel").height(height - $("#gOrganizeEditDrawerHandle").outerHeight()); if ($("#gOrganizeDialog h1").length) { $("#gOrganizeDialog").dialog('option', 'title', $("#gOrganizeDialog h1:eq(0)").html()); -- cgit v1.2.3 From 7ed15ea481565b1364573a814c0529adaf9f2eb7 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 6 Aug 2009 10:03:38 -0700 Subject: Remove 6 more lines by removing the generalization of the close dialog processing --- modules/organize/js/organize.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'modules/organize/js') diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 6a65bfa2..3e58f3f3 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -17,9 +17,9 @@ height: height, position: "center", close: function () { - $("#gOrganizeDialog").trigger("organize_close"); $("#gOrganizeDialog").dialog("destroy").remove(); - }, + document.location.reload(); + }, zIndex: 75 }); $.get(href, _init); @@ -47,20 +47,14 @@ $("#gOrganizeDialog").dialog('option', 'title', $("#gOrganizeDialog fieldset legend:eq(0)").html()); } - $("#gOrganizeDialog #gMicroThumbDone").click(_dialog_close); - $("#gOrganizeDialog").bind("organize_close", function(target) { - document.location.reload(); + $("#gOrganizeDialog #gMicroThumbDone").click(function(event) { + $("#gOrganizeDialog").dialog("close"); }); $(".gBranchText span").click(_collapse_or_expanded_tree); $(".gBranchText").click(_setContents); }; - function _dialog_close(event) { - event.preventDefault(); - $("#gOrganizeDialog").dialog("close"); - }; - /** * Open or close a branch. If the children is a div placeholder, replace with