Chunk page
This commit is contained in:
@@ -73,5 +73,52 @@ module.exports = function (options) {
|
||||
next(error)
|
||||
})
|
||||
})
|
||||
|
||||
router.route('/:id/chapter/:chapterId/t/:chunkId')
|
||||
.get(function(request, response, next) {
|
||||
db.Chunk.findByPk(request.params.chunkId, {
|
||||
include: [
|
||||
{
|
||||
association: db.Chunk.Translation
|
||||
},
|
||||
{
|
||||
association: db.Chunk.Chapter,
|
||||
where: {
|
||||
id: request.params.chapterId
|
||||
},
|
||||
include: [
|
||||
{
|
||||
association: db.Chapter.Entry,
|
||||
required: true,
|
||||
include: [
|
||||
{
|
||||
association: db.Entry.TranslationEntries,
|
||||
required: true,
|
||||
where: {
|
||||
id: request.params.id
|
||||
}
|
||||
},
|
||||
{
|
||||
association: db.Entry.Dialect
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}).then(chunk => {
|
||||
if (chunk) {
|
||||
response.display("translate-chunk", {
|
||||
user: request.user,
|
||||
pageTitle: `Translate ${chunk.chapter.entry.name}`,
|
||||
chunk: chunk
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}).catch(error => {
|
||||
next(error)
|
||||
})
|
||||
})
|
||||
return router;
|
||||
};
|
||||
Reference in New Issue
Block a user