added exctract coming from niminum index #765

This commit is contained in:
2022-03-04 15:31:34 +01:00
parent 27455eb300
commit 848349c1f3
3 changed files with 41 additions and 6 deletions
+25 -3
View File
@@ -29,7 +29,7 @@
<!-- default slot -->
<IndexItemOcurrences v-if="content" :content="content" />
<template v-slot:nav>
<template v-if="content" v-slot:nav>
<section v-if="content.attestedForms" class="attested-forms">
<h3>Attested forms</h3>
<ul>
@@ -67,13 +67,13 @@ export default {
title: `Nominum ${this.$route.params.id}`
}
},
beforeCreate () {
created () {
console.log('nominum this.$route', this.$route)
REST.get(`${window.apipath}/indexNominum/` + this.$route.params.id, {})
.then(({ data }) => {
console.log('nominum REST: data', data)
if (data.content) {
this.content = data.content
this.parseOccurences(data.content)
}
})
.catch((error) => {
@@ -84,6 +84,28 @@ export default {
query: { fullpath: this.$route.path }
})
})
},
methods: {
parseOccurences (content) {
console.log('parseOccurences', content)
for (let i = 0; i < content.occurences.length; i++) {
let ed = content.occurences[i]
for (let j = 0; j < ed.occurences.length; j++) {
let o = ed.occurences[j]
const uuid = o.uuid
for (let k = 0; k < content.attestedForms.length; k++) {
const form = content.attestedForms[k]
if (form.uuid.indexOf(uuid) >= 0) {
content.occurences[i].occurences[j].form = form.title
break
}
console.warn('no form for occurence', o.uuid, o.title)
content.occurences[i].occurences[j].form = ''
}
}
}
this.content = content
}
}
}
</script>