Add a tracker
This commit is contained in:
@@ -1120,6 +1120,93 @@ module.exports = function (options) {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.route('/:id/tracker')
|
||||||
|
.get(function(request, response, next) {
|
||||||
|
db.Project.findByPk(request.params.id, {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Project.Owner,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Owner.OwnerEntities,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.OwnerEntity.Entity,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Entity.EntityUsers,
|
||||||
|
required: false,
|
||||||
|
where: {
|
||||||
|
userId: request.user?.id ?? null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).then(async (project) => {
|
||||||
|
if (project) {
|
||||||
|
db.TranslationChapter.findAll({
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationChapter.TranslationChunks,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationChunk.Translation
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationChapter.TranslationArtifactVersion,
|
||||||
|
required: true,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.ProjectTranslationArtifactVersions,
|
||||||
|
required: true,
|
||||||
|
where: {
|
||||||
|
projectId: request.params.id
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.ArtifactVersion.ProjectArtifactVersions
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.ArtifactVersion.Artifact,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Artifact.Dialect
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.Dialect
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}).then(translationChapters => {
|
||||||
|
response.display("project-tracker", {
|
||||||
|
user: request.user,
|
||||||
|
project: project,
|
||||||
|
translationChapters: translationChapters
|
||||||
|
})
|
||||||
|
}).catch(error => {
|
||||||
|
next(error)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const getProjectArtifactVersion = (userId, project, artifactVersion) => {
|
const getProjectArtifactVersion = (userId, project, artifactVersion) => {
|
||||||
if (project.projectArtifactVersions.length == 0) {
|
if (project.projectArtifactVersions.length == 0) {
|
||||||
return db.ProjectArtifactVersion.create({
|
return db.ProjectArtifactVersion.create({
|
||||||
|
|||||||
@@ -49,3 +49,9 @@ html {
|
|||||||
.bitcoin-address {
|
.bitcoin-address {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tracker-title-cell {
|
||||||
|
width: 1rem;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
41
server/views/project-tracker.pug
Normal file
41
server/views/project-tracker.pug
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
extend templates/layout.pug
|
||||||
|
|
||||||
|
block content
|
||||||
|
-
|
||||||
|
const isOwnedByUser = project.owner.ownerEntities.some(ownerEntity => {
|
||||||
|
return ownerEntity.entity.entityUsers.some(entityUser => {
|
||||||
|
return entityUser.userId == user?.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.container
|
||||||
|
.center
|
||||||
|
h1= project.name
|
||||||
|
|
||||||
|
p.flow-text= project.description
|
||||||
|
|
||||||
|
if isOwnedByUser
|
||||||
|
.row
|
||||||
|
.col.s12
|
||||||
|
a.btn.black(href=`/projects/${project.id}/tracker/trail`) audit trail
|
||||||
|
|
||||||
|
.divider
|
||||||
|
|
||||||
|
table
|
||||||
|
thead
|
||||||
|
tr
|
||||||
|
th Title Text
|
||||||
|
th Artifact
|
||||||
|
th Chapter
|
||||||
|
th translator
|
||||||
|
th proof reader
|
||||||
|
tbody
|
||||||
|
each translationChapter in translationChapters.sort((a, b) => a.index - b.index)
|
||||||
|
tr
|
||||||
|
-
|
||||||
|
const title = translationChapter.translationChunks.length > 0 ? translationChapter.translationChunks.sort((a, b) => a.index - b.index)[0].text : "N/A"
|
||||||
|
td
|
||||||
|
a.tracker-title-cell(href=`/projects/${project.id}/tracker/${translationChapter.id}`, title=title)= title
|
||||||
|
td #{translationChapter.translationArtifactVersion.artifactVersion.artifact.name} - #{translationChapter.translationArtifactVersion.name} - #{translationChapter.translationArtifactVersion.artifactVersion.tag}
|
||||||
|
td= translationChapter.index
|
||||||
|
td
|
||||||
|
td
|
||||||
@@ -17,6 +17,9 @@ block content
|
|||||||
.row
|
.row
|
||||||
.col.s12
|
.col.s12
|
||||||
a.btn.black(href=`/projects/${project.id}/campaign`) funding campaign
|
a.btn.black(href=`/projects/${project.id}/campaign`) funding campaign
|
||||||
|
.row
|
||||||
|
.col.s12
|
||||||
|
a.btn.black(href=`/projects/${project.id}/tracker`) tracker
|
||||||
.row
|
.row
|
||||||
.col.s12
|
.col.s12
|
||||||
form(action=`/projects/${project.id}/sheets`, method="post")
|
form(action=`/projects/${project.id}/sheets`, method="post")
|
||||||
|
|||||||
Reference in New Issue
Block a user