Commit 138c15b1 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 375382: When viewing a bug, make obsolete attachments hidden by default

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
parent 6a10905a
...@@ -20,33 +20,32 @@ ...@@ -20,33 +20,32 @@
#%] #%]
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
function toggle_display(link) { function toggle_display(link) {
var table = document.getElementById("attachment_table"); var table = document.getElementById("attachment_table");
var rows = table.getElementsByTagName("tr"); // Store current height for scrolling later
var originalHeight = table.offsetHeight; // Store current height for scrolling var originalHeight = table.offsetHeight;
var rows = YAHOO.util.Dom.getElementsByClassName(
'bz_tr_obsolete', 'tr', table);
var toggle; for (var i = 0; i < rows.length; i++) {
if (link.innerHTML == "Show Obsolete") { bz_toggleClass(rows[i], 'bz_default_hidden');
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++) { if (YAHOO.util.Dom.hasClass(rows[0], 'bz_default_hidden')) {
if (rows[i].className.match('bz_tr_obsolete')) link.innerHTML = "Show Obsolete";
rows[i].style.display = toggle; }
else {
link.innerHTML = "Hide Obsolete";
} }
var newHeight = table.offsetHeight; var newHeight = table.offsetHeight;
// This scrolling makes the window appear to not move at all.
window.scrollBy(0, newHeight - originalHeight); window.scrollBy(0, newHeight - originalHeight);
return false; return false;
} }
//--> //-->
</script> </script>
<br> <br>
...@@ -66,8 +65,9 @@ ...@@ -66,8 +65,9 @@
[% IF attachment.isobsolete %] [% IF attachment.isobsolete %]
[% obsolete_attachments = obsolete_attachments + 1 %] [% obsolete_attachments = obsolete_attachments + 1 %]
[% END %] [% END %]
<tr class="[% "bz_private" IF attachment.isprivate %][%-%] <tr class="[% "bz_private" IF attachment.isprivate %]
[%+ "bz_tr_obsolete" IF attachment.isobsolete %]"> [% " bz_tr_obsolete bz_default_hidden"
IF attachment.isobsolete %]">
<td valign="top"> <td valign="top">
[% IF attachment.datasize %] [% IF attachment.datasize %]
<a name="a[% count %]" href="attachment.cgi?id=[% attachment.id %]" <a name="a[% count %]" href="attachment.cgi?id=[% attachment.id %]"
...@@ -131,7 +131,8 @@ ...@@ -131,7 +131,8 @@
[% IF attachments.size %] [% IF attachments.size %]
<span class="bz_attach_view_hide"> <span class="bz_attach_view_hide">
[% IF obsolete_attachments %] [% 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 %] [% END %]
[% IF Param("allow_attachment_display") %] [% IF Param("allow_attachment_display") %]
<a href="attachment.cgi?bugid=[% bugid %]&amp;action=viewall">View All</a> <a href="attachment.cgi?bugid=[% bugid %]&amp;action=viewall">View All</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment