Skip to content

Commit

Permalink
Add git log to front page
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthaeusHarris committed Mar 20, 2015
1 parent e92b782 commit e4bb198
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 3 deletions.
21 changes: 21 additions & 0 deletions lib/gitlog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Created by matt on 3/20/15.
*/
var gitlog = require('gitlog');
var fs = require('fs');

var options = {
repo: fs.realpathSync(__dirname + '/../'),
number: 20,
fields: [ 'subject', 'authorName', 'authorDateRel', 'authorDate' ]
};

var log = [];

gitlog(options, function(err, data) {
module.exports.log = data;
});

module.exports = {
log: log
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"express": "^4.11.2",
"express-handlebars": "^1.2.1",
"express-session": "^1.10.3",
"gitlog": "^0.1.1",
"longjohn": "^0.2.4",
"mongoose": "^3.8.23",
"morgan": "^1.5.1",
Expand Down
22 changes: 22 additions & 0 deletions public/css/packagetracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,26 @@ body {
.lastUpdated {
font-size: x-small;
display: block;
}

.revision {
display: block;
margin-bottom: 10px;
}

.revision .byline {
width: 100%;
font-size: smaller;
}

.revision .date {

}

.revision .author {

}

.revision .subject {
display: block;
}
6 changes: 4 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
*/
var express = require('express');
var router = express.Router();
var gitLog = require('../lib/gitlog');

router.get('/', function(req, res) {
res.render('about');
res.render('about', {log: gitLog.log});
});

router.get('/about', function(req, res) {
res.render('about');
console.log(gitLog);
res.render('about', {log: gitLog.log});
});

module.exports = router;
20 changes: 19 additions & 1 deletion views/about.handlebars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="row">
<div class="col-md-12">
<div class="col-md-12 text-left">
<h1>About</h1>
<p>
PackageTracker is, as the name suggests, a service to track your in-transit packages.
Expand All @@ -22,4 +22,22 @@
Feedback may be sent to <a href="mailto:[email protected]">[email protected]</a>.
</p>
</div>

<div class="col-md-12 text-left">
<h1>Revision History</h1>
<ul>
{{#each log}}
<li>
<div class="revision">
<span class="subject">{{subject}}</span>
<span class="byline">
<span class="date">{{authorDate}}</span>
<span class="by">by</span>
<span class="author">{{authorName}}</span>
</span>
</div>
</li>
{{/each}}
</ul>
</div>
</div>

0 comments on commit e4bb198

Please sign in to comment.