From 9f07124912d27f366ec50f94378026529ce18cde Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 24 Sep 2014 20:06:32 +0000 Subject: Bug 1059318: The drop-down box for components doesn't scroll --- .../template/en/default/prodcompsearch/form.html.tmpl | 4 ++++ extensions/ProdCompSearch/web/js/prod_comp_search.js | 15 ++++++++++----- extensions/ProdCompSearch/web/styles/prod_comp_search.css | 9 ++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'extensions') diff --git a/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl b/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl index b3d1deab1..38f87dc1a 100644 --- a/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl +++ b/extensions/ProdCompSearch/template/en/default/prodcompsearch/form.html.tmpl @@ -6,6 +6,7 @@ # defined by the Mozilla Public License, v. 2.0. #%] +[% DEFAULT max_results = 100 %]
@@ -28,6 +30,8 @@ class="bz_default_hidden" width="16" height="11"> No components found + + Result limited to [% max_results FILTER html %] components An error occured
diff --git a/extensions/ProdCompSearch/web/js/prod_comp_search.js b/extensions/ProdCompSearch/web/js/prod_comp_search.js index cb4a50ccc..f294994e3 100644 --- a/extensions/ProdCompSearch/web/js/prod_comp_search.js +++ b/extensions/ProdCompSearch/web/js/prod_comp_search.js @@ -12,7 +12,8 @@ var ProdCompSearch = { script_choices: ['enter_bug.cgi', 'describecomponents.cgi'], format: null, cloned_bug_id: null, - new_tab: null + new_tab: null, + max_results: 100 }; YUI({ @@ -21,8 +22,8 @@ YUI({ }).use("node", "json-stringify", "autocomplete", "escape", "datasource-io", "datasource-jsonschema", function(Y) { Y.on("domready", function() { - var counter = 0, - dataSource = null, + var counter = 0, + dataSource = null, autoComplete = null; var resultListFormat = function(query, results) { @@ -39,7 +40,7 @@ YUI({ version: "1.1", method : "PCS.prod_comp_search", id : counter, - params : { search: query } + params : { search: query, limit: ProdCompSearch.max_results } }; return Y.JSON.stringify(json_object); }; @@ -79,13 +80,14 @@ YUI({ queryDelay: 0.05, resultFormatter: resultListFormat, suppressInputUpdate: true, - maxResults: 25, + maxResults: ProdCompSearch.max_results, scrollIntoView: true, requestTemplate: requestTemplate, on: { query: function(e) { Y.one("#prod_comp_throbber").removeClass('bz_default_hidden'); Y.one("#prod_comp_no_components").addClass('bz_default_hidden'); + Y.one("#prod_comp_too_many_components").addClass('bz_default_hidden'); Y.one("#prod_comp_error").addClass('bz_default_hidden'); }, results: function(e) { @@ -94,6 +96,9 @@ YUI({ if (e.results.length == 0) { Y.one("#prod_comp_no_components").removeClass('bz_default_hidden'); } + else if (e.results.length + 1 > ProdCompSearch.max_results) { + Y.one("#prod_comp_too_many_components").removeClass('bz_default_hidden'); + } }, select: function(e) { // Only redirect if the script_name is a valid choice diff --git a/extensions/ProdCompSearch/web/styles/prod_comp_search.css b/extensions/ProdCompSearch/web/styles/prod_comp_search.css index a89856e22..ccb5887c4 100644 --- a/extensions/ProdCompSearch/web/styles/prod_comp_search.css +++ b/extensions/ProdCompSearch/web/styles/prod_comp_search.css @@ -15,6 +15,13 @@ width: 360px; } -#prod_comp_no_components, #prod_comp_error { +#prod_comp_search_form .yui3-aclist-content { + max-height: 500px; + overflow: auto; +} + +#prod_comp_no_components, +#prod_comp_error, +#prod_comp_too_many_components { color: red; } -- cgit v1.2.3-24-g4f1b