Explorar el Código

:recycle: showing subtype in list and hero

tags/1.0.0^2
J hace 3 años
padre
commit
be93eff9af

+ 8
- 6
vue-theme/src/pages/list.vue Ver fichero

4
 
4
 
5
         header.center.t-up
5
         header.center.t-up
6
             .title.f-row
6
             .title.f-row
7
-                h3(v-if="!isSearch") {{ type }}s 
8
-                h3(v-else-if="!hasSubtype") {{ type }}: {{ $route.query.type }}s 
9
-                h3(v-else-if="isSearch") Search results for: {{$route.query.s }} 
10
-                h3(v-else) {{ type }}s 
7
+                h3(v-if="!isSearch && !hasSubtype") {{ type }}s 
8
+                h3(v-else-if="hasSubtype") {{ type }}s: {{ $route.query.type }} 
9
+                h3(v-else) Search results for: {{$route.query.s }} 
11
                 span(v-if="sortBy")
10
                 span(v-if="sortBy")
12
                     h3 {{ sortBy.replace('-', ' ') }}
11
                     h3 {{ sortBy.replace('-', ' ') }}
13
 
12
 
181
         // _setHeroInfo(post) {} from mixin
180
         // _setHeroInfo(post) {} from mixin
182
         // _clearHero(store) {} from mixin
181
         // _clearHero(store) {} from mixin
183
         async checkAndSetHero(type) {
182
         async checkAndSetHero(type) {
184
-            console.log('hero type :', type)
183
+            // console.log('hero type :', type)
185
             this._clearHero(this.$store)
184
             this._clearHero(this.$store)
186
             try {
185
             try {
187
                 const page = await this.getPage(type)
186
                 const page = await this.getPage(type)
188
                 // We always set a hero no matter what
187
                 // We always set a hero no matter what
189
                 // Because the hero component will deal
188
                 // Because the hero component will deal
190
                 // with how to render based on hero.url
189
                 // with how to render based on hero.url
191
-                this.$store.commit('SET_HERO', this._setHeroInfo(page))
190
+                const heroJson = this._setHeroInfo(page)
191
+                heroJson.subtype = this.$route.query.type
192
+                console.log(heroJson)
193
+                this.$store.commit('SET_HERO', heroJson)
192
             } catch (err) { console.error(err) }
194
             } catch (err) { console.error(err) }
193
         },
195
         },
194
         setIntersectionLoader(cb) {
196
         setIntersectionLoader(cb) {

+ 1
- 2
vue-theme/src/pages/mixin-post-types.js Ver fichero

47
 const heroUtils = {
47
 const heroUtils = {
48
     methods: {
48
     methods: {
49
         _setHeroInfo(post) {
49
         _setHeroInfo(post) {
50
-            let json = { url: post.featured, heroType:'image' }
50
+            let json = { url: post.featured, heroType: 'image' }
51
             if (
51
             if (
52
                 post.hero &&
52
                 post.hero &&
53
                 JSON.parse(post.hero) &&
53
                 JSON.parse(post.hero) &&
86
             }
86
             }
87
            
87
            
88
             // post.type == 'page' && post.slug == 'thing' || post.type == 'page' && post.slug == 'otherthing'
88
             // post.type == 'page' && post.slug == 'thing' || post.type == 'page' && post.slug == 'otherthing'
89
-
90
             return json
89
             return json
91
         },
90
         },
92
         _clearHero(store) {
91
         _clearHero(store) {

+ 1
- 2
vue-theme/src/store/index.js Ver fichero

41
 
41
 
42
 const mutations = {
42
 const mutations = {
43
     SET_HERO(state, hero) {
43
     SET_HERO(state, hero) {
44
-        console.log(hero)
45
         if (!hero.url) {
44
         if (!hero.url) {
46
             console.warn('No hero url to set')
45
             console.warn('No hero url to set')
47
             state.hero.url = null
46
             state.hero.url = null
50
             state.hero.playbutton = false
49
             state.hero.playbutton = false
51
         } else {
50
         } else {
52
             // console.warn('Setting hero', hero)
51
             // console.warn('Setting hero', hero)
53
-            state.hero.text = hero.text
52
+            state.hero.text = hero.subtype ? hero.subtype : hero.text
54
             state.hero.url = hero.url
53
             state.hero.url = hero.url
55
             state.hero.type = hero.heroType
54
             state.hero.type = hero.heroType
56
 
55
 

Loading…
Cancelar
Guardar