Skip to content

Add autocomplete to city search #129

@staszek

Description

@staszek

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions