The-Apiary / buzz

A podcast client with functionality inspired by Rdio
0 stars 2 forks source link

Update search veiws to support Typeahead and Ember #12

Closed everett1992 closed 10 years ago

everett1992 commented 10 years ago

Ember expects json in the format

{podcasts: [
  {id: 1, title: 'a'},
  {id: 2, title: 'b'}
   ...
]}

But Twitter Typeahead (Search autocomplete function) wants:

[
  {id: 1, title: 'a'},
  {id: 2, title: 'b'}
   ...
]

Currently api/v1/search follows Typeahead's formatting, and the ember route #/search uses ajax, and raw json objects instead of wrapping them as Ember objects.

Either

  1. Get typeahead to accept embre style json
  2. Get ember to accept typeahead style json for the #/search route only
  3. Have the server respond with the correct format depending on if the request comes from ember or typeahead.

One is prefered over Two. Three is probably the best. Typeahead doesn't need the podcast's full description so sending cut down json saves some bandwidth. Sending a boolean typeahead parameter seems a touch hacky though.

everett1992 commented 10 years ago

I refactored the whole search functionality and now it does not rely on twitter typeahead. Removing dependencies, who even am I anymore.