add Creation queries fields & simulate it as a text_produit
This commit is contained in:
@@ -5,7 +5,7 @@ fragment NodeFull on MapItemInterface {
|
|||||||
|
|
||||||
... on Textref {
|
... on Textref {
|
||||||
preTitle: field_titre_regular
|
preTitle: field_titre_regular
|
||||||
title: field_titre_italique
|
italTitle: field_titre_italique
|
||||||
link: lien_reference {
|
link: lien_reference {
|
||||||
title
|
title
|
||||||
url
|
url
|
||||||
@@ -33,6 +33,7 @@ fragment NodeFull on MapItemInterface {
|
|||||||
variant: familles {
|
variant: familles {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|
||||||
... on Textprod {
|
... on Textprod {
|
||||||
parents: text_de_depart {
|
parents: text_de_depart {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ fragment NodeInitial on MapItemInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
preTitle: field_titre_regular
|
preTitle: field_titre_regular
|
||||||
title: field_titre_italique
|
italTitle: field_titre_italique
|
||||||
|
|
||||||
edition {
|
edition {
|
||||||
name
|
name
|
||||||
@@ -75,5 +75,42 @@ fragment NodeInitial on MapItemInterface {
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creations: field_creations {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
... on Creation {
|
||||||
|
parents: texte_de_depart {
|
||||||
|
id
|
||||||
|
variant: familles {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
siblings: rebonds {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
|
||||||
|
authors: auteurs {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
first_name
|
||||||
|
last_name
|
||||||
|
}
|
||||||
|
|
||||||
|
date {
|
||||||
|
start
|
||||||
|
# end
|
||||||
|
}
|
||||||
|
|
||||||
|
images {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
alt
|
||||||
|
}
|
||||||
|
|
||||||
|
title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ fragment NodePartial on MapItemInterface {
|
|||||||
strangeness: degres_detrangement
|
strangeness: degres_detrangement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
... on Creation {
|
||||||
|
content: texte
|
||||||
|
}
|
||||||
|
|
||||||
# For debug
|
# For debug
|
||||||
path
|
path
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<span><strong>{{ toCommaList(node.authors) }}</strong>,</span>
|
<span><strong>{{ toCommaList(node.authors) }}</strong>,</span>
|
||||||
<span>
|
<span>
|
||||||
<span v-if="node.preTitle" v-html="' ' + trim(node.preTitle) + ','" />
|
<span v-if="node.preTitle" v-html="' ' + trim(node.preTitle) + ','" />
|
||||||
<em v-html="' ' + trim(node.title) || 'pas de titre ital'" />
|
<em v-html="' ' + trim(node.italTitle) || 'pas de titre ital'" />
|
||||||
<span v-if="edition && node.edition">, </span>
|
<span v-if="edition && node.edition">, </span>
|
||||||
</span>
|
</span>
|
||||||
<div v-if="edition && node.edition" class="edition">
|
<div v-if="edition && node.edition" class="edition">
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
"reflexion": "Réflexion théorique",
|
"reflexion": "Réflexion théorique",
|
||||||
"lecture": "Lecture rapprochée",
|
"lecture": "Lecture rapprochée",
|
||||||
"sensible": "Expérience sensible",
|
"sensible": "Expérience sensible",
|
||||||
"kit": "Fiche-outil de désapprentisage"
|
"kit": "Fiche-outil de désapprentisage",
|
||||||
|
"creation": "Création numérique"
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"display": {
|
"display": {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
getUniqueNodesIds,
|
getUniqueNodesIds,
|
||||||
getRelatedNodesIds,
|
getRelatedNodesIds,
|
||||||
getRandomIds,
|
getRandomIds,
|
||||||
|
parseTree,
|
||||||
buildTree
|
buildTree
|
||||||
} from '@/store/utils.js'
|
} from '@/store/utils.js'
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ export default {
|
|||||||
commit('SET_NODE_DEPART_ID', id)
|
commit('SET_NODE_DEPART_ID', id)
|
||||||
|
|
||||||
if (!(id in state.trees)) {
|
if (!(id in state.trees)) {
|
||||||
const treeData = await api.queryRecursiveNodes([id])
|
const treeData = parseTree(await api.queryRecursiveNodes([id]))
|
||||||
const nodes = await dispatch('GET_NODES', { ids: getUniqueNodesIds(treeData), dataLevel: 'initial' })
|
const nodes = await dispatch('GET_NODES', { ids: getUniqueNodesIds(treeData), dataLevel: 'initial' })
|
||||||
commit('ADD_NODE_TREE', [id, buildTree(treeData, nodes)])
|
commit('ADD_NODE_TREE', [id, buildTree(treeData, nodes)])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,19 @@ export default {
|
|||||||
function addNode (node, level) {
|
function addNode (node, level) {
|
||||||
const stateNode = node.id in state.nodes ? state.nodes[node.id] : undefined
|
const stateNode = node.id in state.nodes ? state.nodes[node.id] : undefined
|
||||||
|
|
||||||
|
if ('creations' in node) {
|
||||||
|
if (node.creations) {
|
||||||
|
if (!Array.isArray(node.children)) {
|
||||||
|
node.children = []
|
||||||
|
}
|
||||||
|
node.creations.forEach(item => {
|
||||||
|
item.variant = [{ id: 0 }]
|
||||||
|
node.children.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
delete node.creations
|
||||||
|
}
|
||||||
|
|
||||||
if (node.variant === null || Array.isArray(node.variant)) {
|
if (node.variant === null || Array.isArray(node.variant)) {
|
||||||
node.variant = node.variant !== null ? ID_VARIANTS[node.variant[0].id] : 'dark'
|
node.variant = node.variant !== null ? ID_VARIANTS[node.variant[0].id] : 'dark'
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-2
@@ -20,8 +20,8 @@ export const ID_VARIANTS = {
|
|||||||
6: 'reflexion',
|
6: 'reflexion',
|
||||||
7: 'lecture',
|
7: 'lecture',
|
||||||
8: 'sensible',
|
8: 'sensible',
|
||||||
23: 'kit'
|
23: 'kit',
|
||||||
// undefined: 'creation'
|
0: 'creation'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VARIANT_IDS = Object.fromEntries(
|
export const VARIANT_IDS = Object.fromEntries(
|
||||||
@@ -86,6 +86,30 @@ export function getRandomIds (ids, count = 3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function parseTree (treeData) {
|
||||||
|
if ('creations' in treeData) {
|
||||||
|
if (treeData.creations) {
|
||||||
|
if (!Array.isArray(treeData.children)) {
|
||||||
|
treeData.children = []
|
||||||
|
}
|
||||||
|
treeData.creations.forEach(item => {
|
||||||
|
item.variant = [{ id: 0 }]
|
||||||
|
treeData.children.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
delete treeData.creations
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const relation of RELATIONS) {
|
||||||
|
if (relation in treeData && treeData[relation]) {
|
||||||
|
treeData[relation] = treeData[relation].map(node => parseTree(node))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return treeData
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function buildTree (treeData, nodesData) {
|
export function buildTree (treeData, nodesData) {
|
||||||
const uniqueIds = []
|
const uniqueIds = []
|
||||||
const nodes = []
|
const nodes = []
|
||||||
|
|||||||
Reference in New Issue
Block a user