Changed admin/js/collapse.js to take advantage of jQuery chaining in three places. Should make for a slight performance boost.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ce247476af
commit
5c1c1a1254
|
@ -4,8 +4,7 @@
|
||||||
$("fieldset.collapse").each(function(i, elem) {
|
$("fieldset.collapse").each(function(i, elem) {
|
||||||
// Don't hide if fields in this fieldset have errors
|
// Don't hide if fields in this fieldset have errors
|
||||||
if ($(elem).find("div.errors").length == 0) {
|
if ($(elem).find("div.errors").length == 0) {
|
||||||
$(elem).addClass("collapsed");
|
$(elem).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser' +
|
||||||
$(elem).find("h2").first().append(' (<a id="fieldsetcollapser' +
|
|
||||||
i +'" class="collapse-toggle" href="#">' + gettext("Show") +
|
i +'" class="collapse-toggle" href="#">' + gettext("Show") +
|
||||||
'</a>)');
|
'</a>)');
|
||||||
}
|
}
|
||||||
|
@ -13,13 +12,11 @@
|
||||||
// Add toggle to anchor tag
|
// Add toggle to anchor tag
|
||||||
$("fieldset.collapse a.collapse-toggle").toggle(
|
$("fieldset.collapse a.collapse-toggle").toggle(
|
||||||
function() { // Show
|
function() { // Show
|
||||||
$(this).text(gettext("Hide"));
|
$(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed");
|
||||||
$(this).closest("fieldset").removeClass("collapsed");
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
function() { // Hide
|
function() { // Hide
|
||||||
$(this).text(gettext("Show"));
|
$(this).text(gettext("Show")).closest("fieldset").addClass("collapsed");
|
||||||
$(this).closest("fieldset").addClass("collapsed");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -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(' (<a id="fieldsetcollapser'+c+'" class="collapse-toggle" href="#">'+gettext("Show")+"</a>)")}});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(' (<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");
|
||||||
return false})})})(django.jQuery);
|
return false})})})(django.jQuery);
|
||||||
|
|
Loading…
Reference in New Issue