Skip to content

Commit 10898bd

Browse files
author
aeoth
committed
Projects now dynamically loaded in via javascript
1 parent d6dc266 commit 10898bd

File tree

4 files changed

+67
-90
lines changed

4 files changed

+67
-90
lines changed

_layouts/layout.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
<title>{% if page.title != "code52" %}{{ page.title }} - code52{% else %}{{ page.title }}{% endif %}</title>
1313
<link rel="stylesheet" type="text/css" href="/css/style20120128.css" />
1414
<link rel="shortcut icon" href="/img/favicon.ico" />
15+
<script id="contributorTemplate" type="text/x-jQuery-tmpl">
16+
{% literal %}
17+
{{each contributors}}
18+
<h3 style="margin-top:0px;"><img src="http://gravatar.com/avatar/${gravatar_id}?s=25" alt="${ name }" /> <a href="https://github.com/${login}">${name || login}</a> - (${contributions} commits)</h3>
19+
{{/each}}
20+
{% endliteral %}
21+
</script>
1522
</head>
1623
<body>
1724
<div id="container">

js/contrib.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
function getContribs(projectName) {
2+
$.ajax({
3+
url: "http://github.com/api/v2/json/repos/show/Code52/" + projectName + "/contributors",
4+
dataType: 'jsonp',
5+
success: function(data)
6+
{
7+
data.contributors = data.contributors.sort(function (a, b)
8+
{
9+
if (a.contributions > b.contributions) return -1;
10+
if (a.contributions < b.contributions) return 1;
11+
return 0;
12+
});
13+
$("#contributors").append("<h2>" + projectName +"</h2>");
14+
$("#contributorTemplate").tmpl(data).appendTo("#contributors");
15+
}
16+
});
17+
}
18+
19+
20+
$(function()
21+
{
22+
$.ajax({
23+
url: "http://github.com/api/v2/json/repos/show/code52",
24+
dataType: 'jsonp',
25+
success: function(data)
26+
{
27+
var count = data.repositories.length;
28+
data.repositories = data.repositories.sort(function (a, b)
29+
{
30+
var adate = new Date(a.created_at).getTime();
31+
var bdate = new Date(b.created_at).getTime();
32+
if (adate < bdate) return -1;
33+
if (adate > bdate) return 1;
34+
return 0;
35+
});
36+
37+
for(var i = 0; i < count; i++)
38+
{
39+
var repo = data.repositories[i];
40+
41+
if (repo.name != "code52.github.com")
42+
getContribs(repo.name);
43+
}
44+
}
45+
});
46+
});

projects.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
layout: post
3+
title: Previous Projects
4+
---
5+
6+
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
7+
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script>
8+
<script type="text/javascript" src="/js/contrib.js"></script>
9+
10+
<img style="float:right;" src="http://code52.org/DownmarkerWPF/icon.png" />
11+
##[MarkPad](http://code52.org/DownmarkerWPF/)
12+
**Contributors**
13+
14+
<div id="contributors"></div>

projects.md

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)