corpus index filtering ok #1801
This commit is contained in:
@@ -880,6 +880,7 @@ section[role="main-content"]{
|
||||
|
||||
.toc-title{
|
||||
@include title4grey;
|
||||
color: $grismoyen;
|
||||
&.active,
|
||||
&:hover{
|
||||
color:$grisfonce;
|
||||
@@ -891,6 +892,10 @@ section[role="main-content"]{
|
||||
&.notitle{
|
||||
color: red;
|
||||
}
|
||||
&.disabled{
|
||||
color: $grisclair;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
h2.toc-title{font-size: 1.1em;}
|
||||
h3.toc-title{font-size: 1em;}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
$bleuroi: rgb(61,82,102);
|
||||
$bleuroilight: lighten(rgb(61,82,102), 30%);
|
||||
$gris: rgb(200,204,204);
|
||||
$grisclair: rgb(230,234,234);
|
||||
$gris: rgb(190,194,194);
|
||||
$grismoyen: rgb(150,150,160);
|
||||
$grisfonce: rgb(57,57,64);
|
||||
$or: rgb(179,161,125);
|
||||
$rouge: rgb(204,61,82);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
:calculate-position="dropDownMenuPos"
|
||||
:options="opts"
|
||||
:clearable="true"
|
||||
:value="getSeletedValue(key)"
|
||||
@input="onClickIndexItem"
|
||||
>
|
||||
<template v-slot:option="option">
|
||||
@@ -33,29 +34,32 @@ export default {
|
||||
},
|
||||
data: () => ({
|
||||
options: {},
|
||||
persons_selected: '',
|
||||
objects_selected: '',
|
||||
places_selected: ''
|
||||
indexes_keys: [],
|
||||
persons_selected: null,
|
||||
objects_selected: null,
|
||||
places_selected: null
|
||||
}),
|
||||
created () {
|
||||
this.parseIndexesToOptions()
|
||||
},
|
||||
// watch: {
|
||||
// loadedtextsuuids (n, o) {
|
||||
// console.log('EdToc watch loadedtxtsuuids', o, n)
|
||||
// }
|
||||
// },
|
||||
watch: {
|
||||
persons_selected (n, o) {
|
||||
console.log('EdIndexes watch persons_selected', o, n)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
parseIndexesToOptions () {
|
||||
console.log('EdIndexes parseIndexesToOptions', this.indexes)
|
||||
Object.keys(this.indexes).forEach(key => {
|
||||
// console.log('OPTION', key)
|
||||
this.indexes_keys.push(key)
|
||||
this.options[key] = []
|
||||
Object.keys(this.indexes[key]).forEach(uuid => {
|
||||
// console.log('OPTIONS ITEM', key, uuid)
|
||||
this.options[key].push({
|
||||
code: uuid,
|
||||
label: `${this.indexes[key][uuid].title} [${this.indexes[key][uuid].quantity}]`
|
||||
label: `${this.indexes[key][uuid].title} [${this.indexes[key][uuid].quantity}]`,
|
||||
index: key
|
||||
})
|
||||
})
|
||||
if (!this.options[key].length) {
|
||||
@@ -105,9 +109,20 @@ export default {
|
||||
*/
|
||||
return () => popper.destroy()
|
||||
},
|
||||
getSeletedValue (key) {
|
||||
return this[`${key}_selected`]
|
||||
},
|
||||
onClickIndexItem (o) {
|
||||
console.log('onClickIndexItem', o)
|
||||
this.indexes_keys.forEach(key => {
|
||||
if (o && key === o.index) {
|
||||
this[`${key}_selected`] = o
|
||||
} else {
|
||||
this[`${key}_selected`] = null
|
||||
}
|
||||
})
|
||||
// this.page_selected = o
|
||||
// this.$emit('onClickPaginationItem', o)
|
||||
this.$emit('onClickIndexItem', o)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
:level="1"
|
||||
:editionid="$route.params.id"
|
||||
:loadedtextsuuids="loadedtextsuuids"
|
||||
:selectedindex="selectedindex"
|
||||
@onClickTocItem="onClickTocItem"
|
||||
@onScrollToRef="onScrollToRef"
|
||||
/>
|
||||
@@ -29,7 +30,8 @@ export default {
|
||||
},
|
||||
props: {
|
||||
toc: Array,
|
||||
loadedtextsuuids: Array
|
||||
loadedtextsuuids: Array,
|
||||
selectedindex: Object
|
||||
},
|
||||
// watch: {
|
||||
// reftoscrollto: function (newref, oldref) {
|
||||
|
||||
@@ -4,14 +4,28 @@
|
||||
:level="level"
|
||||
:type="item.type"
|
||||
class="tocitem"
|
||||
:class="{active: isActive, loaded: isLoaded, notitle: noTitle, init_opened: isInitOpened, opened: isOpened}"
|
||||
:class="{
|
||||
active: isActive,
|
||||
loaded: isLoaded,
|
||||
notitle: noTitle,
|
||||
init_opened: isInitOpened,
|
||||
opened: isOpened,
|
||||
disabled: isDisabled
|
||||
}"
|
||||
>
|
||||
<component
|
||||
:is="titlelevel"
|
||||
v-if="title"
|
||||
class="toc-title"
|
||||
:uuid="item.uuid"
|
||||
:class="{active: isActive, loaded: isLoaded, notitle: noTitle, init_opened: isInitOpened, opened: isOpened}"
|
||||
:class="{
|
||||
active: isActive,
|
||||
loaded: isLoaded,
|
||||
notitle: noTitle,
|
||||
init_opened: isInitOpened,
|
||||
opened: isOpened,
|
||||
disabled: isDisabled
|
||||
}"
|
||||
>
|
||||
<a
|
||||
:href="'/texts/'+editionid+'/'+item.uuid"
|
||||
@@ -35,6 +49,7 @@
|
||||
:level="nextLevel"
|
||||
:editionid="editionid"
|
||||
:loadedtextsuuids="loadedtextsuuids"
|
||||
:selectedindex="selectedindex"
|
||||
@onClickTocItem="onClickTocItem"
|
||||
@onScrollToRef="onScrollToRef"
|
||||
/>
|
||||
@@ -58,7 +73,8 @@ export default {
|
||||
item: Object,
|
||||
level: Number,
|
||||
editionid: String,
|
||||
loadedtextsuuids: Array
|
||||
loadedtextsuuids: Array,
|
||||
selectedindex: Object
|
||||
},
|
||||
data: () => ({
|
||||
isInitOpened: false,
|
||||
@@ -108,6 +124,16 @@ export default {
|
||||
// but not for isOpened (had to use a watcher + beforeMount)
|
||||
// don't now why ?
|
||||
return this.loadedtextsuuids.indexOf(this.item.uuid) !== -1
|
||||
},
|
||||
isDisabled () {
|
||||
let disabled = false
|
||||
if (this.selectedindex &&
|
||||
(!this.flat_indexes.length || this.flat_indexes.indexOf(this.selectedindex.code) === -1)
|
||||
) {
|
||||
// console.log('tocitem disabled ?', this.selectedindex.code)
|
||||
disabled = true
|
||||
}
|
||||
return disabled
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -123,6 +149,15 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.flat_indexes = []
|
||||
Object.keys(this.item.indexes[0]).forEach(index => {
|
||||
this.item.indexes[0][index].forEach(element => {
|
||||
this.flat_indexes.push(element.uuid)
|
||||
})
|
||||
})
|
||||
console.log('tocItem created flat_indexes', this.flat_indexes)
|
||||
},
|
||||
beforeMount () {
|
||||
if (typeof this.$route.params.textid !== 'undefined') {
|
||||
this.isOpened = this.$route.params.textid.indexOf(this.item.uuid) >= 0
|
||||
|
||||
@@ -107,12 +107,14 @@
|
||||
id="toc"
|
||||
:toc="toc"
|
||||
:loadedtextsuuids="textsuuids"
|
||||
:selectedindex="selectedindex"
|
||||
@onClickTocItem="onClickTocItem"
|
||||
/>
|
||||
<EdIndexes
|
||||
v-if="indexes"
|
||||
id="indexes-filters"
|
||||
:indexes="indexes"
|
||||
@onClickIndexItem="onClickIndexItem"
|
||||
/>
|
||||
<EdPagination
|
||||
v-if="pagination"
|
||||
@@ -181,6 +183,7 @@ export default {
|
||||
flattoc: null,
|
||||
//
|
||||
indexes: null,
|
||||
selectedindex: null,
|
||||
//
|
||||
pagination: null,
|
||||
//
|
||||
@@ -431,6 +434,9 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
onClickIndexItem (o) {
|
||||
this.selectedindex = o
|
||||
},
|
||||
onClickPaginationItem (o) {
|
||||
console.log('onClickPaginationItem', o)
|
||||
if (this.textsuuids.indexOf(o.uuid) !== -1) {
|
||||
|
||||
Reference in New Issue
Block a user