Tracker with filter ability

This commit is contained in:
kngako
2022-06-19 03:38:27 +02:00
parent 4d02795a45
commit f89bbf9573
2 changed files with 27 additions and 8 deletions

View File

@@ -1151,6 +1151,9 @@ module.exports = function (options) {
if (project) { if (project) {
db.TranslationChapter.findAll({ db.TranslationChapter.findAll({
include: [ include: [
{
association: db.TranslationChapter.Chapter,
},
{ {
association: db.TranslationChapter.TranslationChunks, association: db.TranslationChapter.TranslationChunks,
include: [ include: [
@@ -1186,9 +1189,16 @@ module.exports = function (options) {
} }
] ]
}, },
{ request.query.dialectId ? {
association: db.TranslationArtifactVersion.Dialect association: db.TranslationArtifactVersion.Dialect,
}, required: true,
where: {
id: request.query.dialectId
}
} : {
association: db.TranslationArtifactVersion.Dialect,
}
,
] ]
} }
] ]

View File

@@ -13,6 +13,10 @@ block content
p.flow-text= project.description p.flow-text= project.description
p.flow-text
-
const wordCount = translationChapters.reduce((totalWordCount, translationChapter) => totalWordCount+translationChapter.chapter.wordCount, 0)
span.chip #{wordCount.toLocaleString()} words
if isOwnedByUser if isOwnedByUser
.row .row
.col.s12 .col.s12
@@ -20,22 +24,27 @@ block content
.divider .divider
table table.highlight
thead thead
tr tr
th Title Text th Title Text
th language
th Artifact th Artifact
th Chapter th Chapter
th translator th translator
th proof reader th proof reader
th editor
tbody tbody
each translationChapter in translationChapters.sort((a, b) => a.index - b.index) each translationChapter in translationChapters.sort((a, b) => a.index - b.index)
tr tr(onclick=`window.location='/projects/${project.id}/tracker/${translationChapter.id}'`)
//- TODO: link to the translationChapter...
- -
const title = translationChapter.translationChunks.length > 0 ? translationChapter.translationChunks.sort((a, b) => a.index - b.index)[0].text : "N/A" const title = translationChapter.chapter.name
td(title=title)= title
td td
a.tracker-title-cell(href=`/projects/${project.id}/tracker/${translationChapter.id}`, title=title)= title a(href=`/projects/${project.id}/tracker?dialectId=${translationChapter.translationArtifactVersion.dialect.id}`)= translationChapter.translationArtifactVersion.dialect.name
td #{translationChapter.translationArtifactVersion.artifactVersion.artifact.name} - #{translationChapter.translationArtifactVersion.name} - #{translationChapter.translationArtifactVersion.artifactVersion.tag} td #{translationChapter.translationArtifactVersion.artifactVersion.artifact.name} - #{translationChapter.translationArtifactVersion.artifactVersion.tag}
td= translationChapter.index td= translationChapter.index
td td
td
td td