summaryrefslogtreecommitdiffstats
path: root/template/en
diff options
context:
space:
mode:
authorkiko%async.com.br <>2004-03-17 08:06:03 +0100
committerkiko%async.com.br <>2004-03-17 08:06:03 +0100
commitcf625452006197c765e3833e78798591291630f3 (patch)
tree70ac84c32582c83754788d243dff4403e2796dc4 /template/en
parent50fcc7a0f0436557fe21ac576d011d6a300eeaa5 (diff)
downloadbugzilla-cf625452006197c765e3833e78798591291630f3.tar.gz
bugzilla-cf625452006197c765e3833e78798591291630f3.tar.xz
Fix for bug 236424: Allow showdependencies trees to collapse. Adds
[optional] Javascript-enabled +/- controls that allow branches in the dependency tree to collapse. Patch by Mike Shaver <shaver@mozilla.org>, minor cleanups by me, r=myk, kiko, a=justdave.
Diffstat (limited to 'template/en')
-rw-r--r--template/en/default/bug/dependency-tree.html.tmpl37
1 files changed, 37 insertions, 0 deletions
diff --git a/template/en/default/bug/dependency-tree.html.tmpl b/template/en/default/bug/dependency-tree.html.tmpl
index 7d32c8acc..b0da74a17 100644
--- a/template/en/default/bug/dependency-tree.html.tmpl
+++ b/template/en/default/bug/dependency-tree.html.tmpl
@@ -90,6 +90,8 @@
[% FOREACH dep_id = tree.$bug_id.dependencies %]
[% dep = tree.$dep_id %]
<li>
+ [% "<script>document.write('<a href=\"#\" class=\"toggle\" onclick=\"listToggle(event); return false\">[-]</a>')</script>"
+ IF dep.dependencies.size > 0 && !dep.seen %]
[% "<strike>" IF !dep.open %]
<a href="show_bug.cgi?id=[% dep_id %]">[% dep_id %]
[[% IF dep.milestone %][% dep.milestone FILTER html %], [% END %]
@@ -111,6 +113,40 @@
[%# Block for depth control toolbar #%]
[%###########################################################################%]
+ <script type="text/javascript" language="JavaScript">
+if (!Node) {
+ /* MSIE doesn't define Node, so provide a compatibility array */
+ var Node = { TEXT_NODE: 3, };
+}
+
+function toggleDisplay(node)
+{
+ var display = node.style.display;
+ if (display == "none") {
+ node.style.display =
+ ("oldDisplay" in node) ? node.oldDisplay : "block";
+ return true;
+ }
+
+ node.oldDisplay = display;
+ node.style.display = "none";
+ return false;
+}
+
+function listToggle(event)
+{
+ var node = event.target;
+ if (node.nodeType == Node.TEXT_NODE)
+ node = node.parentNode;
+ var toggle = node.nextSibling;
+ while (toggle && toggle.tagName != "UL")
+ toggle = toggle.nextSibling;
+ if (toggle) {
+ node.firstChild.data = toggleDisplay(toggle) ? "[-]" : "[+]";
+ }
+}
+
+ </script>
[% BLOCK depthControlToolbar %]
<table cellpadding="3" border="0" cellspacing="0" bgcolor="#d0d0d0">
<tr>
@@ -209,4 +245,5 @@
</td>
</tr>
</table>
+
[% END %]