Skip to content

Commit

Permalink
work on post
Browse files Browse the repository at this point in the history
  • Loading branch information
liammclennan committed Jun 23, 2012
1 parent 7267719 commit ccef913
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/controllers/posts.js
@@ -1,5 +1,7 @@
var request = require('request'),
_ = require('underscore'),
gist = require('../../lib/gist'),
markdown = require('../../lib/markdown'),
lastGet = new Date(2000,1,1),
cache;

Expand Down Expand Up @@ -80,12 +82,14 @@ var Posts = function () {
}

function toViewModel(gist) {
var firstFile = gist.files[_(gist.files).keys()[0]];
return {
id: gist.id,
description: gist.description,
created_at: new Date(gist.created_at),
url: 'https://gist.github.com/' + gist.id,
commentsSummaryText: gist.comments > 0 ? gist.comments + ' comments' : 'no comments yet',
raw_url: firstFile.raw_url
};
}

Expand Down
2 changes: 1 addition & 1 deletion app/views/posts/index.html.ejs
@@ -1,7 +1,7 @@
<% for (var i = 0; i < gists.length; i++) { var gist = gists[i]; %>
<div class="page-header well">
<h1><a href=<%= gist.url %>><%= gist.description %></a></h1>
<h1><a href=<%= gist.url %>><%= gist.description %></a></h1>
<span class="muted">
<i class="icon-time"></i>
<%= gist.created_at.toDateString() %>
Expand Down

0 comments on commit ccef913

Please sign in to comment.