Handling enter key in language filter

* if the search string is language code, select it
* else if the autocompletion available select it
* else select the first language matching the query

Change-Id: If66f5c547a471026b7b2aebcde3c3b056e1c2917
This commit is contained in:
Santhosh Thottingal
2012-08-07 17:38:09 +05:30
parent a7d3479d81
commit 315d529aed
2 changed files with 23 additions and 9 deletions

View File

@@ -107,11 +107,7 @@
lcd = that.$resultsView.lcd( {
languages: that.languages,
clickhandler: function( langCode ) {
if ( that.options.onSelect ) {
that.options.onSelect.call( this, langCode );
}
}
clickhandler: $.proxy( that.onSelect, that )
} ).data( "lcd" );
that.$languageFilter.languagefilter( {
@@ -119,7 +115,8 @@
languages: that.languages,
success: $.proxy( that.success, that ),
noresults: $.proxy( that.noresults, that ),
searchAPI: that.options.searchAPI
searchAPI: that.options.searchAPI,
onSelect: $.proxy( that.onSelect, that )
} );
// Create region selectors, one per region
@@ -135,6 +132,12 @@
},
onSelect: function( langCode ) {
if ( this.options.onSelect ) {
this.options.onSelect.call( this, langCode );
}
},
keyup: function( e ) {
if ( !this.shown ) {
return;