Skip to content

Commit

Permalink
Proposed fix for issue foundation#17. Populates gihub info via call t…
Browse files Browse the repository at this point in the history
…o github APIs

clientside in javascript
  • Loading branch information
davidbanham authored and mkelly12 committed Nov 1, 2011
1 parent 6f81b3a commit 7bd8766
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
43 changes: 43 additions & 0 deletions marketing/github.js
@@ -0,0 +1,43 @@
$(document).ready(function() {
$.ajax({
url: "http://github.com/api/v2/json/commits/list/zurb/foundation/master",
dataType: 'jsonp',
success: function(json) {
var latest = json.commits[0];
console.log(latest);
var stamp = new Date(latest.committed_date);
console.log(stamp.toDateString());
var stampString = month[stamp.getMonth()] + ' ' + stamp.getDate() + ', ' + stamp.getFullYear();
console.log(stampString);
$('#latestCommitMessage').text(latest.message);
$('#latestCommitTime').text(stampString);
$('#latestCommitURL').html('Commit ' + latest.id + ' »');
$('#latestCommitURL').attr('href', "https://github.com" + latest.url);
}
});
$.ajax({
url: "http://github.com/api/v2/json/repos/show/zurb/foundation/tags",
dataType: 'jsonp',
success: function(json) {
var tags = [];
for ( var key in json.tags ) {
tags.push(key)
}
console.log(tags[tags.length - 1]);
$('#latestVersion').text(tags[tags.length - 1]);
}
});
var month=new Array(12);
month[0]="Jan";
month[1]="Feb";
month[2]="Mar";
month[3]="Apr";
month[4]="May";
month[5]="Jun";
month[6]="Jul";
month[7]="Aug";
month[8]="Sep";
month[9]="Oct";
month[10]="Nov";
month[11]="Dec";
});
3 changes: 2 additions & 1 deletion marketing/includes/_header.php
Expand Up @@ -45,6 +45,7 @@
<script src="../javascripts/jquery.placeholder.min.js"></script>
<script src="../javascripts/app.js"></script>
<script src="swipe.js"></script>
<script src="github.js"></script>


<script>
Expand Down Expand Up @@ -88,4 +89,4 @@
-->
</div>
</div>
<!-- /ZURBar -->
<!-- /ZURBar -->
10 changes: 5 additions & 5 deletions marketing/index.php
Expand Up @@ -31,15 +31,15 @@
<div class="row">
<div class="two columns">
<h6>Latest Update</h6>
<time>Oct 26, 2011</time>
<time id="latestCommitTime">Loading...</time>
<a href="github-mac://openRepo/https://github.com/zurb/foundation" class="nice small white button">Clone Now</a>
</div>
<article class="seven columns">
<dl>
<dt>Version 2.0.3</dt>
<dd>Various bug fixes, as well as correcting an issue with the Rails gem.</dd>
<dt id="latestVersion">Loading...</dt>
<dd id="latestCommitMessage">Loading...</dd>
</dl>
<a href="https://github.com/zurb/foundation">Commit 748242f9c43d27e3861bce5afdf217a026449681 &raquo;</a>
<a id="latestCommitURL" href="https://github.com/zurb/foundation">Loading...</a>
</article>
<aside class="three columns">
<a href="docs/">View the Documentation &raquo;</a>
Expand Down Expand Up @@ -142,4 +142,4 @@
</section>
<!-- /Case Studies Mobile -->

<?php include("includes/_footer.php"); ?>
<?php include("includes/_footer.php"); ?>

0 comments on commit 7bd8766

Please sign in to comment.