Closed nimmolo closed 3 months ago
TODOs for this phase:
place_name
and location_id
if the autocompleter gets a result. Currently just populates optionslocation
autocompleter if lat/lngs are removed (swap the type
back and re-initialize)This is now deployed on the test server, in case you want to check it there.
Reviewers please feel free to discuss/question the overall plan for this "phase" as described up top.
Issues discovered by @pellaea
location_containing
should highlight current rowThis passes tests for me locally now. Idk what's up with CI.
This "phase 2a" PR adds some JS and a query scope that tries to guess a Location as soon as we get a lat/lng.
It adds a JS listener so that changes to the lat/lng fields, either from user input or image autofill, call up a new autocompleter class,
ForLocationContaining
. This class queries the db to return all MO locations encompassing the lat/lng given, in order of ascending area. The JS then populates the autocomplete options of the Location input with these locations, and auto-fills theplace_name
and hiddenlocation_id
fields with the first (smallest fitting) location."phase 2b" would move the UI for creating a custom location to a pop-up modal, available from the "create_obs" form. It would require any undefined
place_name
to be created as a db Location prior to saving the obs, rather than offering this optionally, after creating the obs, as is currently the case. (It would still not require a Location however — it would only block creating an obs with an undefined place name.)"phase 2c" is intended to supplement the suggestions in 2a with a call to Google's reverse geolocation service, in the event that MO does not have any matching locations.