add files & videos in query tags + parse data

This commit is contained in:
axolotle
2022-01-22 16:39:32 +01:00
parent 7b67f717c2
commit 25b5055d5f
2 changed files with 23 additions and 7 deletions
+13
View File
@@ -10,6 +10,17 @@ fragment NodePartial on MapItemInterface {
url
alt
}
videos {
url
}
fichiers {
fid
filename
filemime
url
}
}
... on Textprod {
@@ -35,6 +46,8 @@ fragment NodePartial on MapItemInterface {
title
}
files: fichiers {
fid
filename
filemime
url
}
+10 -7
View File
@@ -41,15 +41,17 @@ export default {
if (node.type === 'Creation') {
node.variant = [{ id: 0 }]
if (node.files && node.files.length) {
const mime = node.files[0].filemime
const creationFile = node.files.shift()
if (!node.files.length) node.files = null
const mime = creationFile.filemime
if (mime === 'application/pdf') {
node.iframeUrl = node.files[0].url + '#toolbar=0&navpanes=0&statusbar=0'
node.iframeUrl = creationFile.url + '#toolbar=0&navpanes=0&statusbar=0'
} else if (mime === 'text/html') {
node.iframeUrl = node.files[0].url
node.iframeUrl = creationFile.url
} else if (['audio', 'video'].some(type => mime.includes(type))) {
node.mediaItem = {
is: mime.includes('audio') ? 'audio' : 'video',
src: node.files[0].url
src: creationFile.url
}
} else if (node.piece && node.piece.url) {
node.iframeUrl = node.piece.url
@@ -57,15 +59,16 @@ export default {
} else if (node.piece && node.piece.url) {
node.iframeUrl = node.piece.url
}
if (node.images && node.images.length) {
node.image = node.images.shift()
}
}
if (node.date) {
node.date.start = formatDate(node.date.start)
}
if (node.images && node.images.length) {
node.image = node.images[0]
}
if ('creations' in node) {
if (node.creations) {