click toc add item to history #810

This commit is contained in:
2022-02-03 20:17:08 +01:00
parent 561038ef36
commit ae91e8bf1e
3 changed files with 26 additions and 5 deletions
+3 -3
View File
@@ -28,8 +28,8 @@ that is currently Firefox-only */
body{ body{
color: #1a1a1a; color: #1a1a1a;
background-image: url('/static/img/grille-ligne-de-base.png'); // background-image: url('/static/img/grille-ligne-de-base.png');
background-repeat: repeat; // background-repeat: repeat;
} }
#root{ #root{
@@ -446,7 +446,7 @@ section[role="main-content"]{
padding-right: 0; padding-right: 0;
>.wrapper{ >.wrapper{
padding-right: $pagenum_w*2; padding-right: $pagenum_w*2;
outline: orange solid thin; // outline: orange solid thin;
} }
div#text{ div#text{
// .infinite-loading-container{ // .infinite-loading-container{
+3 -1
View File
@@ -17,7 +17,9 @@
/> />
</h2> </h2>
<!-- <p v-if="preview" class="preview" v-html="preview" /> --> <!-- <p v-if="preview" class="preview" v-html="preview" /> -->
<aside> <aside
v-if="item.pages"
>
<span>{{ item.pages.prefix }} {{ item.pages.range }}</span> | <span>{{ item.size.quantity }} {{ item.size.unit }}</span> <span>{{ item.pages.prefix }} {{ item.pages.range }}</span> | <span>{{ item.size.quantity }} {{ item.size.unit }}</span>
</aside> </aside>
</article> </article>
+20 -1
View File
@@ -42,6 +42,8 @@
import TocItem from './TocItem' import TocItem from './TocItem'
import { mapState, mapActions } from 'vuex'
export default { export default {
name: 'TocItem', name: 'TocItem',
components: { components: {
@@ -57,6 +59,12 @@ export default {
isOpened: false isOpened: false
}), }),
computed: { computed: {
...mapState({
editionsbyuuid: state => state.Corpus.editionsbyuuid
}),
editionTitle () {
return this.editionsbyuuid[this.editionid].title
},
children () { children () {
// check if children exists and if it is an array // check if children exists and if it is an array
// this shoudn't be necessary // this shoudn't be necessary
@@ -110,8 +118,19 @@ export default {
} }
}, },
methods: { methods: {
...mapActions({
addHistoryItem: 'History/addItem'
}),
onclick (e) { onclick (e) {
// console.log('clicked on toc text', this.editionid, e) console.log('clicked on toc text', this.item, e)
this.addHistoryItem({
id: this.editionid,
textid: this.item.uuid,
title: this.item.title,
editionTitle: this.editionTitle
// pages: this.item.pages,
// size: this.item.size
})
this.$emit('onClickTocItem', e.target.getAttribute('uuid')) this.$emit('onClickTocItem', e.target.getAttribute('uuid'))
}, },
onClickTocItem (uuid) { onClickTocItem (uuid) {