displaying TOC items types & item without titles #1255

This commit is contained in:
2023-02-20 16:51:52 +01:00
parent 877d10b4d2
commit 232b44f3c6
2 changed files with 29 additions and 3 deletions
+14
View File
@@ -818,6 +818,17 @@ section[role="main-content"]{
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
line-height: $base-line / 2; line-height: $base-line / 2;
section.tocitem{
position: relative;
&:after{
display: block;
position:absolute;
top:0; right:0;
color: red;
content: attr(type);
font-size: 11px;
}
}
>ul{ >ul{
ul{ ul{
li{ li{
@@ -859,6 +870,9 @@ section[role="main-content"]{
&.loaded{ &.loaded{
color:$grisfonce; color:$grisfonce;
} }
&.notitle{
color: red;
}
} }
h2.toc-title{font-size: 1.1em;} h2.toc-title{font-size: 1.1em;}
h3.toc-title{font-size: 1em;} h3.toc-title{font-size: 1em;}
+15 -3
View File
@@ -2,13 +2,15 @@
<section <section
:uuid="item.uuid" :uuid="item.uuid"
:level="level" :level="level"
:type="item.type"
class="tocitem"
> >
<component <component
:is="titlelevel" :is="titlelevel"
v-if="title" v-if="title"
class="toc-title" class="toc-title"
:uuid="item.uuid" :uuid="item.uuid"
:class="{active: isActive, loaded: isLoaded}" :class="{active: isActive, loaded: isLoaded, notitle: noTitle}"
> >
<a <a
:href="'/edition/'+editionid+'/'+item.uuid" :href="'/edition/'+editionid+'/'+item.uuid"
@@ -56,7 +58,8 @@ export default {
loadedtextsuuids: Array loadedtextsuuids: Array
}, },
data: () => ({ data: () => ({
isOpened: false isOpened: false,
noTitle: false
}), }),
computed: { computed: {
...mapState({ ...mapState({
@@ -74,8 +77,11 @@ export default {
// this shoudn't be necessary // this shoudn't be necessary
if (this.item.title && Array.isArray(this.item.title)) { if (this.item.title && Array.isArray(this.item.title)) {
return this.item.title.join(' ') return this.item.title.join(' ')
} else { } else if (this.item.title) {
return this.item.title return this.item.title
} else {
console.log('TOC no title', this.item)
return this.item.type
} }
}, },
titlelevel () { titlelevel () {
@@ -116,6 +122,12 @@ export default {
if (typeof this.$route.params.textid !== 'undefined') { if (typeof this.$route.params.textid !== 'undefined') {
this.isOpened = this.$route.params.textid.indexOf(this.item.uuid) >= 0 this.isOpened = this.$route.params.textid.indexOf(this.item.uuid) >= 0
} }
if (['book', 'volume'].indexOf(this.item.type) >= 0) {
this.isOpened = true
}
if (!this.item.title) {
this.noTitle = true
}
}, },
methods: { methods: {
...mapActions({ ...mapActions({