Translation chunks...
This commit is contained in:
@@ -10,21 +10,26 @@ module.exports = function (options) {
|
|||||||
db.TranslationArtifactVersion.findByPk(request.params.id, {
|
db.TranslationArtifactVersion.findByPk(request.params.id, {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.TranslationArtifactVersion.ArtifactVersion,
|
association: db.TranslationArtifactVersion.TranslationChapters,
|
||||||
required: true,
|
limit: 1,
|
||||||
include: [
|
required: true
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Chapters,
|
|
||||||
required: true,
|
|
||||||
limit: 1,
|
|
||||||
// TODO: Order by chapter index
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
// {
|
||||||
|
// association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||||
|
// required: true,
|
||||||
|
// include: [
|
||||||
|
// {
|
||||||
|
// association: db.ArtifactVersion.Chapters,
|
||||||
|
// required: true,
|
||||||
|
// limit: 1,
|
||||||
|
// // TODO: Order by chapter index
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
]
|
]
|
||||||
}).then(translationArtifactVersion => {
|
}).then(translationArtifactVersion => {
|
||||||
if (translationArtifactVersion) {
|
if (translationArtifactVersion) {
|
||||||
response.redirect(`/translate/${translationArtifactVersion.id}/chapter/${translationArtifactVersion.artifactVersion.chapters[0].id}`)
|
response.redirect(`/translate/${translationArtifactVersion.id}/chapter/${translationArtifactVersion.translationChapters[0].id}`)
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
@@ -33,44 +38,41 @@ module.exports = function (options) {
|
|||||||
|
|
||||||
router.route('/:id/chapter/:chapterId')
|
router.route('/:id/chapter/:chapterId')
|
||||||
.get(function(request, response, next) {
|
.get(function(request, response, next) {
|
||||||
db.Chapter.findByPk(request.params.chapterId, {
|
db.TranslationChapter.findByPk(request.params.chapterId, {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chapter.Chunks,
|
association: db.TranslationChapter.TranslationChunks,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chunk.Translation
|
association: db.TranslationChunk.Translation
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.Chapter.ArtifactVersion,
|
association: db.TranslationChapter.TranslationArtifactVersion,
|
||||||
required: true,
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.ArtifactVersion.TranslationArtifactVersions,
|
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||||
required: true,
|
|
||||||
where: {
|
|
||||||
id: request.params.id
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Artifact,
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Artifact.Dialect
|
association: db.ArtifactVersion.Artifact,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Artifact.Dialect
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(chapter => {
|
}).then(translationChapter => {
|
||||||
if (chapter) {
|
if (translationChapter) {
|
||||||
response.display("translate-chapter", {
|
response.display("translate-chapter", {
|
||||||
user: request.user,
|
user: request.user,
|
||||||
pageTitle: `Translate Chapter ${chapter.name}`,
|
pageTitle: `Translate Chapter ${translationChapter.name}`,
|
||||||
chapter: chapter
|
translationChapter: translationChapter
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
@@ -82,44 +84,41 @@ module.exports = function (options) {
|
|||||||
|
|
||||||
router.route('/:id/chapter/:chapterId/view')
|
router.route('/:id/chapter/:chapterId/view')
|
||||||
.get(function(request, response, next) {
|
.get(function(request, response, next) {
|
||||||
db.Chapter.findByPk(request.params.chapterId, {
|
db.TranslationChapter.findByPk(request.params.chapterId, {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chapter.Chunks,
|
association: db.TranslationChapter.TranslationChunks,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chunk.Translation
|
association: db.TranslationChunk.Translation
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.Chapter.ArtifactVersion,
|
association: db.TranslationChapter.TranslationArtifactVersion,
|
||||||
required: true,
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.ArtifactVersion.TranslationArtifactVersions,
|
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||||
required: true,
|
|
||||||
where: {
|
|
||||||
id: request.params.id
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Artifact,
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Artifact.Dialect
|
association: db.ArtifactVersion.Artifact,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Artifact.Dialect
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(chapter => {
|
}).then(translationChapter => {
|
||||||
if (chapter) {
|
if (translationChapter) {
|
||||||
response.display("translate-chapter-view", {
|
response.display("translate-chapter-view", {
|
||||||
user: request.user,
|
user: request.user,
|
||||||
pageTitle: `Translate Chapter ${chapter.name}`,
|
pageTitle: `Translate Chapter ${translationChapter.name}`,
|
||||||
chapter: chapter
|
translationChapter: translationChapter
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
@@ -133,9 +132,9 @@ module.exports = function (options) {
|
|||||||
.get(function(request, response, next) {
|
.get(function(request, response, next) {
|
||||||
const previousIndex = Number(request.params.chunkIndex)-1
|
const previousIndex = Number(request.params.chunkIndex)-1
|
||||||
const nextIndex = Number(request.params.chunkIndex)+1
|
const nextIndex = Number(request.params.chunkIndex)+1
|
||||||
db.Chunk.findAll({
|
db.TranslationChunk.findAll({
|
||||||
where: {
|
where: {
|
||||||
chapterId: request.params.chapterId,
|
translationChapterId: request.params.chapterId,
|
||||||
index: {
|
index: {
|
||||||
[Op.between]: [
|
[Op.between]: [
|
||||||
previousIndex,
|
previousIndex,
|
||||||
@@ -146,28 +145,26 @@ module.exports = function (options) {
|
|||||||
limit: 3,
|
limit: 3,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chunk.Translation
|
association: db.TranslationChunk.Translation
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.Chunk.Chapter,
|
association: db.TranslationChunk.TranslationChapter,
|
||||||
required: true,
|
required: true,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chapter.ArtifactVersion,
|
association: db.TranslationChapter.TranslationArtifactVersion,
|
||||||
required: true,
|
required: true,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.ArtifactVersion.TranslationArtifactVersions,
|
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||||
required: true,
|
|
||||||
where: {
|
|
||||||
id: request.params.id
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Artifact,
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Artifact.Dialect
|
association: db.ArtifactVersion.Artifact,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Artifact.Dialect
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -176,16 +173,16 @@ module.exports = function (options) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(chunks => {
|
}).then(translationChunks => {
|
||||||
if (chunks.length > 0) {
|
if (translationChunks.length > 0) {
|
||||||
const chunk = chunks.find(chunk => chunk.index == Number(request.params.chunkIndex))
|
const translationChunk = translationChunks.find(translationChunk => translationChunk.index == Number(request.params.chunkIndex))
|
||||||
if (chunk) {
|
if (translationChunk) {
|
||||||
response.display("translate-chunk", {
|
response.display("translate-chunk", {
|
||||||
user: request.user,
|
user: request.user,
|
||||||
pageTitle: `Translate ${chunk.chapter.artifactVersion.artifact.name}`,
|
pageTitle: `Translate ${translationChunk.translationChapter.translationArtifactVersion.artifactVersion.artifact.name}`,
|
||||||
chunk: chunk,
|
translationChunk: translationChunk,
|
||||||
previousChunk: chunks.find(chunk => chunk.index == previousIndex),
|
previousTranslationChunk: translationChunks.find(translationChunk => translationChunk.index == previousIndex),
|
||||||
nextChunk: chunks.find(chunk => chunk.index == nextIndex)
|
nextTranslationChunk: translationChunks.find(translationChunk => translationChunk.index == nextIndex)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
response.redirect(`/translate/${request.params.id}/chapter/${request.params.chapterId}`)
|
response.redirect(`/translate/${request.params.id}/chapter/${request.params.chapterId}`)
|
||||||
@@ -199,35 +196,33 @@ module.exports = function (options) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.post(function(request, response, next) {
|
.post(function(request, response, next) {
|
||||||
db.Chunk.findOne({
|
db.TranslationChunk.findOne({
|
||||||
where: {
|
where: {
|
||||||
chapterId: request.params.chapterId,
|
translationChapterId: request.params.chapterId,
|
||||||
index: request.params.chunkIndex
|
index: request.params.chunkIndex
|
||||||
},
|
},
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chunk.Translation
|
association: db.TranslationChunk.Translation
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.Chunk.Chapter,
|
association: db.TranslationChunk.TranslationChapter,
|
||||||
required: true,
|
required: true,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Chapter.ArtifactVersion,
|
association: db.TranslationChapter.TranslationArtifactVersion,
|
||||||
required: true,
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.ArtifactVersion.TranslationArtifactVersions,
|
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||||
required: true,
|
|
||||||
where: {
|
|
||||||
id: request.params.id
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Artifact,
|
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
association: db.Artifact.Dialect
|
association: db.ArtifactVersion.Artifact,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Artifact.Dialect
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -236,15 +231,15 @@ module.exports = function (options) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(async (chunk) => {
|
}).then(async (translationChunk) => {
|
||||||
if (chunk) {
|
if (translationChunk) {
|
||||||
if (chunk.translation) {
|
if (translationChunk.translation) {
|
||||||
chunk.translation.text = request.body.translatedText
|
translationChunk.translation.text = request.body.translatedText
|
||||||
await chunk.translation.save()
|
await translationChunk.translation.save()
|
||||||
} else {
|
} else {
|
||||||
translation = await db.Translation.create({
|
translation = await db.Translation.create({
|
||||||
creatorId: request.user.id,
|
creatorId: request.user.id,
|
||||||
chunkId: chunk.id,
|
translationChunkId: translationChunk.id,
|
||||||
text: request.body.translatedText,
|
text: request.body.translatedText,
|
||||||
translationArtifactVersionId: request.params.id
|
translationArtifactVersionId: request.params.id
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -88,7 +88,13 @@ module.exports = function (options) {
|
|||||||
}).then(artifactVersion => {
|
}).then(artifactVersion => {
|
||||||
const isString = typeof request.body.text === "string" || request.body.text instanceof String
|
const isString = typeof request.body.text === "string" || request.body.text instanceof String
|
||||||
if (artifactVersion && isString) {
|
if (artifactVersion && isString) {
|
||||||
const chunks = request.body.text.trim().split(/\r?\n\r?\n/)
|
const chunks = request.body.text.trim().split(/\r?\n/).filter(text => {
|
||||||
|
if (text) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
db.Chapter.create({
|
db.Chapter.create({
|
||||||
creatorId: request.user.id,
|
creatorId: request.user.id,
|
||||||
name: chunks[0].trim(),
|
name: chunks[0].trim(),
|
||||||
@@ -176,6 +182,14 @@ module.exports = function (options) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.TranslationArtifactVersion.ForkedFrom
|
association: db.TranslationArtifactVersion.ForkedFrom
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.TranslationChapters,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationChapter.Chapter
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(translationArtifactVersion => {
|
}).then(translationArtifactVersion => {
|
||||||
@@ -237,6 +251,14 @@ module.exports = function (options) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.ArtifactVersion.TranslationArtifactVersions
|
association: db.ArtifactVersion.TranslationArtifactVersions
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.ArtifactVersion.Chapters,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Chapter.Chunks
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(async (artifactVersion) => {
|
}).then(async (artifactVersion) => {
|
||||||
@@ -259,7 +281,32 @@ module.exports = function (options) {
|
|||||||
name: dialect.name,
|
name: dialect.name,
|
||||||
artifactVersionId: artifactVersion.id,
|
artifactVersionId: artifactVersion.id,
|
||||||
dialectId: dialect.id,
|
dialectId: dialect.id,
|
||||||
entityId: request.user.individualEntityUser.entityUser.entityId
|
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||||
|
translationChapters: artifactVersion.chapters.map(chapter => {
|
||||||
|
return {
|
||||||
|
creatorId: request.user.id,
|
||||||
|
chapterId: chapter.id,
|
||||||
|
translationChunks: chapter.chunks.map(chunk => {
|
||||||
|
return {
|
||||||
|
creatorId: request.user.id,
|
||||||
|
chunkId: chunk.id,
|
||||||
|
text: chunk.text,
|
||||||
|
index: chunk.index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.TranslationChapters,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationChapter.TranslationChunks
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
if (translationArtifactVersion) {
|
if (translationArtifactVersion) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ block content
|
|||||||
a.btn.black(href=`/v/${artifactVersion.id}/translations/add`) add translation
|
a.btn.black(href=`/v/${artifactVersion.id}/translations/add`) add translation
|
||||||
|
|
||||||
if artifactVersion.translationArtifactVersions.length == 0
|
if artifactVersion.translationArtifactVersions.length == 0
|
||||||
p.flow-text No chapters added
|
p.flow-text No translations added
|
||||||
else
|
else
|
||||||
.row
|
.row
|
||||||
each translationArtifact in artifactVersion.translationArtifactVersions
|
each translationArtifact in artifactVersion.translationArtifactVersions
|
||||||
|
|||||||
@@ -3,20 +3,20 @@ extend templates/layout.pug
|
|||||||
block content
|
block content
|
||||||
.container
|
.container
|
||||||
.center
|
.center
|
||||||
h1= chapter.artifactVersion.translationArtifactVersions[0].name
|
h1= translationChapter.translationArtifactVersion.name
|
||||||
h2= chapter.artifactVersion.artifact.name
|
h2= translationChapter.translationArtifactVersion.artifactVersion.artifact.name
|
||||||
|
|
||||||
//- TODO: export to markdown...
|
//- TODO: export to markdown...
|
||||||
.row
|
.row
|
||||||
.col.s12
|
.col.s12
|
||||||
a.btn.black(href=`/translate/${chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${chapter.id}/markdown`) export markdown
|
a.btn.black(href=`/translate/${translationChapter.translationArtifactVersion.id}/chapter/${translationChapter.id}/markdown`) export markdown
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col.s12
|
.col.s12
|
||||||
each chunk in chapter.chunks
|
each translationChunk in translationChapter.translationChunks.sort((a,b) => a.index - b.index)
|
||||||
p.flow-text
|
p.flow-text
|
||||||
if chunk.translation
|
if translationChunk.translation
|
||||||
span= chunk.translation.text
|
span= translationChunk.translation.text
|
||||||
else
|
else
|
||||||
span.grey-text= chunk.text
|
span.grey-text= translationChunk.text
|
||||||
|
|
||||||
|
|||||||
@@ -3,34 +3,34 @@ extend templates/layout.pug
|
|||||||
block content
|
block content
|
||||||
.container
|
.container
|
||||||
.center
|
.center
|
||||||
h1= chapter.artifactVersion.translationArtifactVersions[0].name
|
h1= translationChapter.translationArtifactVersion.name
|
||||||
h2= chapter.artifactVersion.artifact.name
|
h2= translationChapter.translationArtifactVersion.artifactVersion.artifact.name
|
||||||
|
|
||||||
//- TODO: List chunks in the chapter
|
//- TODO: List translationChunks in the chapter
|
||||||
.row
|
.row
|
||||||
.col.s12
|
.col.s12
|
||||||
table
|
table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th #{chapter.artifactVersion.artifact.dialect.name}
|
th #{translationChapter.translationArtifactVersion.artifactVersion.artifact.dialect.name}
|
||||||
th #{chapter.artifactVersion.translationArtifactVersions[0].name}
|
th #{translationChapter.translationArtifactVersion.name}
|
||||||
th
|
th
|
||||||
|
|
||||||
tbody
|
tbody
|
||||||
each chunk in chapter.chunks
|
each translationChunk in translationChapter.translationChunks.sort((a,b) => a.index - b.index)
|
||||||
tr
|
tr
|
||||||
td= chunk.text
|
td= translationChunk.text
|
||||||
td
|
td
|
||||||
if chunk.translated
|
if translationChunk.translated
|
||||||
span= chunk.text
|
span= translationChunk.text
|
||||||
else if chunk.translation
|
else if translationChunk.translation
|
||||||
span= chunk.translation.text
|
span= translationChunk.translation.text
|
||||||
else
|
else
|
||||||
span.grey-text.lighten-4= chunk.text
|
span.grey-text.lighten-4= translationChunk.text
|
||||||
td
|
td
|
||||||
if chunk.translated
|
if translationChunk.translated
|
||||||
span nothing
|
span nothing
|
||||||
else if chunk.translation
|
else if translationChunk.translation
|
||||||
a.btn.blue(href=`/translate/${chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${chapter.id}/t/${chunk.index}`) edit
|
a.btn.blue(href=`/translate/${translationChapter.translationArtifactVersion.id}/chapter/${translationChapter.id}/t/${translationChunk.index}`) edit
|
||||||
else
|
else
|
||||||
a.btn.black(href=`/translate/${chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${chapter.id}/t/${chunk.index}`) translate
|
a.btn.black(href=`/translate/${translationChapter.translationArtifactVersion.id}/chapter/${translationChapter.id}/t/${translationChunk.index}`) translate
|
||||||
@@ -4,15 +4,15 @@ block content
|
|||||||
.container
|
.container
|
||||||
.center
|
.center
|
||||||
h1 Translate into
|
h1 Translate into
|
||||||
a(href=`/translate/${chunk.chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${chunk.chapter.id}`) #{chunk.chapter.artifactVersion.translationArtifactVersions[0].name}
|
a(href=`/translate/${translationChunk.translationChapter.translationArtifactVersion.id}/chapter/${translationChunk.translationChapter.id}`) #{translationChunk.translationChapter.translationArtifactVersion.name}
|
||||||
|
|
||||||
//- TODO: Show previous...
|
//- TODO: Show previous...
|
||||||
form.row(action=`/translate/${chunk.chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${chunk.chapter.id}/t/${chunk.index}`, method="post")
|
form.row(action=`/translate/${translationChunk.translationChapter.translationArtifactVersion.id}/chapter/${translationChunk.translationChapter.id}/t/${translationChunk.index}`, method="post")
|
||||||
.col.s12.m6.input-field
|
.col.s12.m6.input-field
|
||||||
textarea#original-text.materialize-textarea(name="originalText", readonly)= chunk.text
|
textarea#original-text.materialize-textarea(name="originalText", readonly)= translationChunk.text
|
||||||
label(for="original-text") Original Text
|
label(for="original-text") Original Text
|
||||||
.col.s12.m6.input-field
|
.col.s12.m6.input-field
|
||||||
textarea#translated-text.materialize-textarea(name="translatedText", placeholder=chunk.text)= chunk.translation ? chunk.translation.text : null
|
textarea#translated-text.materialize-textarea(name="translatedText", placeholder=translationChunk.text)= translationChunk.translation ? translationChunk.translation.text : null
|
||||||
label(for="original-text") Translated Text
|
label(for="original-text") Translated Text
|
||||||
.col.s12
|
.col.s12
|
||||||
.center
|
.center
|
||||||
@@ -22,63 +22,59 @@ block content
|
|||||||
.row
|
.row
|
||||||
.col.s12
|
.col.s12
|
||||||
ul.tabs#adjacent-tabs
|
ul.tabs#adjacent-tabs
|
||||||
if previousChunk
|
if previousTranslationChunk
|
||||||
li.tab.col.s6
|
li.tab.col.s6
|
||||||
a(href="#previous-translation") Previous Translation
|
a(href="#previous-translation") Previous Translation
|
||||||
if nextChunk
|
if nextTranslationChunk
|
||||||
li.tab.col.s6
|
li.tab.col.s6
|
||||||
a(href="#next-translation") Next Translation
|
a(href="#next-translation") Next Translation
|
||||||
if previousChunk
|
if previousTranslationChunk
|
||||||
.col.s12#previous-translation
|
.col.s12#previous-translation
|
||||||
table
|
table
|
||||||
//- thead
|
|
||||||
tr
|
|
||||||
th #{chunk.chapter.artifact.dialect.name}
|
|
||||||
th #{chunk.chapter.artifact.translationArtifactVersions[0].name}
|
|
||||||
th
|
|
||||||
tbody
|
tbody
|
||||||
tr
|
tr
|
||||||
td= previousChunk.text
|
td= previousTranslationChunk.text
|
||||||
td
|
td
|
||||||
if previousChunk.translated
|
if previousTranslationChunk.translated
|
||||||
span= previousChunk.text
|
span= previousTranslationChunk.text
|
||||||
else if previousChunk.translation
|
else if previousTranslationChunk.translation
|
||||||
span= previousChunk.translation.text
|
span= previousTranslationChunk.translation.text
|
||||||
else
|
else
|
||||||
span.grey-text= previousChunk.text
|
span.grey-text= previousTranslationChunk.text
|
||||||
td
|
td
|
||||||
if previousChunk.translated
|
if previousTranslationChunk.translated
|
||||||
span nothing
|
span nothing
|
||||||
else if previousChunk.translation
|
else if previousTranslationChunk.translation
|
||||||
a.btn.blue(href=`/translate/${previousChunk.chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${previousChunk.chapter.id}/t/${previousChunk.index}`) edit
|
a.btn.blue(href=`/translate/${previousTranslationChunk.translationChapter.translationArtifactVersion.id}/chapter/${previousTranslationChunk.translationChapter.id}/t/${previousTranslationChunk.index}`) edit
|
||||||
else
|
else
|
||||||
a.btn.black(href=`/translate/${previousChunk.chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${previousChunk.chapter.id}/t/${previousChunk.index}`) previous translation
|
a.btn.black(href=`/translate/${previousTranslationChunk.translationChapter.translationArtifactVersion.id}/chapter/${previousTranslationChunk.translationChapter.id}/t/${previousTranslationChunk.index}`) previous translation
|
||||||
|
|
||||||
if nextChunk
|
if nextTranslationChunk
|
||||||
.col.s12#next-translation
|
.col.s12#next-translation
|
||||||
table
|
table
|
||||||
//- thead
|
//- thead
|
||||||
tr
|
tr
|
||||||
th #{chunk.chapter.artifact.dialect.name}
|
th #{translationChunk.translationChapter.artifact.dialect.name}
|
||||||
th #{chunk.chapter.artifact.translationArtifactVersions[0].name}
|
th #{translationChunk.translationChapter.artifact.translationArtifactVersions[0].name}
|
||||||
th
|
th
|
||||||
tbody
|
tbody
|
||||||
tr
|
tr
|
||||||
td= nextChunk.text
|
td= nextTranslationChunk.text
|
||||||
td
|
td
|
||||||
if nextChunk.translated
|
if nextTranslationChunk.translated
|
||||||
span= nextChunk.text
|
span= nextTranslationChunk.text
|
||||||
else if nextChunk.translation
|
else if nextTranslationChunk.translation
|
||||||
span= nextChunk.translation.text
|
span= nextTranslationChunk.translation.text
|
||||||
else
|
else
|
||||||
span.grey-text= nextChunk.text
|
span.grey-text= nextTranslationChunk.text
|
||||||
td
|
td
|
||||||
if nextChunk.translated
|
if nextTranslationChunk.translated
|
||||||
span nothing
|
span nothing
|
||||||
else if nextChunk.translation
|
else if nextTranslationChunk.translation
|
||||||
a.btn.blue(href=`/translate/${nextChunk.chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${nextChunk.chapter.id}/t/${nextChunk.index}`) edit
|
a.btn.blue(href=`/translate/${nextTranslationChunk.translationChapter.translationArtifactVersion.id}/chapter/${nextTranslationChunk.translationChapter.id}/t/${nextTranslationChunk.index}`) edit
|
||||||
else
|
else
|
||||||
a.btn.black(href=`/translate/${nextChunk.chapter.artifactVersion.translationArtifactVersions[0].id}/chapter/${nextChunk.chapter.id}/t/${nextChunk.index}`) next translation
|
a.btn.black(href=`/translate/${nextTranslationChunk.translationChapter.translationArtifactVersion.id}/chapter/${nextTranslationChunk.translationChapter.id}/t/${nextTranslationChunk.index}`) next translation
|
||||||
|
|
||||||
|
|
||||||
block additionalScripts
|
block additionalScripts
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ block content
|
|||||||
//- TODO: Give summary of chapters...
|
//- TODO: Give summary of chapters...
|
||||||
|
|
||||||
h2 Chapters
|
h2 Chapters
|
||||||
each chapter in translationArtifactVersion.artifactVersion.chapters
|
each translationChapter in translationArtifactVersion.translationChapters
|
||||||
p.flow-text
|
p.flow-text
|
||||||
a(href=`/translate/${translationArtifactVersion.id}/chapter/${chapter.id}`)= chapter.name
|
a(href=`/translate/${translationArtifactVersion.id}/chapter/${translationChapter.id}`)= translationChapter.chapter.name
|
||||||
Reference in New Issue
Block a user