summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-02-04 16:50:59 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-02-04 16:50:59 +0100
commit06242167fc94c0b43ba497510d46477339b91267 (patch)
tree3739d02430f7994b1b07947ac8d1f1e9c6122d1c
parent95aac54ca88a8d7f5df3ae1b62db810e33897e86 (diff)
downloadbugzilla-06242167fc94c0b43ba497510d46477339b91267.tar.gz
bugzilla-06242167fc94c0b43ba497510d46477339b91267.tar.xz
Bug 1128969: 'Clone this bug' redirects to product selection instead of displaying context menu
-rw-r--r--extensions/BMO/web/js/edit_bug.js42
-rw-r--r--template/en/default/bug/navigate.html.tmpl19
2 files changed, 30 insertions, 31 deletions
diff --git a/extensions/BMO/web/js/edit_bug.js b/extensions/BMO/web/js/edit_bug.js
index 41a71935e..87cbbba21 100644
--- a/extensions/BMO/web/js/edit_bug.js
+++ b/extensions/BMO/web/js/edit_bug.js
@@ -5,24 +5,30 @@
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0. */
-function init_clone_bug_menu(el, bug_id, product, component) {
- var diff_url = 'enter_bug.cgi?format=__default__&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();
+function show_clone_menu(el, bug_id, product, component) {
+ var base_url = 'enter_bug.cgi?format=__default__&cloned_bug_id=' + bug_id;
+ var items = {
+ curr_prod : {
+ name: 'Clone to the current product',
+ callback: function () {
+ var curr_url = base_url +
+ '&product=' + encodeURIComponent(product) +
+ '&component=' + encodeURIComponent(component);
+ window.open(curr_url, '_blank');
+ }
+ },
+ diff_prod: {
+ name: 'Clone to a new product',
+ callback: function () {
+ window.open(base_url, '_blank');
+ }
+ }
+ };
+ $.contextMenu({
+ selector: '#' + el.id,
+ trigger: 'left',
+ items: items
+ });
}
// -- make attachment table, comments, new comment textarea equal widths
diff --git a/template/en/default/bug/navigate.html.tmpl b/template/en/default/bug/navigate.html.tmpl
index 95fe5a411..8d7f8df12 100644
--- a/template/en/default/bug/navigate.html.tmpl
+++ b/template/en/default/bug/navigate.html.tmpl
@@ -28,23 +28,16 @@
[% bug.bug_id FILTER uri %]">Format For Printing</a></li>
<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?format=__default__&amp;cloned_bug_id=
- [% bug.bug_id FILTER uri %]"
- id="clone_bug">Clone This
- [% terms.Bug %]</a></li>
+ <li>&nbsp;-&nbsp;
+ <a href="enter_bug.cgi?format=__default__&amp;cloned_bug_id=[% bug.bug_id FILTER uri %]"
+ id="clone_bug"
+ onclick="return show_clone_menu(this, '[% bug.id FILTER js %]', '[% bug.product FILTER js %]', '[% bug.component FILTER js %]');">
+ 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>
- <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 %]
[% SET my_search = user.recent_search_for(bug) %]