Ver código fonte

:recycle: tweaking theme to display blog for posts

tags/0.9.0
J 4 anos atrás
pai
commit
325a9bd8ba

+ 5
- 1
vue-theme/src/components/breadcrumb.vue Ver arquivo

@@ -3,10 +3,14 @@
3 3
 nav.breadcrumb.f-row.start.t-up
4 4
     router-link(v-if="['event','exhibition'].includes(type)" :to="`/${type}/sorted/by-current-and-upcoming`")
5 5
         h5.t-up {{ type }}
6
+    router-link(v-else-if="type == 'post'" :to="`/blog`")
7
+        h5.t-up blog
6 8
     router-link(v-else :to="`/${type}`")
7 9
         h5.t-up {{ type }}
8 10
     h5  ➤ 
9
-    router-link(:to="`/${type}/${post.slug}`")
11
+    router-link(v-if="type == 'post'" :to="`/blog/${post.slug}`")
12
+        h5 {{ post.title }}
13
+    router-link(v-else :to="`/${type}/${post.slug}`")
10 14
         h5 {{ post.title }}
11 15
 </template>
12 16
 

+ 11
- 3
vue-theme/src/components/card.vue Ver arquivo

@@ -3,20 +3,28 @@
3 3
     header
4 4
         router-link(v-if="!hideType && ['event','exhibition'].includes(type)" :to="`/${type}/sorted/by-current-and-upcoming`")
5 5
             h4.t-up {{type}}
6
+        router-link(v-else-if="type == 'post'" :to="`/blog`")
7
+            h4.t-up blog
6 8
         router-link(v-else-if="!hideType" :to="`/${type}`")
7 9
             h4.t-up {{type}}
8 10
 
9 11
     article.card--info(:class="{ 'wide': wide }")
10
-        router-link(:to="`/${type}/${content.slug}`")
12
+        router-link(v-if="type == 'post'" :to="`/blog/${content.slug}`")
13
+            featured-image(:post="content", thumbsize="'standard'")
14
+        router-link(v-else :to="`/${type}/${content.slug}`")
11 15
             //- set image to thumbnail setting
12 16
             featured-image(:post="content", thumbsize="'standard'")
13 17
         .f-col.w-max(style="height: inherit")
14
-            router-link(:to="`/${type}/${content.slug}`")
18
+            router-link(v-if="type == 'post'" :to="`/blog/${content.slug}`")
19
+                h1.t-up.t-cntr.t-b {{ content.title }}
20
+            router-link(v-else :to="`/${type}/${content.slug}`")
15 21
                 h1.t-up.t-cntr.t-b {{ content.title }}
16 22
             p(v-if="content.end && type == 'event'" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event').split(',')[1] }}
17 23
             p(v-else-if="content.end" class="datetime") {{ dateFrom(content.start, type=='event') }} &ndash; {{ dateFrom(content.end, type=='event') }}
18 24
             p.excerpt {{ content.excerpt }}
19
-            router-link(:to="`/${type}/${content.slug}`")
25
+            router-link(v-if="type == 'post'" :to="`/blog/${content.slug}`")
26
+                p.read-more read more
27
+            router-link(v-else :to="`/${type}/${content.slug}`")
20 28
                 p.read-more read more
21 29
 </template>
22 30
 

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

@@ -74,11 +74,12 @@ export default {
74 74
          * Careful with name collisions with vuex helpers
75 75
          */
76 76
         singlePost() {
77
-            if (!this[this.type]) return
77
+            const postType = this.type == 'blog' ? 'post': this.type
78
+            if (!this[postType]) return
78 79
 
79 80
             // State not a getter!
80 81
             const singleOfTypeFromState =
81
-                this[this.type][`single${convertTitleCase(this.type)}`]
82
+                this[postType][`single${convertTitleCase(postType)}`]
82 83
 
83 84
             if (!singleOfTypeFromState) return
84 85
 
@@ -181,8 +182,9 @@ export default {
181 182
              * which is derived from the route
182 183
              */
183 184
             // modules are NOT plural because module key
184
-            if (!this.$store.state[this.type]) return
185
-            const allPostsOfTypeInStore = this.$store.state[this.type].all
185
+            const postType = this.type == 'blog' ? 'post': this.type
186
+            if (!this.$store.state[postType]) return
187
+            const allPostsOfTypeInStore = this.$store.state[postType].all
186 188
 
187 189
             /**
188 190
              * Load posts if they're not already in state
@@ -197,7 +199,7 @@ export default {
197 199
             if (!singlePostData) {
198 200
                 console.warn('Could not find single post in store; Fetching everything...')
199 201
                 const res = await this.$store.dispatch(
200
-                    `getAll${convertTitleCase(this.type)}s`,
202
+                    `getAll${convertTitleCase(postType)}s`,
201 203
                     { sortType: null, params: null }
202 204
                 )
203 205
                 singlePostData = res.filter(
@@ -211,7 +213,7 @@ export default {
211 213
             try {
212 214
                 this.checkAndSetHero(singlePostData)
213 215
                 await this.$store.dispatch(
214
-                    `getSingle${convertTitleCase(this.type)}`,
216
+                    `getSingle${convertTitleCase(postType)}`,
215 217
                     singlePostData.id,
216 218
                 )
217 219
             } catch (err) {

+ 1
- 0
vue-theme/src/store/index.js Ver arquivo

@@ -87,6 +87,7 @@ const store = new Vuex.Store({
87 87
     mutations,
88 88
     state,
89 89
     modules: {
90
+        'blog': post,
90 91
         post,
91 92
         page,
92 93
         artist,

Carregando…
Cancelar
Salvar