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;
|
||||
};
|
||||
@@ -21,16 +21,16 @@ block content
|
||||
tr
|
||||
td= chunk.text
|
||||
td
|
||||
if chunk.ossified
|
||||
if chunk.translated
|
||||
span= chunk.text
|
||||
else if chunk.translation
|
||||
span= chunk.translation.text
|
||||
else
|
||||
span= chunk.text.replaceAll(/./g, " ")
|
||||
td
|
||||
if chunk.ossified
|
||||
if chunk.translated
|
||||
span nothing
|
||||
else if chunk.translation
|
||||
a.btn.blue review
|
||||
else
|
||||
a.btn.black translate
|
||||
a.btn.black(href=`/translate/${chapter.entry.translationEntries[0].id}/chapter/${chapter.id}/t/${chunk.id}`) translate
|
||||
14
server/views/translate-chunk.pug
Normal file
14
server/views/translate-chunk.pug
Normal file
@@ -0,0 +1,14 @@
|
||||
extend templates/layout.pug
|
||||
|
||||
block content
|
||||
.container
|
||||
.center
|
||||
h1 Translate into #{chunk.chapter.entry.translationEntries[0].name}
|
||||
|
||||
form.row(action=`/translate/${chunk.chapter.entry.translationEntries[0].id}/chapter/${chunk.chapter.id}/t/${chunk.id}`)
|
||||
.col.s12.m6.input-field
|
||||
textarea#original-text.materialize-textarea(name="originalText")= chunk.text
|
||||
label(for="original-text") Original Text
|
||||
.col.s12.m6.input-field
|
||||
textarea#translated-text.materialize-textarea(name="translatedText", placeholder=chunk.text)
|
||||
label(for="original-text") Translated Text
|
||||
Reference in New Issue
Block a user