summaryrefslogtreecommitdiffstats
path: root/extensions/ProdCompSearch
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
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')
-rw-r--r--extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl7
-rw-r--r--extensions/ProdCompSearch/web/js/prod_comp_search.js25
2 files changed, 24 insertions, 8 deletions
diff --git a/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl b/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl
index a9f05d9ba..fc8d3f1fb 100644
--- a/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl
+++ b/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl
@@ -8,9 +8,12 @@
<div id="prod_comp_search_form" class="yui3-skin-sam">
<div id="prod_comp_search_header">
- [% input_label FILTER none %]
+ [% input_label FILTER none %]&nbsp;
<img id="prod_comp_throbber" src="extensions/ProdCompSearch/web/images/throbber.gif"
class="bz_default_hidden" width="16" height="11">
+ <span id="prod_comp_no_data" class="bz_default_hidden" style="color:red;">
+ No data found</span>
</div>
- <input id="prod_comp_search" type="text" size="50">
+ <input id="prod_comp_search" type="text" size="50"
+ placeholder="Search by product and component keywords">
</div>
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;
}
},