Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #17218 -- Fixed bug with SelectFilter where the 'to' box had a …

…height=0 when it was within a collapsed fieldset. Thanks jimallman

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17181 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cfb7e477d38d76ef33883d56d69e7c5b8eba6de4 1 parent 5c1c1a1
Adrian Holovaty authored December 09, 2011
10  django/contrib/admin/static/admin/js/SelectFilter2.js
@@ -97,7 +97,15 @@ window.SelectFilter = {
97 97
 
98 98
         if (!is_stacked) {
99 99
             // In horizontal mode, give the same height to the two boxes.
100  
-            $(to_box).height($(filter_p).outerHeight() + $(from_box).outerHeight());
  100
+            var j_from_box = $(from_box);
  101
+            var j_to_box = $(to_box);
  102
+            var resize_filters = function() { j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight()); }
  103
+            if (j_from_box.outerHeight() > 0) {
  104
+                resize_filters(); // This fieldset is already open. Resize now.
  105
+            } else {
  106
+                // This fieldset is probably collapsed. Wait for its 'show' event.
  107
+                j_to_box.closest('fieldset').one('show.fieldset', resize_filters);
  108
+            }
101 109
         }
102 110
 
103 111
         // Initial icon refresh
4  django/contrib/admin/static/admin/js/collapse.js
@@ -12,11 +12,11 @@
12 12
 		// Add toggle to anchor tag
13 13
 		$("fieldset.collapse a.collapse-toggle").toggle(
14 14
 			function() { // Show
15  
-				$(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed");
  15
+				$(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]);
16 16
 				return false;
17 17
 			},
18 18
 			function() { // Hide
19  
-				$(this).text(gettext("Show")).closest("fieldset").addClass("collapsed");
  19
+				$(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]);
20 20
 				return false;
21 21
 			}
22 22
 		);
4  django/contrib/admin/static/admin/js/collapse.min.js
... ...
@@ -1,2 +1,2 @@
1  
-(function(a){a(document).ready(function(){a("fieldset.collapse").each(function(c,b){if(a(b).find("div.errors").length==0){a(b).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser'+c+'" class="collapse-toggle" href="#">'+gettext("Show")+"</a>)")}});a("fieldset.collapse a.collapse-toggle").toggle(function(){a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed");return false},function(){a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed");
2  
-return false})})})(django.jQuery);
  1
+(function(a){a(document).ready(function(){a("fieldset.collapse").each(function(c,b){0==a(b).find("div.errors").length&&a(b).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser'+c+'" class="collapse-toggle" href="#">'+gettext("Show")+"</a>)")});a("fieldset.collapse a.collapse-toggle").toggle(function(){a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset",[a(this).attr("id")]);return!1},function(){a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset",
  2
+[a(this).attr("id")]);return!1})})})(django.jQuery);

0 notes on commit cfb7e47

Please sign in to comment.
Something went wrong with that request. Please try again.