Closed Bug 375382 Opened 18 years ago Closed 16 years ago

When viewing a bug, obsolete attachments should be hidden by default

Categories

(Bugzilla :: Attachments & Requests, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Bugzilla 3.4

People

(Reporter: LpSolit, Assigned: mkanat)

References

Details

Attachments

(1 file, 5 obsolete files)

Now that we can show/hide obsolete attachments, it would be fine if obsolete attachments were hidden by default. Probably a trivial hack to do in template/en/default/attachment/list.html.tmpl.
Even better would be a user preference for it--I may have filed that already, somewhere, but I'm not sure.
Attached patch patch, v1 (obsolete) — Splinter Review
Assignee: attach-and-request → LpSolit
Status: NEW → ASSIGNED
Attachment #265853 - Flags: review?(myk)
Comment on attachment 265853 [details] [diff] [review] patch, v1 >Index: skins/standard/global.css >+.bz_attach_obsolete_hide { >+ display: none; >+} >+ >+.bz_attach_obsolete_show { >+ display: table-row; >+} You don't need both of these, you just need to add bz_attach_obsolete_hide to the element being hidden and then remove that class when you want it to appear again. Also, I think it'd be better to have a more generic bz_hidden class that you can use in other situations as well. >Index: template/en/default/attachment/list.html.tmpl > for (var i = 0; i < rows.length; i++) { >- if (rows[i].className.match('bz_tr_obsolete')) >- rows[i].style.display = toggle; >+ if (rows[i].className.match('bz_attach_obsolete_show')) >+ rows[i].className = 'bz_attach_obsolete_hide'; >+ else if (rows[i].className.match('bz_attach_obsolete_hide')) >+ rows[i].className = 'bz_attach_obsolete_show'; The class attribute holds a space-separated list of values, and Bugzilla code sometimes sets the bz_private class. But this code wipes out the bz_private class, if present, when the user clicks the Show or Hide Obsolete button. Instead of setting the value of className to a specific string, split it into an array, add or remove the appropriate class, and then join the array back into a string, i.e.: for (var i = 0; i < rows.length; i++) { var classes = rows[i].className.split(/\s+/); if (classes.indexOf("bz_hidden") != -1) classes.splice(classes.indexOf("bz_hidden"), 1); else classes.push("bz_hidden"); rows[i].className = classes.join(" "); }
Attachment #265853 - Flags: review?(myk) → review-
Bugzilla 3.2 is now frozen. Only enhancements blocking 3.2 or specifically approved for 3.2 may be checked in to the 3.2 branch. If you would like to nominate your enhancement for Bugzilla 3.2, set "blocking3.2" tp "?", and either the target milestone will be changed back, or the blocking3.2 flag will be granted, if we will accept this enhancement for Bugzilla 3.2.
Target Milestone: Bugzilla 3.2 → Bugzilla 4.0
I would really like to see this happen.
Priority: -- → P1
Attached patch dynamic style (obsolete) — Splinter Review
this doesn't actually fix the bug, but it stops setting a classthat shouldn't exist. it'd be fairly trivial to add a preference which would then merely fix up a few other lines....
I've decided against the user preference, by the way. I just want them hidden by default, I think that's sensible for everybody.
Attached patch dynamic style (obsolete) — Splinter Review
this should do the right thing, i need a bugzilla to test
Attachment #347321 - Attachment is obsolete: true
Attachment #347528 - Flags: review?
Assignee: LpSolit → attach-and-request
Assignee: attach-and-request → LpSolit
Assignee: LpSolit → mkanat
Attached patch v3 (obsolete) — Splinter Review
Okay, here's a very simple patch that does this.
Attachment #265853 - Attachment is obsolete: true
Attachment #347528 - Attachment is obsolete: true
Attachment #359534 - Flags: review?(LpSolit)
Attachment #347528 - Flags: review?
Attachment #359534 - Flags: review?(LpSolit) → review?(guy.pyrzak)
Target Milestone: Bugzilla 4.0 → Bugzilla 3.4
Attachment #359534 - Flags: review?(guy.pyrzak)
Attachment #359534 - Flags: review?(LpSolit)
Attachment #359534 - Flags: review+
Comment on attachment 359534 [details] [diff] [review] v3 tested on IE and firefox and it works. Code looks fine to me as well
Hunk #3 FAILED at 132. 1 out of 3 hunks FAILED -- saving rejects to file template/en/default/attachment/list.html.tmpl.rej Could I have an updated patch to test?
Note also that the JS code is already in bug 376673. You're going to conflict.
Attached patch v4 (obsolete) — Splinter Review
Okay, here you go.
Attachment #359534 - Attachment is obsolete: true
Attachment #361805 - Flags: review?(LpSolit)
Attachment #359534 - Flags: review?(LpSolit)
Comment on attachment 361805 [details] [diff] [review] v4 When I click "show obsolete", hidden attachments are displayed but the link remains the same. If I click it again, obsolete attachments are hidden and the link changes to "hide obsolete" despite they are already hidden (and vice versa)
Attachment #361805 - Flags: review?(LpSolit) → review-
Attached patch v5Splinter Review
Okay, here's a fix for it that's much better than checking the innerHTML (the problem was that there was now a newline and lots of spaces inside the <a>).
Attachment #361805 - Attachment is obsolete: true
Attachment #361813 - Flags: review?(dkl)
Attachment #361813 - Flags: review?(dkl) → review?(LpSolit)
Comment on attachment 361813 [details] [diff] [review] v5 > [% 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> > [% END %] Please revert this change. I removed "|" on purpose while fixing one of the security bugs. If a bug has no obsolete attachment, this bar is displayed despite there is no text on its left, which is not nice. And the UI is fine without it in all cases. Tested successfully with Fx3.1b2, Opera 9.63 and IE 6 SP1. r=LpSolit (I wonder how much time will elapse before someone requests the show/hide status to be stored in a cookie.)
Attachment #361813 - Flags: review?(LpSolit) → review+
Flags: approval+
Okay, I did the checkin fix. Checking in template/en/default/attachment/list.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/attachment/list.html.tmpl,v <-- list.html.tmpl new revision: 1.41; previous revision: 1.40 done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: relnote
Resolution: --- → FIXED
Added to the release notes for Bugzilla 3.4 in bug 494037.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: