diff --git a/src/api/fragments/NodePartial.gql b/src/api/fragments/NodePartial.gql index 5fdf6ca..eff6afe 100644 --- a/src/api/fragments/NodePartial.gql +++ b/src/api/fragments/NodePartial.gql @@ -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 } diff --git a/src/store/nodes.js b/src/store/nodes.js index 6bdb781..53fbfc8 100644 --- a/src/store/nodes.js +++ b/src/store/nodes.js @@ -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) {