summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-05-01 14:21:56 +0200
committerByron Jones <bjones@mozilla.com>2012-05-01 14:21:56 +0200
commit228c7bf9ea03a5faafe22f003e5d56da1b7b2162 (patch)
treed6e510fb195a9a197739e8b6996244bd65b14ea2 /extensions
parent136caf50f2569b380879cc68d3dc10142c8e4f84 (diff)
downloadbugzilla-228c7bf9ea03a5faafe22f003e5d56da1b7b2162.tar.gz
bugzilla-228c7bf9ea03a5faafe22f003e5d56da1b7b2162.tar.xz
Bug 748629: collapse tbplbot comments by default
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BMO/template/en/default/hook/bug/comments-a_comment-end.html.tmpl (renamed from extensions/BMO/template/en/default/hook/bug/comments-user.html.tmpl)11
-rw-r--r--extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl14
2 files changed, 21 insertions, 4 deletions
diff --git a/extensions/BMO/template/en/default/hook/bug/comments-user.html.tmpl b/extensions/BMO/template/en/default/hook/bug/comments-a_comment-end.html.tmpl
index 62b0c8c4a..caf7acca7 100644
--- a/extensions/BMO/template/en/default/hook/bug/comments-user.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/comments-a_comment-end.html.tmpl
@@ -6,7 +6,14 @@
# defined by the Mozilla Public License, v. 2.0.
#%]
-[% IF comment.author.login_name == 'tbplbot@gmail.com' %]
+[% IF user.id && comment.author.login_name == 'tbplbot@gmail.com' %]
[% has_tbpl_comment = 1 %]
- <script>tbpl_comment_ids.push([% count FILTER none %]);</script>
+ <script>
+ var id = [% count FILTER none %];
+ tbpl_comment_ids.push(id);
+ collapse_comment(
+ document.getElementById('comment_link_' + id),
+ document.getElementById('comment_text_' + id)
+ );
+ </script>
[% END %]
diff --git a/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl b/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl
index 3a8913be3..d8dc5bba0 100644
--- a/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl
@@ -7,6 +7,8 @@
#%]
[% IF has_tbpl_comment %]
+ [% expand_caption = 'Expand TinderboxPushlog Comments' %]
+ [% collapse_caption = 'Collapse TinderboxPushlog Comments' %]
<script>
YAHOO.util.Event.onDOMReady(function () {
var ul = document.getElementsByClassName('bz_collapse_expand_comments');
@@ -16,14 +18,22 @@
var a = document.createElement('a');
Dom.setAttribute(a, 'href', 'javascript:void(0)');
Dom.setAttribute(a, 'id', 'toggle_tbplbot_comments');
- a.innerHTML = 'Collapse TinderboxPushlog Comments';
+ a.innerHTML = '[% expand_caption FILTER js %]';
YAHOO.util.Event.on(a, 'click', function() {
+ var do_expand = a.innerHTML == '[% expand_caption FILTER js %]';
for (var i = 0, n = tbpl_comment_ids.length; i < n; i++) {
var id = tbpl_comment_ids[i];
var link = document.getElementById('comment_link_' + id);
var text = document.getElementById('comment_text_' + id);
- collapse_comment(link, text);
+ if (do_expand) {
+ expand_comment(link, text);
+ } else {
+ collapse_comment(link, text);
+ }
}
+ a.innerHTML = do_expand
+ ? '[% collapse_caption FILTER js %]'
+ : '[% expand_caption FILTER js %]';
});
li.appendChild(a);
ul[0].appendChild(li);