better corpus list display
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<ul>
|
||||
<li><router-link to="/corpus">Corpus</router-link></li>
|
||||
<li>
|
||||
<span>Index</span>
|
||||
<span>Indexs</span>
|
||||
<ul>
|
||||
<li><router-link to="/nominum">Personnes</router-link></li>
|
||||
<li><router-link to="/locorum">Lieux</router-link></li>
|
||||
|
||||
@@ -7,9 +7,17 @@
|
||||
|
||||
<ul v-if="editionslist.length" class="item-list">
|
||||
<li v-for="(corpus,index) in editionslist" :key="index">
|
||||
<h2>{{ corpus.meta.author }}</h2>
|
||||
<ul>
|
||||
<li v-for="text in corpus.content" :key="text.uuid">
|
||||
<header>
|
||||
<h2>{{ corpus.author.title }}</h2>
|
||||
<h3>{{ corpus.author.date }}</h3>
|
||||
<section class="editions">
|
||||
<h4 class="editions-quantity">{{ corpus.author.editionsQuantity }}</h4>
|
||||
<div v-if="corpus.author.editions" class="editions" v-html="corpus.author.editions"/>
|
||||
</section>
|
||||
<h4 class="texts-quantity">{{ corpus.author.textsQuantity }}</h4>
|
||||
</header>
|
||||
<ul class="texts-list">
|
||||
<li v-for="text in corpus.editions.content" :key="text.uuid">
|
||||
<h3>
|
||||
<a
|
||||
:href="text.url"
|
||||
|
||||
+13
-10
@@ -33,11 +33,11 @@ export default {
|
||||
console.log('getCorpuses authors data', data)
|
||||
commit('setAuthors', data.content)
|
||||
// get the texts list for each corpus (aka author)
|
||||
let authorsUuids = []
|
||||
for (let author of data.content) {
|
||||
authorsUuids.push(author.uuid)
|
||||
}
|
||||
dispatch('getEditionsList', authorsUuids)
|
||||
// let authorsUuids = []
|
||||
// for (let author of data.content) {
|
||||
// authorsUuids.push(author.uuid)
|
||||
// }
|
||||
dispatch('getEditionsList', data.content)
|
||||
.then((editionslist) => {
|
||||
console.log('all texts returned: editionslist', editionslist)
|
||||
commit('setEditionslist', editionslist)
|
||||
@@ -58,16 +58,19 @@ export default {
|
||||
})
|
||||
},
|
||||
// get editionslist
|
||||
getEditionsList ({ dispatch, commit, state }, authorsUuids) {
|
||||
return Promise.all(authorsUuids.map(function (uuid) {
|
||||
return REST.get(`/corpus/` + uuid, {})
|
||||
getEditionsList ({ dispatch, commit, state }, authors) {
|
||||
return Promise.all(authors.map(function (author) {
|
||||
return REST.get(`/corpus/` + author.uuid, {})
|
||||
.then(({ data }) => {
|
||||
console.log('corpus getEditionsList REST: data', data)
|
||||
console.log('corpus getEditionsList REST: author, data', author, data)
|
||||
// work arround
|
||||
if (!Array.isArray(data.content)) {
|
||||
data.content = [data.content]
|
||||
}
|
||||
return data
|
||||
return {
|
||||
author: author,
|
||||
editions: data
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('Issue with getEditionsList', error)
|
||||
|
||||
Reference in New Issue
Block a user