diff --git a/assets/css/app.scss b/assets/css/app.scss
index c3e6edf..612c736 100644
--- a/assets/css/app.scss
+++ b/assets/css/app.scss
@@ -953,6 +953,18 @@ section[role="main-content"]{
// }
}
+ div#indexes-filters{
+ // height:$pager_h;
+ overflow: hidden;
+ box-sizing: content-box;
+ padding:1em 0 0 1.5em;
+ select{
+ option{
+ padding:0;
+ }
+ }
+ }
+
div#page-nav{
height:$pager_h;
overflow: hidden;
diff --git a/src/components/Content/EdIndexes.vue b/src/components/Content/EdIndexes.vue
new file mode 100644
index 0000000..acc3330
--- /dev/null
+++ b/src/components/Content/EdIndexes.vue
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
diff --git a/src/pages/Edition.vue b/src/pages/Edition.vue
index 723d30a..6d0977d 100644
--- a/src/pages/Edition.vue
+++ b/src/pages/Edition.vue
@@ -109,6 +109,11 @@
:loadedtextsuuids="textsuuids"
@onClickTocItem="onClickTocItem"
/>
+
({
@@ -150,6 +157,7 @@ export default {
editionid: null,
textid: null,
extract: null,
+ extractid: null,
texts: [],
textsuuids: [],
metainfotitle: undefined,
@@ -172,6 +180,8 @@ export default {
toc: null,
flattoc: null,
//
+ indexes: null,
+ //
pagination: null,
//
navopened: false
@@ -272,8 +282,8 @@ export default {
console.log('Edition Corpus/setTocs', this.editionid, state.Corpus.editionsbyuuid)
this.toc = state.Corpus.editionsbyuuid[this.editionid].toc
}
- if (mutation.type === 'Corpus/buildFlatTocs') {
- console.log('Edition Corpus/buildFlatTocs', this.editionid, state.Corpus.editionsbyuuid)
+ if (mutation.type === 'Corpus/buildFlatTocsAndFilters') {
+ console.log('Edition Corpus/buildFlatTocsAndFilters', this.editionid, state.Corpus.editionsbyuuid)
this.flattoc = state.Corpus.editionsbyuuid[this.editionid].flattoc
// launch infinitloading
this.inifinite_load_id += 1
@@ -282,6 +292,8 @@ export default {
// get the first item
// will be replaced by front page of edition
if (!this.textid) { this.textid = this.flattoc[1] }
+ //
+ this.indexes = state.Corpus.editionsbyuuid[this.editionid].indexes
}
if (mutation.type === 'Corpus/setPaginations') {
// console.log('Edition state.Coprus.editionsbyuuid', this.editionid, state.Corpus.editionsbyuuid)
@@ -302,6 +314,7 @@ export default {
// get the first item
// will be replaced by front page of edition
if (!this.textid) { this.textid = this.toc[0].children[0].uuid }
+ this.indexes = this.editionsbyuuid[this.editionid].indexes
this.pagination = this.editionsbyuuid[this.editionid].pagination
}
},
diff --git a/src/store/modules/corpus.js b/src/store/modules/corpus.js
index 626dfa0..9f2f184 100644
--- a/src/store/modules/corpus.js
+++ b/src/store/modules/corpus.js
@@ -41,24 +41,51 @@ export default {
})
// console.log('corpus editionsbyuuid', state.editionsbyuuid)
},
- buildFlatTocs (state, eeuid) {
- let recurseFlatToc = (state, eduuid, a) => {
- // console.log('recurseFlatToc', a)
+ buildFlatTocsAndFilters (state) {
+ let recurseToc = (state, eduuid, a) => {
+ // console.log('recurseToc', a)
a.forEach((item, i) => {
if (item) {
+ // flatToc
state.editionsbyuuid[eduuid].flattoc.push(item.uuid)
state.numTocsItem++
+
+ // filters
+ let indexes = item.indexes[0]
+ for (const key in indexes) {
+ // loop through indexes (objects, persons, places)
+ if (Object.hasOwnProperty.call(indexes, key)) {
+ indexes[key].forEach(element => {
+ // loop through index elements
+ if (!(element.uuid in state.editionsbyuuid[eduuid].indexes[key])) {
+ state.editionsbyuuid[eduuid].indexes[key][element.uuid] = element
+ }
+ })
+ }
+ }
+
+ // recursive loop
if (item.children && item.children.length) {
- recurseFlatToc(state, eduuid, item.children)
+ recurseToc(state, eduuid, item.children)
}
}
})
}
state.editionsuuids.forEach((eduuid, i) => {
- // console.log('buildFlatTocs', i, eduuid)
+ // console.log('buildFlatTocsAndFilters', i, eduuid)
state.editionsbyuuid[eduuid].flattoc = []
- recurseFlatToc(state, eduuid, state.editionsbyuuid[eduuid].toc)
- // console.log('buildFlatTocs DONE', eduuid, state.editionsbyuuid[eduuid].flattoc)
+ state.editionsbyuuid[eduuid].indexes = {
+ objects: {},
+ persons: {},
+ places: {}
+ }
+ recurseToc(state, eduuid, state.editionsbyuuid[eduuid].toc)
+ console.log('buildFlatTocsAndFilters DONE',
+ eduuid,
+ `places: ${Object.keys(state.editionsbyuuid[eduuid].indexes['places']).length}`,
+ `objects: ${Object.keys(state.editionsbyuuid[eduuid].indexes['objects']).length}`,
+ `persons: ${Object.keys(state.editionsbyuuid[eduuid].indexes['persons']).length}`,
+ state.editionsbyuuid[eduuid].indexes)
})
console.log('numTocsItem', state.numTocsItem)
},
@@ -73,6 +100,7 @@ export default {
console.info('corpusLoaded')
state.corpusLoaded = true
}
+
},
// actions
@@ -84,11 +112,6 @@ export default {
.then(({ data }) => {
// 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', data.content)
.then((editionslist) => {
console.log('all texts returned: editionslist', editionslist)
@@ -99,9 +122,7 @@ export default {
.then((tocslist) => {
console.log('all tocs returned: tocslist', tocslist)
commit('setTocs', tocslist)
- // this.methods.testMethod()
- // dispatch('buildFlatTocs')
- commit('buildFlatTocs')
+ commit('buildFlatTocsAndFilters')
dispatch('getEditionsPaginations')
.then((paginationslist) => {
console.log('all paginations returned: paginationslist', paginationslist)
@@ -188,38 +209,6 @@ export default {
})
}))
}
- // ,
- // buildFlatTocs ({ dispatch, commit, state }) {
- // state.editionsuuids.forEach((eduuid, i) => {
- // // console.log('buildFlatTocs', i, eduuid)
- // dispatch('recurseFlatToc', state.editionsbyuuid[eduuid].toc)
- // .then((ft) => {
- // console.log('buildFlatTocs DONE', eduuid, ft)
- // state.editionsbyuuid[eduuid].flattoc = ft
- // })
- // })
- // },
- // recurseFlatToc ({ dispatch, commit, state }, a) {
- // // console.log('recurseFlatToc', a)
- // let na = []
- // // a.forEach((item, i) => {
- // return Promise.all(a.map(function (item) {
- // console.log('item', item)
- // na.push(item.uuid)
- // if (item.children && item.children.length) {
- // return dispatch('recurseFlatToc', item.children)
- // .then((nna) => {
- // console.log('recurseFlatToc: na, nna', na, nna)
- // na.concat(nna)
- // })
- // }
- // // else {
- // // return na
- // // }
- // }))
- // // })
- // // return na
- // }
},
methods: {
testMethod () {