feat: History page - List previous commits

This commit is contained in:
NGPixel
2017-04-30 16:37:10 -04:00
parent a7c4f42ef0
commit a748b3a4eb
10 changed files with 132 additions and 6 deletions

View File

@@ -179,6 +179,27 @@ router.get('/source/*', (req, res, next) => {
})
})
/**
* View history of a document
*/
router.get('/hist/*', (req, res, next) => {
let safePath = entryHelper.parsePath(_.replace(req.path, '/hist', ''))
entries.getHistory(safePath).then((pageData) => {
if (pageData) {
res.render('pages/history', { pageData })
} else {
throw new Error('Invalid page path.')
}
return true
}).catch((err) => {
res.render('error', {
message: err.message,
error: {}
})
})
})
/**
* View document
*/