Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autocomplete to city search #94

Open
nidalaa opened this issue Mar 13, 2016 · 0 comments
Open

Add autocomplete to city search #94

nidalaa opened this issue Mar 13, 2016 · 0 comments

Comments

@nidalaa
Copy link

nidalaa commented Mar 13, 2016

City search should have the autocomplete functionality, i.e. it should list the matching cities as the user is typing the name.

Things to do:

  • Install JQuery UI plugin.
  • Add JS code to connect autocomplete to city search field.
  • Add CSS styling to autocomplete elements.
  • Create City resource (CitiesController only needs index action which responds to json, City model consists of name and count and does not have its own table, it delegates queries to Address).
  • Autocomplete list should display the name and the number of parkings for each city.

Explanation of flow:

  • autocomplete JS code calls /cities.json,
  • CitiesController#index method calls City.search method,
  • City.search method calls Address.with_city_like query, adds SQL grouping by city name and counting,
  • City.search method maps results of queries to City objects and returns them,
  • CitiesController#index method responds with city results, which are converted to JSON by Rails.
@nidalaa nidalaa added this to the Lesson 10 — Upload milestone Mar 13, 2016
@nidalaa nidalaa added the Free label Mar 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant