Improve typeahead contact selector experience

Store and match on various phone number formats. Still not perfect, as
occasionally all the models are returned for a non-matching query.
This commit is contained in:
lilia 2015-01-28 19:28:49 -10:00
parent acc2c6f536
commit d435ff003b
3 changed files with 21 additions and 15 deletions

View file

@ -33,6 +33,14 @@
}
},
splitCountryCode: function(number) {
var parsedNumber = libphonenumber.parse(number);
return {
country_code: parsedNumber.values_[1],
national_number: parsedNumber.values_[2]
};
},
getCountryCode: function(regionCode) {
var cc = libphonenumber.getCountryCodeForRegion(regionCode);
return (cc != 0) ? cc : "";