feat: page history UI + nav links fix

This commit is contained in:
Nicolas Giard
2018-10-28 22:09:58 -04:00
parent b26f30ae20
commit 9a2a9c220a
11 changed files with 2739 additions and 361 deletions

View File

@@ -45,6 +45,24 @@ router.get(['/p', '/p/*'], (req, res, next) => {
res.render('profile')
})
/**
* View document
*/
router.get(['/h', '/h/*'], async (req, res, next) => {
const pageArgs = pageHelper.parsePath(req.path)
const page = await WIKI.models.pages.getPage({
path: pageArgs.path,
locale: pageArgs.locale,
userId: req.user.id,
isPrivate: false
})
if (page) {
res.render('history', { page })
} else {
res.redirect(`/${pageArgs.path}`)
}
})
/**
* View document
*/