summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2012-01-09 11:04:50 +0100
committerByron Jones <bjones@mozilla.com>2012-01-09 11:04:50 +0100
commitddf1fb2abb2a6266ce5a9cc525c84563c154df52 (patch)
tree9ae4b26eac29cda313a0423717b7d88bda848923
parent6761779ad5c9ed07ad6194a44a3c8f174797e866 (diff)
downloadbugzilla-ddf1fb2abb2a6266ce5a9cc525c84563c154df52.tar.gz
bugzilla-ddf1fb2abb2a6266ce5a9cc525c84563c154df52.tar.xz
Bug 685909: add "collapse tbpl comments"
-rw-r--r--extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl32
-rw-r--r--extensions/BMO/template/en/default/hook/bug/comments-comment_banner.html.tmpl6
-rw-r--r--extensions/BMO/template/en/default/hook/bug/comments-user.html.tmpl12
3 files changed, 50 insertions, 0 deletions
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
new file mode 100644
index 000000000..3a8913be3
--- /dev/null
+++ b/extensions/BMO/template/en/default/hook/bug/comments-aftercomments.html.tmpl
@@ -0,0 +1,32 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF has_tbpl_comment %]
+ <script>
+ YAHOO.util.Event.onDOMReady(function () {
+ var ul = document.getElementsByClassName('bz_collapse_expand_comments');
+ if (ul.length == 0)
+ return;
+ var li = document.createElement('li');
+ var a = document.createElement('a');
+ Dom.setAttribute(a, 'href', 'javascript:void(0)');
+ Dom.setAttribute(a, 'id', 'toggle_tbplbot_comments');
+ a.innerHTML = 'Collapse TinderboxPushlog Comments';
+ YAHOO.util.Event.on(a, 'click', function() {
+ 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);
+ }
+ });
+ li.appendChild(a);
+ ul[0].appendChild(li);
+ });
+ </script>
+[% END %]
diff --git a/extensions/BMO/template/en/default/hook/bug/comments-comment_banner.html.tmpl b/extensions/BMO/template/en/default/hook/bug/comments-comment_banner.html.tmpl
index fd5477c9f..2ae367456 100644
--- a/extensions/BMO/template/en/default/hook/bug/comments-comment_banner.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/comments-comment_banner.html.tmpl
@@ -5,3 +5,9 @@
subject to Attorney-Client Privilege and Work Product Doctrine.
</div>
[% END %]
+
+[%# Needed for collapsing TinderboxPushlog comments %]
+[% has_tbpl_comment = 0 %]
+<script>
+ var tbpl_comment_ids = new Array();
+</script>
diff --git a/extensions/BMO/template/en/default/hook/bug/comments-user.html.tmpl b/extensions/BMO/template/en/default/hook/bug/comments-user.html.tmpl
new file mode 100644
index 000000000..62b0c8c4a
--- /dev/null
+++ b/extensions/BMO/template/en/default/hook/bug/comments-user.html.tmpl
@@ -0,0 +1,12 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF comment.author.login_name == 'tbplbot@gmail.com' %]
+ [% has_tbpl_comment = 1 %]
+ <script>tbpl_comment_ids.push([% count FILTER none %]);</script>
+[% END %]