|
|
@@ -6,7 +6,7 @@
|
|
6
|
6
|
.title.f-row
|
|
7
|
7
|
h3 {{ type }} list
|
|
8
|
8
|
span(v-if="sortBy")
|
|
9
|
|
- h3 sorted {{ sortBy.replace('-', ' ') }}
|
|
|
9
|
+ h3 sorted {{ sortBy.replace('-', ' ') }}
|
|
10
|
10
|
|
|
11
|
11
|
h3(v-if="!loaded") loading...
|
|
12
|
12
|
.content(
|
|
|
@@ -38,14 +38,12 @@ import { postTypes, sortTypes, convertTitleCase, typeFromRoute, sortFromRoute }
|
|
38
|
38
|
const TIMEOUT = 1
|
|
39
|
39
|
const INTERSECT_SELECTOR = '.page--list > article footer'
|
|
40
|
40
|
|
|
|
41
|
+const wideTypes = ['event', 'exhibition']
|
|
|
42
|
+const gridTypes = ['episode', 'artist']
|
|
|
43
|
+const sansSidebarTypes = ['episode']
|
|
|
44
|
+
|
|
41
|
45
|
export default {
|
|
42
|
46
|
components: { sidebar, featuredImage, card },
|
|
43
|
|
- props: {
|
|
44
|
|
- sidebar: { type: Boolean },
|
|
45
|
|
- grid: { type: Boolean },
|
|
46
|
|
- sortBy: { type: String },
|
|
47
|
|
- isWide: { type: Boolean }
|
|
48
|
|
- },
|
|
49
|
47
|
mixins: [postTypeGetters, scrollTop, heroUtils],
|
|
50
|
48
|
data() {
|
|
51
|
49
|
return {
|
|
|
@@ -58,9 +56,21 @@ export default {
|
|
58
|
56
|
}
|
|
59
|
57
|
},
|
|
60
|
58
|
computed: {
|
|
|
59
|
+ grid() {
|
|
|
60
|
+ return gridTypes.includes(this.type)
|
|
|
61
|
+ },
|
|
|
62
|
+ isWide() {
|
|
|
63
|
+ return wideTypes.includes(this.type)
|
|
|
64
|
+ },
|
|
|
65
|
+ sidebar() {
|
|
|
66
|
+ return !sansSidebarTypes.includes(this.type)
|
|
|
67
|
+ },
|
|
61
|
68
|
type() {
|
|
62
|
69
|
// Checks for type and fixes Episodes route edge case
|
|
63
|
|
- return typeFromRoute(this.$route)
|
|
|
70
|
+ return this.$route.params.type
|
|
|
71
|
+ },
|
|
|
72
|
+ sortBy() {
|
|
|
73
|
+ return this.$route.params.sortBy
|
|
64
|
74
|
},
|
|
65
|
75
|
pType() {
|
|
66
|
76
|
if(!typeFromRoute(this.$route)) return
|
|
|
@@ -135,20 +145,24 @@ export default {
|
|
135
|
145
|
},
|
|
136
|
146
|
async getPageForType(type) {
|
|
137
|
147
|
await this._getAll('page', this.$store)
|
|
138
|
|
- if(!this.allPages) return console.warn('no pages in state', this)
|
|
|
148
|
+ if(!this.allPages) throw 'no pages in state'
|
|
139
|
149
|
const page = this.allPages.filter(page => page.slug == `${type}s`)[0]
|
|
140
|
|
- if(!page) return console.warn(`no page for ${type} found`)
|
|
|
150
|
+ if(!page) throw `No page: ${type} found. Cannot set hero.`
|
|
141
|
151
|
return page
|
|
142
|
152
|
},
|
|
143
|
153
|
// _setHeroInfo(post) {} from mixin
|
|
144
|
154
|
// _clearHero(store) {} from mixin
|
|
145
|
155
|
async checkAndSetHero(type) {
|
|
146
|
156
|
this._clearHero(this.$store)
|
|
147
|
|
- const page = await this.getPageForType(type)
|
|
148
|
|
- // We always set a hero no matter what
|
|
149
|
|
- // Because the hero component will deal
|
|
150
|
|
- // with how to render based on hero.url
|
|
151
|
|
- this.$store.commit('SET_HERO', this._setHeroInfo(page))
|
|
|
157
|
+ try {
|
|
|
158
|
+ const page = await this.getPageForType(type)
|
|
|
159
|
+ // We always set a hero no matter what
|
|
|
160
|
+ // Because the hero component will deal
|
|
|
161
|
+ // with how to render based on hero.url
|
|
|
162
|
+ this.$store.commit('SET_HERO', this._setHeroInfo(page))
|
|
|
163
|
+ } catch (err) {
|
|
|
164
|
+ console.error(err)
|
|
|
165
|
+ }
|
|
152
|
166
|
},
|
|
153
|
167
|
setIntersectionLoader() {
|
|
154
|
168
|
// KeepFetching is UNSET for certain post types and sort types in `loadMorePosts()`
|
|
|
@@ -221,6 +235,9 @@ export default {
|
|
221
|
235
|
},
|
|
222
|
236
|
mounted() {
|
|
223
|
237
|
// This only fires navigating from a non-list page > list page
|
|
|
238
|
+ console.log(this.$route)
|
|
|
239
|
+ console.log(this.type)
|
|
|
240
|
+ console.log(this.sortBy)
|
|
224
|
241
|
this.clearAndInitPostList('mounted')
|
|
225
|
242
|
},
|
|
226
|
243
|
beforeDestroy() {
|