Display user checkins

This commit is contained in:
Sahat Yalkabov
2013-11-30 01:52:29 -05:00
parent 18eefcdaff
commit 6f97fb69b6
2 changed files with 23 additions and 5 deletions

View File

@ -36,19 +36,21 @@ exports.foursquare = function(req, res) {
}, },
venueDetail: function(callback) { venueDetail: function(callback) {
foursquare.Venues.getVenue('40a55d80f964a52020f31ee3', req.user.tokens.foursquare, function(err, results) { foursquare.Venues.getVenue('40a55d80f964a52020f31ee3', req.user.tokens.foursquare, function(err, results) {
console.log(results);
callback(err, results.venue); callback(err, results.venue);
}); });
}, },
userCheckins: function(callback) { userCheckins: function(callback) {
callback(null); foursquare.Users.getCheckins('self', null, req.user.tokens.foursquare, function(err, results) {
callback(err, results.checkins.items);
});
} }
}, function(err, results) { }, function(err, results) {
res.render('api/foursquare', { res.render('api/foursquare', {
title: 'Foursquare API', title: 'Foursquare API',
user: req.user, user: req.user,
trendingVenues: results.trendingVenues,
venue: results.venueDetail, venue: results.venueDetail,
trendingVenues: results.trendingVenues checkins: results.userCheckins
}); });
}); });
}; };

View File

@ -39,8 +39,9 @@ block content
td= venue.hereNow.count td= venue.hereNow.count
.lead Venue Detail .lead Venue Detail
img.img-thumbnail(src='https://irs3.4sqi.net/img/general/200x200/11109710_xePHC-bh76LL_EaG-tsM1lUV6Bp-VUG1r_haDSqSvBM.jpg')
p.text-danger Name: #{venue.name} p.text-danger Name: #{venue.name}
p.text-info Location: #{venue.location.address}, #{venue.location.city}, #{venue.location.state} p.text-muted Location: #{venue.location.address}, #{venue.location.city}, #{venue.location.state}
p.text-success Categories: p.text-success Categories:
for category in venue.categories for category in venue.categories
span #{category.shortName} | span #{category.shortName} |
@ -48,7 +49,22 @@ block content
p.text-warning Rating: #{venue.rating} p.text-warning Rating: #{venue.rating}
#users.tab-pane.fade #users.tab-pane.fade
p TODO: Users .lead User Checkins
table.table.table-bordered.table-hover
thead
tr
th Name
th Location
th Category
th Checkins
tbody
for checkin in checkins
tr
td= checkin.venue.name
td #{checkin.venue.location.address}, #{checkin.venue.location.city}, #{checkin.venue.location.state}
td= checkin.venue.categories[0].shortName
td= checkin.venue.stats.checkinsCount
#checkins.tab-pane.fade #checkins.tab-pane.fade
p TODO: Checkins p TODO: Checkins