Created
October 5, 2011 11:51
-
-
Save coop/1264273 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment