Export spreadsheet
This commit is contained in:
@@ -780,24 +780,24 @@ module.exports = function (options) {
|
|||||||
association: db.Artifact.Dialect
|
association: db.Artifact.Dialect
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Chapters,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.Chapter.Chunks,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.Chunk.Translation
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.TranslationArtifactVersion.Dialect
|
association: db.TranslationArtifactVersion.Dialect
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.TranslationChapters,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationChapter.TranslationChunks,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationChunk.Translation
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(translationArtifactVersions => {
|
}).then(translationArtifactVersions => {
|
||||||
@@ -853,14 +853,14 @@ module.exports = function (options) {
|
|||||||
.string(translationArtifactVersion.id)
|
.string(translationArtifactVersion.id)
|
||||||
|
|
||||||
var cellIndex = 6
|
var cellIndex = 6
|
||||||
for (const i in translationArtifactVersion.artifactVersion.chapters) {
|
for (const i in translationArtifactVersion.translationChapters) {
|
||||||
const chapter = translationArtifactVersion.artifactVersion.chapters[i]
|
const translationChapter = translationArtifactVersion.translationChapters[i]
|
||||||
const chunks = chapter.chunks.sort((a,b) => a.index - b.index)
|
const translationChunks = translationChapter.translationChunks.sort((a,b) => a.index - b.index)
|
||||||
for (const j in chunks) {
|
for (const j in translationChunks) {
|
||||||
const chunk = chunks[j]
|
const translationChunk = translationChunks[j]
|
||||||
|
|
||||||
worksheet.cell(cellIndex,2)
|
worksheet.cell(cellIndex,2)
|
||||||
.string(chunk.text)
|
.string(translationChunk.text)
|
||||||
.style({
|
.style({
|
||||||
alignment: {
|
alignment: {
|
||||||
wrapText: true,
|
wrapText: true,
|
||||||
@@ -876,22 +876,22 @@ module.exports = function (options) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (chunk.translation) {
|
if (translationChunk.translation) {
|
||||||
translationCell.string(chunk.translation.text)
|
translationCell.string(translationChunk.translation.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
const textLength = chunk.text.length
|
const textLength = translationChunk.text.length
|
||||||
worksheet.row(cellIndex).setHeight(
|
worksheet.row(cellIndex).setHeight(
|
||||||
Math.ceil(Math.max(textLength/cellWidth, 1)*cellHeight)
|
Math.ceil(Math.max(textLength/cellWidth, 1)*cellHeight)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Meta data...
|
// Meta data...
|
||||||
// ID for chunk
|
// ID for translationChunk
|
||||||
worksheet.cell(cellIndex,4)
|
worksheet.cell(cellIndex,4)
|
||||||
.string(chunk.id)
|
.string(translationChunk.id)
|
||||||
// ID for translation
|
// ID for translation
|
||||||
worksheet.cell(cellIndex,5)
|
worksheet.cell(cellIndex,5)
|
||||||
.string(chunk.translation?.id ?? "")
|
.string(translationChunk.translation?.id ?? "")
|
||||||
|
|
||||||
cellIndex++
|
cellIndex++
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ block content
|
|||||||
|
|
||||||
p.flow-text= project.description
|
p.flow-text= project.description
|
||||||
|
|
||||||
.row
|
if isOwnedByUser
|
||||||
.col.s12
|
.row
|
||||||
a.btn.black(href=`/projects/${project.id}/campaign`) funding campaign
|
.col.s12
|
||||||
|
a.btn.black(href=`/projects/${project.id}/campaign`) funding campaign
|
||||||
.row
|
.row
|
||||||
.col.s12
|
.col.s12
|
||||||
form(action=`/projects/${project.id}/spreadsheet`, method="post")
|
form(action=`/projects/${project.id}/spreadsheet`, method="post")
|
||||||
|
|||||||
Reference in New Issue
Block a user