From 64fe3a7a9e088b53fbd62066fad372ce9ac15c4e Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 18 Jul 2012 21:51:12 +0800 Subject: Bug 775068: product chooser breaks bug cloning --- .../template/en/default/global/prod-comp-search.html.tmpl | 5 ++++- extensions/BMO/web/js/prod_comp_search.js | 13 ++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/extensions/BMO/template/en/default/global/prod-comp-search.html.tmpl b/extensions/BMO/template/en/default/global/prod-comp-search.html.tmpl index 9e5e4da17..2f1d67bec 100644 --- a/extensions/BMO/template/en/default/global/prod-comp-search.html.tmpl +++ b/extensions/BMO/template/en/default/global/prod-comp-search.html.tmpl @@ -22,7 +22,10 @@ && YAHOO.bugzilla.prodCompSearch != null) { YAHOO.bugzilla.prodCompSearch.init( - "prod_comp_search", "prod_comp_search_autocomplete_container", "[% format FILTER js %]"); + "prod_comp_search", + "prod_comp_search_autocomplete_container", + "[% format FILTER js %]", + "[% cloned_bug_id FILTER js %]"); [% IF target == "describecomponents.cgi" %] YAHOO.bugzilla.prodCompSearch.autoComplete.itemSelectEvent.subscribe(function (e, args) { var oData = args[2]; diff --git a/extensions/BMO/web/js/prod_comp_search.js b/extensions/BMO/web/js/prod_comp_search.js index c01b3c17f..ada296f52 100644 --- a/extensions/BMO/web/js/prod_comp_search.js +++ b/extensions/BMO/web/js/prod_comp_search.js @@ -9,6 +9,7 @@ YAHOO.bugzilla.prodCompSearch = { counter : 0, format : '', + cloned_bug_id : '', dataSource : null, autoComplete: null, generateRequest : function (enteredText) { @@ -41,11 +42,11 @@ YAHOO.bugzilla.prodCompSearch = { fields : [ "product", "component" ] }; }, - init : function( field, container, format) { - if( this.dataSource == null ){ + init : function(field, container, format, cloned_bug_id) { + if (this.dataSource == null) this.init_ds(); - } this.format = format; + this.cloned_bug_id = cloned_bug_id; this.autoComplete = new YAHOO.widget.AutoComplete(field, container, this.dataSource); this.autoComplete.generateRequest = this.generateRequest; this.autoComplete.formatResult = this.resultListFormat; @@ -70,9 +71,11 @@ YAHOO.bugzilla.prodCompSearch = { var url = "enter_bug.cgi?product=" + encodeURIComponent(oData[0]) + "&component=" + encodeURIComponent(oData[1]); var format = YAHOO.bugzilla.prodCompSearch.format; - if (format) { + if (format) url += "&format=" + encodeURIComponent(format); - } + var cloned_bug_id = YAHOO.bugzilla.prodCompSearch.cloned_bug_id; + if (cloned_bug_id) + url += "&cloned_bug_id=" + encodeURIComponent(cloned_bug_id); window.location.href = url; }); this.autoComplete.dataReturnEvent.subscribe(function(type, args) { -- cgit v1.2.3-24-g4f1b