From 06242167fc94c0b43ba497510d46477339b91267 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 4 Feb 2015 15:50:59 +0000 Subject: Bug 1128969: 'Clone this bug' redirects to product selection instead of displaying context menu --- extensions/BMO/web/js/edit_bug.js | 42 +++++++++++++++++------------- template/en/default/bug/navigate.html.tmpl | 19 +++++--------- 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
  •  - XML
  • -
  •  - Clone This - [% terms.Bug %]
  • +
  •  -  + + Clone This [% terms.Bug %] +
  • [%# Links to more things users can do with this bug. %] [% Hook.process("links") %]
  •  - Top of page
  • - [% END %] [% SET my_search = user.recent_search_for(bug) %] -- cgit v1.2.3-24-g4f1b