Selaa lähdekoodia

:sparkles: rudimentary grid flag for list page

tags/0.9.0
J 5 vuotta sitten
vanhempi
commit
539748522f
2 muutettua tiedostoa jossa 23 lisäystä ja 8 poistoa
  1. 22
    7
      vue-theme/src/pages/list.vue
  2. 1
    1
      vue-theme/src/pages/single.vue

+ 22
- 7
vue-theme/src/pages/list.vue Näytä tiedosto

5
             h1 {{ type }} list
5
             h1 {{ type }} list
6
             span(v-if="sortBy")
6
             span(v-if="sortBy")
7
                 h1  sorted by {{ sortBy.replace('-', ' ') }}
7
                 h1  sorted by {{ sortBy.replace('-', ' ') }}
8
-        
8
+
9
         section.shadow
9
         section.shadow
10
             h4 {{ type }}
10
             h4 {{ type }}
11
             p {{ Object.values(posts).length }}
11
             p {{ Object.values(posts).length }}
12
             p {{ sidebar }}
12
             p {{ sidebar }}
13
-
14
-        section(v-for="post in posts").shadow
15
-            router-link(:to="`/${type}/${post.slug}`")
16
-                h4 {{ post.title }} 
17
-                p(style="font-size: 9px;") {{ post.date }}
13
+        
14
+        .posts(:class="{ 'is-grid': isGrid }")
15
+            section(v-for="post in posts").shadow
16
+                router-link(:to="`/${type}/${post.slug}`")
17
+                    h4 {{ post.title }} 
18
+                    p(style="font-size: 9px;") {{ post.date }}
18
 
19
 
19
     sidebar(v-if="sidebar" :type="`${type}`")
20
     sidebar(v-if="sidebar" :type="`${type}`")
20
         .shadow
21
         .shadow
54
             allEpisodes: 'allEpisodes',
55
             allEpisodes: 'allEpisodes',
55
             allEpisodesLoaded: 'allEpisodesLoaded',
56
             allEpisodesLoaded: 'allEpisodesLoaded',
56
         }),
57
         }),
58
+        isGrid() {
59
+            return this.$route.query.grid === 'true'
60
+        },
57
         type() { // Checks for type and fixes Episodes route edge case 
61
         type() { // Checks for type and fixes Episodes route edge case 
58
             return typeFromRoute(this.$route)
62
             return typeFromRoute(this.$route)
59
         },
63
         },
89
         
93
         
90
         this.$store.dispatch(`getAll${type}`, this.sortBy)
94
         this.$store.dispatch(`getAll${type}`, this.sortBy)
91
         this.$store.commit('SET_HERO', type)
95
         this.$store.commit('SET_HERO', type)
96
+        console.log(this.isGrid)
92
     }
97
     }
93
 }
98
 }
94
-</script>
99
+</script>
100
+
101
+<style lang="postcss">
102
+article
103
+    .is-grid
104
+        display: flex
105
+        flex-direction: row
106
+        section
107
+            width: 33%
108
+
109
+</style>

+ 1
- 1
vue-theme/src/pages/single.vue Näytä tiedosto

73
     },
73
     },
74
     methods: {
74
     methods: {
75
         pageBlocks(posts) {
75
         pageBlocks(posts) {
76
-            if(!posts) return []
76
+            if(!posts || !posts[this.$route.params.slug]) return []
77
             return posts[this.$route.params.slug].blocks.map(block => {
77
             return posts[this.$route.params.slug].blocks.map(block => {
78
                 if(block) return block
78
                 if(block) return block
79
             })
79
             })

Loading…
Peruuta
Tallenna