|
|
@@ -1,10 +1,9 @@
|
|
1
|
1
|
<template lang="pug">
|
|
2
|
2
|
.page--single.f-row.between(v-if="$route.params.slug")
|
|
3
|
|
- gallery(:fullscreengallery="fullscreengallery" v-on:close="fullscreengallery = false" :images="images" :startwith="lastImageClicked")
|
|
|
3
|
+ gallery(:fullscreengallery="fullscreengallery" v-on:close="fullscreengallery = -1" :images="images")
|
|
4
|
4
|
article.f-grow.shadow
|
|
5
|
5
|
header
|
|
6
|
6
|
h1 {{ type }}:{{ $route.params.slug }} single
|
|
7
|
|
- button(@click="fullscreengallery = true") fullscreen
|
|
8
|
7
|
section(v-if="posts[$route.params.slug]")
|
|
9
|
8
|
h4 {{ posts[$route.params.slug].title }}
|
|
10
|
9
|
.block-wrapper(v-for="block in posts[$route.params.slug].blocks" v-html="block")
|
|
|
@@ -33,8 +32,7 @@ export default {
|
|
33
|
32
|
data() {
|
|
34
|
33
|
return {
|
|
35
|
34
|
images: [],
|
|
36
|
|
- fullscreengallery: false,
|
|
37
|
|
- lastImageClicked: 0
|
|
|
35
|
+ fullscreengallery: -1
|
|
38
|
36
|
}
|
|
39
|
37
|
},
|
|
40
|
38
|
computed: {
|
|
|
@@ -85,9 +83,7 @@ export default {
|
|
85
|
83
|
const gallery = document.querySelectorAll('.blocks-gallery-item figure, figure.wp-block-image')
|
|
86
|
84
|
gallery.forEach((item, i) => {
|
|
87
|
85
|
item.addEventListener('click', () => {
|
|
88
|
|
- this.lastImageClicked = i
|
|
89
|
|
- console.log('yeah!', this.lastImageClicked)
|
|
90
|
|
- this.fullscreengallery = true
|
|
|
86
|
+ this.fullscreengallery = i
|
|
91
|
87
|
})
|
|
92
|
88
|
})
|
|
93
|
89
|
}
|
|
|
@@ -96,7 +92,6 @@ export default {
|
|
96
|
92
|
posts(newVal, oldVal) {
|
|
97
|
93
|
// Loads images from the DOM
|
|
98
|
94
|
this.checkForImages(newVal)
|
|
99
|
|
- this.wrapImagesWithLink()
|
|
100
|
95
|
}
|
|
101
|
96
|
},
|
|
102
|
97
|
mounted() {
|
|
|
@@ -104,6 +99,8 @@ export default {
|
|
104
|
99
|
let type = this.$route.params.type
|
|
105
|
100
|
type = type.charAt(0).toUpperCase() + type.slice(1)
|
|
106
|
101
|
this.$store.dispatch(`getAll${type}`)
|
|
|
102
|
+
|
|
|
103
|
+ this.wrapImagesWithLink()
|
|
107
|
104
|
}
|
|
108
|
105
|
}
|
|
109
|
106
|
</script>
|