소스 검색

:recycle: showing subtype in list and hero

tags/1.0.0^2
J 3 년 전
부모
커밋
be93eff9af
3개의 변경된 파일10개의 추가작업 그리고 10개의 파일을 삭제
  1. 8
    6
      vue-theme/src/pages/list.vue
  2. 1
    2
      vue-theme/src/pages/mixin-post-types.js
  3. 1
    2
      vue-theme/src/store/index.js

+ 8
- 6
vue-theme/src/pages/list.vue 파일 보기

@@ -4,10 +4,9 @@
4 4
 
5 5
         header.center.t-up
6 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 10
                 span(v-if="sortBy")
12 11
                     h3 {{ sortBy.replace('-', ' ') }}
13 12
 
@@ -181,14 +180,17 @@ export default {
181 180
         // _setHeroInfo(post) {} from mixin
182 181
         // _clearHero(store) {} from mixin
183 182
         async checkAndSetHero(type) {
184
-            console.log('hero type :', type)
183
+            // console.log('hero type :', type)
185 184
             this._clearHero(this.$store)
186 185
             try {
187 186
                 const page = await this.getPage(type)
188 187
                 // We always set a hero no matter what
189 188
                 // Because the hero component will deal
190 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 194
             } catch (err) { console.error(err) }
193 195
         },
194 196
         setIntersectionLoader(cb) {

+ 1
- 2
vue-theme/src/pages/mixin-post-types.js 파일 보기

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

+ 1
- 2
vue-theme/src/store/index.js 파일 보기

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

Loading…
취소
저장