Move route to translate page
This commit is contained in:
@@ -91,7 +91,7 @@ module.exports = function (options) {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
if (forkedTranslationArtifactVersion) {
|
if (forkedTranslationArtifactVersion) {
|
||||||
return response.redirect(`/v/${forkedTranslationArtifactVersion.artifactVersionId}/translations/${forkedTranslationArtifactVersion.id}`)
|
return response.redirect(`/translate/${forkedTranslationArtifactVersion.id}`)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
@@ -168,7 +168,7 @@ module.exports = function (options) {
|
|||||||
request.user.individualEntityUser.entityUser.entityId
|
request.user.individualEntityUser.entityUser.entityId
|
||||||
)
|
)
|
||||||
if (forkedTranslationArtifactVersion) {
|
if (forkedTranslationArtifactVersion) {
|
||||||
return response.redirect(`/v/${forkedTranslationArtifactVersion.artifactVersionId}/translations/${forkedTranslationArtifactVersion.id}`)
|
return response.redirect(`/translate/${forkedTranslationArtifactVersion.id}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,31 +9,93 @@ module.exports = function (options) {
|
|||||||
.get(function(request, response, next) {
|
.get(function(request, response, next) {
|
||||||
db.TranslationArtifactVersion.findByPk(request.params.id, {
|
db.TranslationArtifactVersion.findByPk(request.params.id, {
|
||||||
include: [
|
include: [
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.ArtifactVersion.Artifact,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Artifact.Owner,
|
||||||
|
// required: false,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Owner.OwnerEntities,
|
||||||
|
// required: true,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.OwnerEntity.Entity,
|
||||||
|
// required: false,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Entity.EntityUsers,
|
||||||
|
required: false,
|
||||||
|
where: {
|
||||||
|
userId: request.user.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.ArtifactVersion.Chapters
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.ForkedFrom
|
||||||
|
},
|
||||||
{
|
{
|
||||||
association: db.TranslationArtifactVersion.TranslationChapters,
|
association: db.TranslationArtifactVersion.TranslationChapters,
|
||||||
limit: 1,
|
include: [
|
||||||
required: true
|
{
|
||||||
|
association: db.TranslationChapter.Chapter
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.Owner,
|
||||||
|
// required: false,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Owner.OwnerEntities,
|
||||||
|
// required: true,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.OwnerEntity.Entity,
|
||||||
|
// required: false,
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
association: db.Entity.EntityUsers,
|
||||||
|
required: false,
|
||||||
|
where: {
|
||||||
|
userId: request.user.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// 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) {
|
||||||
// Show translation without artifactVersion
|
response.display("translation-artifact-version", {
|
||||||
response.redirect(`/translate/${translationArtifactVersion.id}/chapter/${translationArtifactVersion.translationChapters[0].id}`)
|
user: request.user,
|
||||||
|
pageTitle: "Translation Artifact - Mantra",
|
||||||
|
translationArtifactVersion: translationArtifactVersion,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
next(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -248,100 +248,6 @@ module.exports = function (options) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
router.route('/:id/translations/:translationArtifactVersionId')
|
|
||||||
.get(function(request, response, next) {
|
|
||||||
db.TranslationArtifactVersion.findByPk(request.params.translationArtifactVersionId, {
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.TranslationArtifactVersion.ArtifactVersion,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Artifact,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.Artifact.Owner,
|
|
||||||
// required: false,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.Owner.OwnerEntities,
|
|
||||||
// required: true,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.OwnerEntity.Entity,
|
|
||||||
// required: false,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.Entity.EntityUsers,
|
|
||||||
required: false,
|
|
||||||
where: {
|
|
||||||
userId: request.user.id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.ArtifactVersion.Chapters
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.TranslationArtifactVersion.ForkedFrom
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.TranslationArtifactVersion.TranslationChapters,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.TranslationChapter.Chapter
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
association: db.TranslationArtifactVersion.Owner,
|
|
||||||
// required: false,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.Owner.OwnerEntities,
|
|
||||||
// required: true,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.OwnerEntity.Entity,
|
|
||||||
// required: false,
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
association: db.Entity.EntityUsers,
|
|
||||||
required: false,
|
|
||||||
where: {
|
|
||||||
userId: request.user.id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}).then(translationArtifactVersion => {
|
|
||||||
if (translationArtifactVersion) {
|
|
||||||
response.display("translation-artifact-version", {
|
|
||||||
user: request.user,
|
|
||||||
pageTitle: "Translation Artifact - Mantra",
|
|
||||||
translationArtifactVersion: translationArtifactVersion,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
next()
|
|
||||||
}
|
|
||||||
}).catch(error => {
|
|
||||||
next(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
router.route('/:id/translations/add')
|
router.route('/:id/translations/add')
|
||||||
.get(function(request, response, next) {
|
.get(function(request, response, next) {
|
||||||
db.ArtifactVersion.findByPk(request.params.id, {
|
db.ArtifactVersion.findByPk(request.params.id, {
|
||||||
@@ -459,7 +365,7 @@ module.exports = function (options) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (translationArtifactVersion) {
|
if (translationArtifactVersion) {
|
||||||
return response.redirect(`/v/${artifactVersion.id}/translations/${translationArtifactVersion.id}`)
|
return response.redirect(`/translate/${translationArtifactVersion.id}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,6 @@ block content
|
|||||||
.row
|
.row
|
||||||
each translationArtifact in artifactVersion.translationArtifactVersions
|
each translationArtifact in artifactVersion.translationArtifactVersions
|
||||||
.col.s12
|
.col.s12
|
||||||
a(href=`/v/${artifactVersion.id}/translations/${translationArtifact.id}`)
|
a(href=`/translate/${translationArtifact.id}`)
|
||||||
.card-panel
|
.card-panel
|
||||||
p.flow-text= translationArtifact.name
|
p.flow-text= translationArtifact.name
|
||||||
@@ -21,5 +21,5 @@ block content
|
|||||||
h2 forks
|
h2 forks
|
||||||
each translationArtifactVersion in translationArtifactVersions
|
each translationArtifactVersion in translationArtifactVersions
|
||||||
p.flow-text
|
p.flow-text
|
||||||
a(href=`/v/${translationArtifactVersion.artifactVersionId}/translations/${translationArtifactVersion.id}`)= translationArtifactVersion.name
|
a(href=`/translate/${translationArtifactVersion.id}`)= translationArtifactVersion.name
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ block content
|
|||||||
|
|
||||||
if translationArtifactVersion.forkedFrom
|
if translationArtifactVersion.forkedFrom
|
||||||
p.flow-text is a
|
p.flow-text is a
|
||||||
a(href=`/v/${translationArtifactVersion.forkedFrom.artifactVersionId}/translations/${translationArtifactVersion.forkedFrom.id}`) fork
|
a(href=`/translate/${translationArtifactVersion.forkedFrom.id}`) fork
|
||||||
|
|
||||||
//- TODO: Condition to show translate button
|
//- TODO: Condition to show translate button
|
||||||
.row
|
.row
|
||||||
|
|||||||
Reference in New Issue
Block a user