Ver código fonte

bug: removed conditional button for gallery

tags/0.9.0
John Maeda 6 anos atrás
pai
commit
59a45042a7
1 arquivos alterados com 8 adições e 7 exclusões
  1. 8
    7
      vue-theme/src/pages/single.vue

+ 8
- 7
vue-theme/src/pages/single.vue Ver arquivo

4
     article.f-grow.shadow
4
     article.f-grow.shadow
5
         header
5
         header
6
             h1 {{ type }}:{{ $route.params.slug }} single
6
             h1 {{ type }}:{{ $route.params.slug }} single
7
-            button(v-if="images.length > 0" @click="fullscreengallery = true") fullscreen
7
+            button(@click="fullscreengallery = true") fullscreen
8
         section(v-if="posts[$route.params.slug]")
8
         section(v-if="posts[$route.params.slug]")
9
             h4 {{ posts[$route.params.slug].title }}
9
             h4 {{ posts[$route.params.slug].title }}
10
             .block-wrapper(v-for="block in posts[$route.params.slug].blocks" v-html="block")
10
             .block-wrapper(v-for="block in posts[$route.params.slug].blocks" v-html="block")
70
             })
70
             })
71
             allBlocks.forEach(block => {
71
             allBlocks.forEach(block => {
72
                 if(!block) return
72
                 if(!block) return
73
-
74
-                const domparser = new DOMParser()
75
-                const doc = domparser.parseFromString(block, 'text/html')
76
-
73
+                const doc = new DOMParser().parseFromString(block, 'text/html')
77
                 const gallery = doc.querySelectorAll('.blocks-gallery-item img')
74
                 const gallery = doc.querySelectorAll('.blocks-gallery-item img')
78
                 if(gallery) {
75
                 if(gallery) {
79
-                    this.images = [].slice.call(gallery).map(item => { return item.src })
76
+                    this.images = [].slice.call(gallery).map(item => { 
77
+                        return item.src }
78
+                    )
80
                 }
79
                 }
81
             })
80
             })
82
         }
81
         }
83
     },
82
     },
84
     watch: {
83
     watch: {
85
-        posts(newVal, oldVal) {
84
+        posts(newVal, oldVal) { 
85
+            // Loads images from the DOM
86
             this.checkForImages(newVal)
86
             this.checkForImages(newVal)
87
         }
87
         }
88
     },
88
     },
89
     mounted() {
89
     mounted() {
90
+        // Only makes req if this hasn't been loaded yet
90
         if(!this.posts[this.$route.params.slug]) {
91
         if(!this.posts[this.$route.params.slug]) {
91
             let type = this.$route.params.type
92
             let type = this.$route.params.type
92
             type = type.charAt(0).toUpperCase() + type.slice(1)
93
             type = type.charAt(0).toUpperCase() + type.slice(1)

Carregando…
Cancelar
Salvar