From 92a81752931c5fd7cdbf4b63305389844193d029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Mon, 7 May 2012 17:58:22 +0200 Subject: Bug 616191: Implement UI to easily tag bugs from the bug report directly (and get rid of the current form in the footer) r=timello a=LpSolit --- js/field.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'js') diff --git a/js/field.js b/js/field.js index 9583db02c..1e5595081 100644 --- a/js/field.js +++ b/js/field.js @@ -870,27 +870,29 @@ YAHOO.bugzilla.userAutocomplete = { } }; -YAHOO.bugzilla.keywordAutocomplete = { - dataSource : null, - init_ds : function(){ - this.dataSource = new YAHOO.util.LocalDataSource( YAHOO.bugzilla.keyword_array ); +YAHOO.bugzilla.fieldAutocomplete = { + dataSource : [], + init_ds : function( field ) { + this.dataSource[field] = + new YAHOO.util.LocalDataSource( YAHOO.bugzilla.field_array[field] ); }, init : function( field, container ) { - if( this.dataSource == null ){ - this.init_ds(); + if( this.dataSource[field] == null ) { + this.init_ds( field ); } - 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 + var fieldAutoComp = + new YAHOO.widget.AutoComplete(field, container, this.dataSource[field]); + fieldAutoComp.maxResultsDisplayed = YAHOO.bugzilla.field_array[field].length; + fieldAutoComp.minQueryLength = 0; + fieldAutoComp.useIFrame = true; + fieldAutoComp.delimChar = [","," "]; + fieldAutoComp.resultTypeList = false; + fieldAutoComp.queryDelay = 0; + /* Causes all the possibilities in the field to appear when a user * focuses on the textbox */ - keywordAutoComp.textboxFocusEvent.subscribe( function(){ - var sInputValue = YAHOO.util.Dom.get('keywords').value; + fieldAutoComp.textboxFocusEvent.subscribe( function(){ + var sInputValue = YAHOO.util.Dom.get(field).value; if( sInputValue.length === 0 ){ this.sendQuery(sInputValue); this.collapseContainer(); -- cgit v1.2.1