Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a function to pass the current list of next venues to the client.

  • Loading branch information...
commit 124a4ade64bcb14ceb5dc5caecdf602985fece2a 1 parent 01dc343
Tony Salomone authored
Showing with 7 additions and 2 deletions.
  1. +4 −0 client/lib/toppl.js
  2. +3 −2 server/server.js
View
4 client/lib/toppl.js
@@ -3,6 +3,10 @@ $(document).ready(function() {
$("#current_location_name").html(venue.name);
}
+ now.setNextVenues = function(venues) {
+ $("#bar-choice-0").html(venues[0].name);
+ }
+
for(var i=0; i<5; i++) {
$("#bar-choice-" + i).click(function() {
alert($(this).attr("value") + " was clicked!");
View
5 server/server.js
@@ -48,6 +48,7 @@ everyone.now.bars = bars;
everyone.connected(function(){
console.log("Joined: " + this.now.name);
everyone.now.setCurrentLocation(currentVenue);
+ everyone.now.setNextVenues(nextVenues);
});
@@ -76,7 +77,7 @@ var currentVenue;
// temp fake result data in case I don't want to call the Yellow API
var fake_result_data = '{"summary":{"what":"bar","where":"cZ-80.524378,43.464745","latitude":"43.464745","longitude":"-80.524378","firstListing":1,"lastListing":5,"totalListings":5876,"pageCount":1176,"currentPage":1,"listingsPerPage":5},"listings":[{"parentId":"","isParent":false,"distance":"0.0","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"id":"532082","name":"Duke Of Wellington The","address":{"street":"33 Erb St W","city":"Waterloo","prov":"ON","pcode":"N2L1S8"},"geoCode":{"latitude":"43.464745","longitude":"-80.524378"}},{"parentId":"","isParent":false,"distance":"0.3","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":true,"inMkt":true},"Logo":{"avail":false,"inMkt":false}},"id":"1041135","name":"McMullans On King","address":{"street":"56 King N","city":"Waterloo","prov":"ON","pcode":"N2J2X1"},"geoCode":{"latitude":"43.467032","longitude":"-80.522958"}},{"parentId":"","isParent":false,"distance":"0.4","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"id":"606766","name":"Failte Irish Pub","address":{"street":"85 King N","city":"Waterloo","prov":"ON","pcode":"N2J2X3"},"geoCode":{"latitude":"43.468002","longitude":"-80.523176"}},{"parentId":"","isParent":false,"distance":"1.4","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":true,"inMkt":true},"Logo":{"avail":false,"inMkt":false}},"id":"1088388","name":"Morty\'s Pub","address":{"street":"272 King N","city":"Waterloo","prov":"ON","pcode":"N2J2Y9"},"geoCode":{"latitude":"43.477115","longitude":"-80.52517"}},{"parentId":"","isParent":false,"distance":"2.8","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"id":"649696","name":"Frankies Pub","address":{"street":"273 King W","city":"Kitchener","prov":"ON","pcode":"N2G1B1"},"geoCode":{"latitude":"43.451568","longitude":"-80.494121"}}]}';
-function getLocations(currentVenue, num_results) {
+function getNextVenues(currentVenue, num_results) {
var locx = currentVenue.geoCode.longitude;
var locy = currentVenue.geoCode.latitude;
@@ -105,6 +106,6 @@ currentVenue = {
}
};
-var yellowAPIResults = getLocations(currentVenue, NUM_NEXT_VENUE_OPTIONS);
+var yellowAPIResults = getNextVenues(currentVenue, NUM_NEXT_VENUE_OPTIONS);
var nextVenues = yellowAPIResults.listings;
Please sign in to comment.
Something went wrong with that request. Please try again.