summaryrefslogtreecommitdiffstats
path: root/template/en/default
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-02-11 21:30:32 +0100
committermkanat%bugzilla.org <>2009-02-11 21:30:32 +0100
commit138c15b19a7f49667c012829cc0311abdbdfb0c0 (patch)
tree107b284799950dec5e93e1107a5f8eb7a8ac2994 /template/en/default
parent6a10905af0af5b3436a344cf9181d29fcea4083a (diff)
downloadbugzilla-138c15b19a7f49667c012829cc0311abdbdfb0c0.tar.gz
bugzilla-138c15b19a7f49667c012829cc0311abdbdfb0c0.tar.xz
Bug 375382: When viewing a bug, make obsolete attachments hidden by default
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'template/en/default')
-rw-r--r--template/en/default/attachment/list.html.tmpl41
1 files changed, 21 insertions, 20 deletions
diff --git a/template/en/default/attachment/list.html.tmpl b/template/en/default/attachment/list.html.tmpl
index 08c575dbf..04894ff8d 100644
--- a/template/en/default/attachment/list.html.tmpl
+++ b/template/en/default/attachment/list.html.tmpl
@@ -20,33 +20,32 @@
#%]
<script type="text/javascript">
- <!--
- function toggle_display(link) {
+<!--
+function toggle_display(link) {
var table = document.getElementById("attachment_table");
- var rows = table.getElementsByTagName("tr");
- var originalHeight = table.offsetHeight; // Store current height for scrolling
+ // Store current height for scrolling later
+ var originalHeight = table.offsetHeight;
+ var rows = YAHOO.util.Dom.getElementsByClassName(
+ 'bz_tr_obsolete', 'tr', table);
- var toggle;
- if (link.innerHTML == "Show Obsolete") {
- toggle = ""; // This should be 'table-row', but IE 6 doesn't understand it.
- link.innerHTML = "Hide Obsolete";
- }
- else {
- toggle = "none";
- link.innerHTML = "Show Obsolete";
+ for (var i = 0; i < rows.length; i++) {
+ bz_toggleClass(rows[i], 'bz_default_hidden');
}
- for (var i = 0; i < rows.length; i++) {
- if (rows[i].className.match('bz_tr_obsolete'))
- rows[i].style.display = toggle;
+ if (YAHOO.util.Dom.hasClass(rows[0], 'bz_default_hidden')) {
+ link.innerHTML = "Show Obsolete";
+ }
+ else {
+ link.innerHTML = "Hide Obsolete";
}
var newHeight = table.offsetHeight;
+ // This scrolling makes the window appear to not move at all.
window.scrollBy(0, newHeight - originalHeight);
return false;
- }
- //-->
+}
+//-->
</script>
<br>
@@ -66,8 +65,9 @@
[% IF attachment.isobsolete %]
[% obsolete_attachments = obsolete_attachments + 1 %]
[% END %]
- <tr class="[% "bz_private" IF attachment.isprivate %][%-%]
- [%+ "bz_tr_obsolete" IF attachment.isobsolete %]">
+ <tr class="[% "bz_private" IF attachment.isprivate %]
+ [% " bz_tr_obsolete bz_default_hidden"
+ IF attachment.isobsolete %]">
<td valign="top">
[% IF attachment.datasize %]
<a name="a[% count %]" href="attachment.cgi?id=[% attachment.id %]"
@@ -131,7 +131,8 @@
[% IF attachments.size %]
<span class="bz_attach_view_hide">
[% IF obsolete_attachments %]
- <a href="#a0" onClick="return toggle_display(this);">Hide Obsolete</a> ([% obsolete_attachments %])
+ <a href="#a0" onclick="return toggle_display(this);">Show
+ Obsolete</a> ([% obsolete_attachments %])
[% END %]
[% IF Param("allow_attachment_display") %]
<a href="attachment.cgi?bugid=[% bugid %]&amp;action=viewall">View All</a>