KatrinaHoffert / EatSafe

An app for finding safe places to eat
Other
2 stars 2 forks source link

Prepopulate city typeahead with user location #63

Closed KatrinaHoffert closed 9 years ago

KatrinaHoffert commented 9 years ago

Get user's coordinates and see if they're in a city. Maps API seems to be able to do this (example -- note that it was able to identify Saskatoon as an address component).

We should try and use this data to prepopulate the city typeahead. Must handle the case of Maps API not being able to determine a city (in which case it shouldn't do anything).

Assisting commented 9 years ago

It took some fiddling, but I got there in the end. I'm not quite ready to close this issue though. It does fill the field as per the description, but from a usability standpoint there probably needs to be a button to clear the field (if and only if it has been filled in by geolocation) to make mobile use easier.

There's a glyph in Bootstrap that will probably work excellently for this. I'll just need to style it inline with the Typeahead (probably to the left of the search icon, floating over the input box) and do a quick onClick() method.

Assisting commented 9 years ago

Added glyphs. In addition to the one that clears the field, there is another glyph that does the same thing that is performed on page load, in case a mobile user initially loads the page with GPS disabled and then wishes to perform the action again with greater specificity. (props to Quentin for that idea)

The styling isn't perfect, which I'll have to work on for Milestone 4, but it's perfectly functional.