diff --git a/django/contrib/admin/static/admin/js/collapse.js b/django/contrib/admin/static/admin/js/collapse.js
index 0a1e2d8893..5e4f04cc9d 100644
--- a/django/contrib/admin/static/admin/js/collapse.js
+++ b/django/contrib/admin/static/admin/js/collapse.js
@@ -3,9 +3,8 @@
// Add anchor tag for Show/Hide link
$("fieldset.collapse").each(function(i, elem) {
// Don't hide if fields in this fieldset have errors
- if ( $(elem).find("div.errors").length == 0 ) {
- $(elem).addClass("collapsed");
- $(elem).find("h2").first().append(' (' + gettext("Show") +
')');
}
@@ -13,13 +12,11 @@
// Add toggle to anchor tag
$("fieldset.collapse a.collapse-toggle").toggle(
function() { // Show
- $(this).text(gettext("Hide"));
- $(this).closest("fieldset").removeClass("collapsed");
+ $(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed");
return false;
},
function() { // Hide
- $(this).text(gettext("Show"));
- $(this).closest("fieldset").addClass("collapsed");
+ $(this).text(gettext("Show")).closest("fieldset").addClass("collapsed");
return false;
}
);
diff --git a/django/contrib/admin/static/admin/js/collapse.min.js b/django/contrib/admin/static/admin/js/collapse.min.js
index 428984ee01..c55ba339d0 100644
--- a/django/contrib/admin/static/admin/js/collapse.min.js
+++ b/django/contrib/admin/static/admin/js/collapse.min.js
@@ -1,2 +1,2 @@
-(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");a(b).find("h2").first().append(' ('+gettext("Show")+")")}});a("fieldset.collapse a.collapse-toggle").toggle(function(){a(this).text(gettext("Hide"));a(this).closest("fieldset").removeClass("collapsed");return false},function(){a(this).text(gettext("Show"));a(this).closest("fieldset").addClass("collapsed");
+(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(' ('+gettext("Show")+")")}});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");
return false})})})(django.jQuery);