public
Created

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// Controller for fetching the records
App.leaderboardController = SC.ArrayProxy.create({
content: [],
 
loadUsers: function() {
var self = this;
 
$.getJSON('/leaderboard/username/year/month', function(data) {
data.forEach(function(leader) {
self.pushObject(leader.leader);
})
});
},
 
podiums: function() {
return this.get('content').slice(0, 3)
}.property('content'),
places: function() {
return this.get('content').slice(3, 10)
}
});
 
// Very simple view
App.PodiumView = SC.CollectionView.extend({
contentBinding: 'App.leaderboardController.podiums',
tagName: 'ol'
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.