Skip to content

Commit

Permalink
Add some names to the contributor list and show the name instead of u…
Browse files Browse the repository at this point in the history
…sername if possible

Had to use the old GitHub v2 API, since v3 doesn't have a 'name' field...
  • Loading branch information
sindresorhus committed Feb 21, 2012
1 parent 30b47d8 commit 4694fe3
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions site/js/main.js
Expand Up @@ -15,24 +15,28 @@
});

// Contributor list
$.getJSON('https://api.github.com/repos/addyosmani/todomvc/contributors?callback=?', function( res ) {
var data = res.data;
$.ajaxSetup({
cache: true
});
$.getJSON('https://github.com/api/v2/json/repos/show/addyosmani/todomvc/contributors?callback=?', function( res ) {
var data = res.contributors;
// Add some previous contributors not on the GitHub list
/*
[].push.apply(data, [{
login: 'test'
login: 'tomdale',
name: 'Tom Dale'
}, {
login: 'test'
login: 'justinbmeyer',
name: 'Justin Meyer'
}, {
login: 'test'
login: 'maccman',
name: 'Alex MacCaw'
}]);
*/
var ret = $.map( res.data, function( elem ) {
var ret = $.map( data, function( elem ) {
var username = elem.login;
if ( $.inArray( username, [ 'addyosmani', 'boushley', 'sindresorhus' ] ) >= 0 ) {
return;
}
return '<a href="https://github.com/' + username + '">' + username + '</a>';
return '<a href="https://github.com/' + username + '">' + ( elem.name || username ) + '</a>';
});
$('#contributor-list').show().children('span').html( ret.join(', ') );
});
Expand Down

0 comments on commit 4694fe3

Please sign in to comment.