summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BMO/template/en/default/global/choose-product.html.tmpl3
-rw-r--r--extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl10
-rw-r--r--extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl7
-rw-r--r--extensions/ProdCompSearch/web/js/prod_comp_search.js25
4 files changed, 29 insertions, 16 deletions
diff --git a/extensions/BMO/template/en/default/global/choose-product.html.tmpl b/extensions/BMO/template/en/default/global/choose-product.html.tmpl
index 4c0b6f736..9f3aca3c0 100644
--- a/extensions/BMO/template/en/default/global/choose-product.html.tmpl
+++ b/extensions/BMO/template/en/default/global/choose-product.html.tmpl
@@ -65,10 +65,11 @@
[% IF cloned_bug_id %]
ProdCompSearch.cloned_bug_id = '[% cloned_bug_id FILTER js %]';
[% END %]
+ ProdCompSearch.script_name = '[% target FILTER js %]';
</script>
<div id="prod_comp_search_main">
[% PROCESS prodcompsearch/form.html.tmpl
- input_label = "Type to find product and component by name or description:"
+ input_label = "Find product:"
%]
</div>
diff --git a/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl b/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl
index c300533fa..a8496c026 100644
--- a/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl
+++ b/extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl
@@ -117,16 +117,12 @@ dupes.setLabels(
</h3>
<script>
- [% IF format %]
- ProdCompSearch.format = '[% format FILTER js %]';
- [% END %]
- [% IF cloned_bug_id %]
- ProdCompSearch.cloned_bug_id = '[% cloned_bug_id FILTER js %]';
- [% END %]
+ ProdCompSearch.format = 'guided';
+ ProdCompSearch.script_name = 'enter_bug.cgi';
</script>
<div id="prod_comp_search_main">
[% PROCESS prodcompsearch/form.html.tmpl
- input_label = "Type to find product and component by name or description:"
+ input_label = "Find product:"
%]
</div>
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;
}
},