summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorReed Loden <reed@reedloden.com>2010-07-05 09:42:01 +0200
committerReed Loden <reed@reedloden.com>2010-07-05 09:42:01 +0200
commitbf3e63a75b8fbc9d613ec3fd6289a178731692e4 (patch)
treee2e063f03682f85368cb462d525b35e3114053db /js
parente598bc84cff9a281d312651332465c3899e3f49d (diff)
downloadbugzilla-bf3e63a75b8fbc9d613ec3fd6289a178731692e4.tar.gz
bugzilla-bf3e63a75b8fbc9d613ec3fd6289a178731692e4.tar.xz
Bug 455810 - Add autocomplete support to the keywords field
* Special thanks to Guy Pyrzak for the original patch [r=mkanat a=mkanat]
Diffstat (limited to 'js')
-rw-r--r--js/field.js34
1 files changed, 32 insertions, 2 deletions
diff --git a/js/field.js b/js/field.js
index 39b272f92..20485bcc8 100644
--- a/js/field.js
+++ b/js/field.js
@@ -16,6 +16,7 @@
*
* Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
* Guy Pyrzak <guy.pyrzak@gmail.com>
+ * Reed Loden <reed@reedloden.com>
*/
/* This library assumes that the needed YUI libraries have been loaded
@@ -621,8 +622,8 @@ YAHOO.bugzilla.userAutocomplete = {
userAutoComp.autoHighlight = false;
// this is a throttle to determine the delay of the query from typing
// set this higher to cause fewer calls to the server
- userAutoComp.queryDelay = 0.05
- userAutoComp.useIFrame = true
+ userAutoComp.queryDelay = 0.05;
+ userAutoComp.useIFrame = true;
userAutoComp.resultTypeList = false;
if( multiple == true ){
userAutoComp.delimChar = [","," "];
@@ -631,3 +632,32 @@ YAHOO.bugzilla.userAutocomplete = {
}
};
+YAHOO.bugzilla.keywordAutocomplete = {
+ dataSource : null,
+ init_ds : function(){
+ this.dataSource = new YAHOO.util.LocalDataSource( YAHOO.bugzilla.keyword_array );
+ },
+ init : function( field, container ) {
+ if( this.dataSource == null ){
+ this.init_ds();
+ }
+ var keywordAutoComp = new YAHOO.widget.AutoComplete(field, container, this.dataSource);
+ keywordAutoComp.maxResultsDisplayed = YAHOO.bugzilla.keyword_array.length;
+ keywordAutoComp.minQueryLength = 0;
+ keywordAutoComp.useIFrame = true;
+ keywordAutoComp.delimChar = [","," "];
+ keywordAutoComp.resultTypeList = false;
+ keywordAutoComp.queryDelay = 0;
+ /* Causes all the possibilities in the keyword to appear when a user
+ * focuses on the textbox
+ */
+ keywordAutoComp.textboxFocusEvent.subscribe( function(){
+ var sInputValue = YAHOO.util.Dom.get('keywords').value;
+ if( sInputValue.length === 0 ){
+ this.sendQuery(sInputValue);
+ this.collapseContainer();
+ this.expandContainer();
+ }
+ });
+ }
+};