Files
mantra.press/server/views/artifact-version.pug
2022-06-19 03:00:48 +02:00

79 lines
3.4 KiB
Plaintext

extend templates/layout.pug
block content
-
const isOwnedByUser = artifactVersion.artifact.owner.ownerEntities.some(ownerEntity => {
return ownerEntity.entity.entityUsers.some(entityUser => {
return entityUser.userId == user?.id
})
})
.container
.center
h1 #{artifactVersion.artifact.name}
if artifactVersion.artifact.visibility == "private"
i.right.medium.material-icons lock
h2 #{artifactVersion.tag}
p.flow-text
each ownerEntity, index in artifactVersion.artifact.owner.ownerEntities
small
if index > 0
span and
span.chip #{ownerEntity.entity.name}
if !isOwnedByUser
.row
.col.s12
a.btn.black(href=`/fork/e/${artifactVersion.id}`) fork
//- .row
.col.s12
a.btn.black(href=`/v/${artifactVersion.id}/campaign/create`) funding campaign
.row
.col.s12
if artifactVersion.artifactVersionApproval
p.flow-text Approval:
a(href=`/v/${artifactVersion.id}/approval`) #{artifactVersion.artifactVersionApproval.name}
else
p.flow-text No digital rights approval information has been provided for this content.
if isOwnedByUser
a.btn.black(href=`/v/${artifactVersion.id}/approval/add`) add approval information
if isOwnedByUser
.divider
.row
.col.s12
p.flow-text
-
const wordCount = artifactVersion.chapters.reduce((totalWordCount, chapter) => totalWordCount+chapter.wordCount, 0)
span.chip #{wordCount.toLocaleString()} words
.row
.col.s12
a.btn.black(href=`/v/${artifactVersion.id}/chapters/add`) add chapter
.col.s12
a.btn.black(href=`/v/${artifactVersion.id}/chapters/upload`) upload chapter(s)
if artifactVersion.chapters.length == 0
p.flow-text No chapters added
else
.row
each chapter in artifactVersion.chapters.sort((a, b) => a.index - b.index)
.col.s12
a(href=`/v/${artifactVersion.id}/chapters/${chapter.id}`)
.card-panel
p.flow-text= chapter.name
.divider
.row
if isOwnedByUser
a.btn.black(href=`/v/${artifactVersion.id}/translations/add`) add translation
if artifactVersion.translationArtifactVersions.length == 0
p.flow-text No translations added
else
.row
each translationArtifact in artifactVersion.translationArtifactVersions
.col.s12
a(href=`/translate/${translationArtifact.id}`)
.card-panel
p.flow-text= translationArtifact.name