summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BMO/web/js/edit_bug.js20
-rw-r--r--template/en/default/bug/navigate.html.tmpl14
2 files changed, 32 insertions, 2 deletions
diff --git a/extensions/BMO/web/js/edit_bug.js b/extensions/BMO/web/js/edit_bug.js
index 5fc2ab6f7..e630eb995 100644
--- a/extensions/BMO/web/js/edit_bug.js
+++ b/extensions/BMO/web/js/edit_bug.js
@@ -55,6 +55,26 @@ function bmo_show_tracking_flags() {
}
}
+function init_clone_bug_menu(el, bug_id, product, component) {
+ var diff_url = 'enter_bug.cgi?cloned_bug_id=' + bug_id;
+ var cur_url = diff_url +
+ '&product=' + encodeURIComponent(product) +
+ '&component=' + encodeURIComponent(component);
+ var menu = new YAHOO.widget.Menu('clone_bug_menu', { position : 'dynamic' });
+ menu.addItems([
+ { text: 'Clone to the current product', url: cur_url },
+ { text: 'Clone to a different product', url: diff_url }
+ ]);
+ menu.render(document.body);
+ YAHOO.util.Event.addListener(el, 'click', show_clone_bug_menu, menu);
+}
+
+function show_clone_bug_menu(event, menu) {
+ menu.cfg.setProperty('xy', YAHOO.util.Event.getXY(event));
+ menu.show();
+ event.preventDefault();
+}
+
// -- make attachment table, comments, new comment textarea equal widths
YAHOO.util.Event.onDOMReady(function() {
diff --git a/template/en/default/bug/navigate.html.tmpl b/template/en/default/bug/navigate.html.tmpl
index 46b92aec4..56150bec3 100644
--- a/template/en/default/bug/navigate.html.tmpl
+++ b/template/en/default/bug/navigate.html.tmpl
@@ -29,12 +29,22 @@
<li>&nbsp;-&nbsp;<a href="show_bug.cgi?ctype=xml&amp;id=
[% bug.bug_id FILTER uri %]">XML</a></li>
<li>&nbsp;-&nbsp;<a href="enter_bug.cgi?cloned_bug_id=
- [% bug.bug_id FILTER uri %]">Clone This
+ [% bug.bug_id FILTER uri %]"
+ id="clone_bug">Clone This
[% terms.Bug %]</a></li>
[%# Links to more things users can do with this bug. %]
[% Hook.process("links") %]
<li>&nbsp;-&nbsp;<a href="#">Top of page </a></li>
- </ul>
+ </ul>
+ <script type="text/javascript">
+ YAHOO.util.Event.onDOMReady(function() {
+ init_clone_bug_menu(
+ YAHOO.util.Dom.get('clone_bug'),
+ '[% bug.bug_id FILTER js %]',
+ '[% bug.product FILTER js %]',
+ '[% bug.component FILTER js %]');
+ });
+ </script>
[% END %]