View translations
This commit is contained in:
@@ -80,6 +80,55 @@ module.exports = function (options) {
|
||||
})
|
||||
})
|
||||
|
||||
router.route('/:id/chapter/:chapterId/view')
|
||||
.get(function(request, response, next) {
|
||||
db.Chapter.findByPk(request.params.chapterId, {
|
||||
include: [
|
||||
{
|
||||
association: db.Chapter.Chunks,
|
||||
include: [
|
||||
{
|
||||
association: db.Chunk.Translation
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
association: db.Chapter.ArtifactVersion,
|
||||
required: true,
|
||||
include: [
|
||||
{
|
||||
association: db.ArtifactVersion.TranslationArtifactVersions,
|
||||
required: true,
|
||||
where: {
|
||||
id: request.params.id
|
||||
}
|
||||
},
|
||||
{
|
||||
association: db.ArtifactVersion.Artifact,
|
||||
include: [
|
||||
{
|
||||
association: db.Artifact.Dialect
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}).then(chapter => {
|
||||
if (chapter) {
|
||||
response.display("translate-chapter-view", {
|
||||
user: request.user,
|
||||
pageTitle: `Translate Chapter ${chapter.name}`,
|
||||
chapter: chapter
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}).catch(error => {
|
||||
next(error)
|
||||
})
|
||||
})
|
||||
|
||||
router.route('/:id/chapter/:chapterId/t/:chunkIndex')
|
||||
.get(function(request, response, next) {
|
||||
const previousIndex = Number(request.params.chunkIndex)-1
|
||||
|
||||
22
server/views/translate-chapter-view.pug
Normal file
22
server/views/translate-chapter-view.pug
Normal file
@@ -0,0 +1,22 @@
|
||||
extend templates/layout.pug
|
||||
|
||||
block content
|
||||
.container
|
||||
.center
|
||||
h1= chapter.artifactVersion.translationArtifactVersions[0].name
|
||||
h2= chapter.artifactVersion.artifact.name
|
||||
|
||||
//- TODO: export to markdown...
|
||||
.row
|
||||
.col.s12
|
||||
a.btn.black(href=`/translate/${chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${chapter.id}/markdown`) export markdown
|
||||
|
||||
.row
|
||||
.col.s12
|
||||
each chunk in chapter.chunks
|
||||
p.flow-text
|
||||
if chunk.translation
|
||||
span= chunk.translation.text
|
||||
else
|
||||
span.grey-text= chunk.text
|
||||
|
||||
Reference in New Issue
Block a user