summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-10-23 01:53:57 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-10-23 01:53:57 +0200
commit4b2ebcb3563b85180485c94eaf9a0ed9d8110f6f (patch)
tree4815ab9c3ceb8c75212fc0b8dada1f1e24b31ae9
parentac80bc26485a46b4f2dca7013830e89546fa8d3c (diff)
downloadbugzilla-4b2ebcb3563b85180485c94eaf9a0ed9d8110f6f.tar.gz
bugzilla-4b2ebcb3563b85180485c94eaf9a0ed9d8110f6f.tar.xz
Bug 473557: Make the "Collapse All Comments" link work properly even when
the "comment order" preference is set to "newest to oldest with description at top" r=mkanat, a=mkanat
-rw-r--r--js/comments.js10
-rw-r--r--template/en/default/bug/comments.html.tmpl4
2 files changed, 7 insertions, 7 deletions
diff --git a/js/comments.js b/js/comments.js
index 697cedd20..2f1a14406 100644
--- a/js/comments.js
+++ b/js/comments.js
@@ -44,18 +44,18 @@ function toggle_comment_display(link, comment_id) {
collapse_comment(link, comment);
}
-function toggle_all_comments(action, comments_size) {
- var num_comments = comments_size;
-
+function toggle_all_comments(action) {
// If for some given ID the comment doesn't exist, this doesn't mean
// there are no more comments, but that the comment is private and
// the user is not allowed to view it.
- for (var id = 0; id < num_comments; id++) {
- var comment = document.getElementById('comment_text_' + id);
+ var comments = YAHOO.util.Dom.getElementsByClassName('bz_comment_text');
+ for (var i = 0; i < comments.length; i++) {
+ var comment = comments[i];
if (!comment)
continue;
+ var id = comments[i].id.match(/\d*$/);
var link = document.getElementById('comment_link_' + id);
if (action == 'collapse')
collapse_comment(link, comment);
diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl
index 4f7795b12..580ba6b5e 100644
--- a/template/en/default/bug/comments.html.tmpl
+++ b/template/en/default/bug/comments.html.tmpl
@@ -82,9 +82,9 @@
<td>
[% IF mode == "edit" %]
<ul class="bz_collapse_expand_comments">
- <li><a href="#" onclick="toggle_all_comments('collapse', [% comments.size %]);
+ <li><a href="#" onclick="toggle_all_comments('collapse');
return false;">Collapse All Comments</a></li>
- <li><a href="#" onclick="toggle_all_comments('expand', [% comments.size %]);
+ <li><a href="#" onclick="toggle_all_comments('expand');
return false;">Expand All Comments</a></li>
[% IF user.settings.comment_box_position.value == "after_comments" && user.id %]
<li class="bz_add_comment"><a href="#"