add files & videos in query tags + parse data
This commit is contained in:
@@ -10,6 +10,17 @@ fragment NodePartial on MapItemInterface {
|
|||||||
url
|
url
|
||||||
alt
|
alt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
videos {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
|
||||||
|
fichiers {
|
||||||
|
fid
|
||||||
|
filename
|
||||||
|
filemime
|
||||||
|
url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
... on Textprod {
|
... on Textprod {
|
||||||
@@ -35,6 +46,8 @@ fragment NodePartial on MapItemInterface {
|
|||||||
title
|
title
|
||||||
}
|
}
|
||||||
files: fichiers {
|
files: fichiers {
|
||||||
|
fid
|
||||||
|
filename
|
||||||
filemime
|
filemime
|
||||||
url
|
url
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-7
@@ -41,15 +41,17 @@ export default {
|
|||||||
if (node.type === 'Creation') {
|
if (node.type === 'Creation') {
|
||||||
node.variant = [{ id: 0 }]
|
node.variant = [{ id: 0 }]
|
||||||
if (node.files && node.files.length) {
|
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') {
|
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') {
|
} else if (mime === 'text/html') {
|
||||||
node.iframeUrl = node.files[0].url
|
node.iframeUrl = creationFile.url
|
||||||
} else if (['audio', 'video'].some(type => mime.includes(type))) {
|
} else if (['audio', 'video'].some(type => mime.includes(type))) {
|
||||||
node.mediaItem = {
|
node.mediaItem = {
|
||||||
is: mime.includes('audio') ? 'audio' : 'video',
|
is: mime.includes('audio') ? 'audio' : 'video',
|
||||||
src: node.files[0].url
|
src: creationFile.url
|
||||||
}
|
}
|
||||||
} else if (node.piece && node.piece.url) {
|
} else if (node.piece && node.piece.url) {
|
||||||
node.iframeUrl = node.piece.url
|
node.iframeUrl = node.piece.url
|
||||||
@@ -57,15 +59,16 @@ export default {
|
|||||||
} else if (node.piece && node.piece.url) {
|
} else if (node.piece && node.piece.url) {
|
||||||
node.iframeUrl = node.piece.url
|
node.iframeUrl = node.piece.url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.images && node.images.length) {
|
||||||
|
node.image = node.images.shift()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.date) {
|
if (node.date) {
|
||||||
node.date.start = formatDate(node.date.start)
|
node.date.start = formatDate(node.date.start)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.images && node.images.length) {
|
|
||||||
node.image = node.images[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('creations' in node) {
|
if ('creations' in node) {
|
||||||
if (node.creations) {
|
if (node.creations) {
|
||||||
|
|||||||
Reference in New Issue
Block a user