summaryrefslogtreecommitdiffstats
path: root/extensions/ProdCompSearch/web/js/prod_comp_search.js
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-02-27 06:02:51 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-02-27 06:02:51 +0100
commitaa6d6dd9b7bd75d6f6536a8102eaf326618e0bc8 (patch)
treed4e29ec8df6fcd699647192242ce1ad95c05896a /extensions/ProdCompSearch/web/js/prod_comp_search.js
parent02cd18d7165d86c7ea6d6fc6a9273094d9513a58 (diff)
downloadbugzilla-aa6d6dd9b7bd75d6f6536a8102eaf326618e0bc8.tar.gz
bugzilla-aa6d6dd9b7bd75d6f6536a8102eaf326618e0bc8.tar.xz
Bug 837892 - User dashboard "file a bug" window does not do anything
- Added placeholder in text entry for prod comp search - Show message when no results are found using prod comp search - Fixed prod comp search bug with GuidedBugEntry
Diffstat (limited to 'extensions/ProdCompSearch/web/js/prod_comp_search.js')
-rw-r--r--extensions/ProdCompSearch/web/js/prod_comp_search.js25
1 files changed, 19 insertions, 6 deletions
diff --git a/extensions/ProdCompSearch/web/js/prod_comp_search.js b/extensions/ProdCompSearch/web/js/prod_comp_search.js
index 77ef28124..99390bbc1 100644
--- a/extensions/ProdCompSearch/web/js/prod_comp_search.js
+++ b/extensions/ProdCompSearch/web/js/prod_comp_search.js
@@ -8,6 +8,8 @@
// Product and component search to file a new bug
var ProdCompSearch = {
+ script_name: 'enter_bug.cgi',
+ script_choices: ['enter_bug.cgi', 'describecomponents.cgi'],
format: null,
cloned_bug_id: null
};
@@ -15,7 +17,7 @@ var ProdCompSearch = {
YUI({
base: 'js/yui3/',
combine: false
-}).use("node", "json-stringify", "autocomplete", "escape",
+}).use("node", "json-stringify", "autocomplete", "escape", "array",
"datasource-io", "datasource-jsonschema", "array-extras", function (Y) {
var counter = 0,
dataSource = null,
@@ -71,19 +73,30 @@ YUI({
on: {
query: function(e) {
Y.one("#prod_comp_throbber").removeClass('bz_default_hidden');
+ Y.one("#prod_comp_no_data").addClass('bz_default_hidden');
},
results: function(e) {
Y.one("#prod_comp_throbber").addClass('bz_default_hidden');
input.ac.set('activateFirstItem', e.results.length == 1);
+ if (e.results.length == 0) {
+ Y.one("#prod_comp_no_data").removeClass('bz_default_hidden');
+ }
},
select: function(e) {
+ // Only redirect if the script_name is a valid choice
+ if (Y.Array.indexOf(ProdCompSearch.script_choices, ProdCompSearch.script_name) == -1)
+ return;
+
var data = e.result.raw;
- var url = "enter_bug.cgi?product=" + encodeURIComponent(data.product) +
+ var url = ProdCompSearch.script_name +
+ "?product=" + encodeURIComponent(data.product) +
"&component=" + encodeURIComponent(data.component);
- if (ProdCompSearch.format)
- url += "&format=" + encodeURIComponent(ProdCompSearch.format);
- if (ProdCompSearch.cloned_bug_id)
- url += "&cloned_bug_id=" + encodeURIComponent(ProdCompSearch.cloned_bug_id);
+ if (ProdCompSearch.script_name == 'enter_bug.cgi') {
+ if (ProdCompSearch.format)
+ url += "&format=" + encodeURIComponent(ProdCompSearch.format);
+ if (ProdCompSearch.cloned_bug_id)
+ url += "&cloned_bug_id=" + encodeURIComponent(ProdCompSearch.cloned_bug_id);
+ }
window.location.href = url;
}
},