Bladeren bron

:recycle: depluralized more things | altered module system key

tags/0.9.0
j 4 jaren geleden
bovenliggende
commit
5ceee0bac7

+ 1
- 1
vue-theme/src/components/breadcrumb.vue Bestand weergeven

1
 <template lang="pug">
1
 <template lang="pug">
2
 //- breadcrumb links at top of page, needs link routing
2
 //- breadcrumb links at top of page, needs link routing
3
 .breadcrumb.f-row.start.t-up
3
 .breadcrumb.f-row.start.t-up
4
-    router-link(v-if="['events','exhibitions'].includes(type)" :to="`/${type}/by-current-and-upcoming`")
4
+    router-link(v-if="['event','exhibition'].includes(type)" :to="`/${type}/by-current-and-upcoming`")
5
         h5.t-up {{ type }}
5
         h5.t-up {{ type }}
6
     router-link(v-else :to="`/${type}`")
6
     router-link(v-else :to="`/${type}`")
7
         h5.t-up {{ type }}
7
         h5.t-up {{ type }}

+ 1
- 1
vue-theme/src/components/sidebars/events.vue Bestand weergeven

4
 ul.t-up
4
 ul.t-up
5
     li(v-for="post in events")
5
     li(v-for="post in events")
6
         featured-image(:post="post", thumbsize="'standard'")
6
         featured-image(:post="post", thumbsize="'standard'")
7
-        router-link(:to="`/events/${post.slug}`")
7
+        router-link(:to="`/event/${post.slug}`")
8
             p.t-up {{ post.title }}
8
             p.t-up {{ post.title }}
9
         p {{ post.start }} &ndash; {{ post.end }}
9
         p {{ post.start }} &ndash; {{ post.end }}
10
 </template>
10
 </template>

+ 1
- 1
vue-theme/src/components/sidebars/exhibitions.vue Bestand weergeven

4
 ul.t-up
4
 ul.t-up
5
     li(v-for="post in exhibitions")
5
     li(v-for="post in exhibitions")
6
         featured-image(:post="post", thumbsize="'standard'")
6
         featured-image(:post="post", thumbsize="'standard'")
7
-        router-link(:to="`/exhibitions/${post.slug}`")
7
+        router-link(:to="`/exhibition/${post.slug}`")
8
             p.t-up {{ post.title }}
8
             p.t-up {{ post.title }}
9
         p {{ post.start }} &ndash; {{ post.end }}
9
         p {{ post.start }} &ndash; {{ post.end }}
10
 </template>
10
 </template>

+ 9
- 9
vue-theme/src/components/sidebars/related.vue Bestand weergeven

3
 p.t-up
3
 p.t-up
4
     ul
4
     ul
5
         li(v-for="relatedPost in postsByType[postType]")
5
         li(v-for="relatedPost in postsByType[postType]")
6
-            router-link(v-if="relatedPost" :to="`/${relatedPost.type}s/${relatedPost.slug}`")
6
+            router-link(v-if="relatedPost" :to="`/${relatedPost.type}/${relatedPost.slug}`")
7
                 p {{ relatedPost.title }}
7
                 p {{ relatedPost.title }}
8
 </template>
8
 </template>
9
 
9
 
10
 <script>
10
 <script>
11
 export default {
11
 export default {
12
     props: {
12
     props: {
13
-        postsByType:{
14
-            required: true
15
-        }, 
16
-        postType:{
17
-            required: true
18
-        }, 
19
-    }
13
+        postsByType: {
14
+            required: true,
15
+        },
16
+        postType: {
17
+            required: true,
18
+        },
19
+    },
20
 }
20
 }
21
-</script>
21
+</script>

+ 12
- 12
vue-theme/src/components/sidebars/sidebar.vue Bestand weergeven

2
 aside.sidebar
2
 aside.sidebar
3
     section
3
     section
4
         //- if not single layout Artist sorting
4
         //- if not single layout Artist sorting
5
-        .shadow(v-if="type === 'artists' && layout !== 'single'")
5
+        .shadow(v-if="type === 'artist' && layout !== 'single'")
6
             h3.t-up sort {{ type }} by
6
             h3.t-up sort {{ type }} by
7
             ul.t-up
7
             ul.t-up
8
                 li(v-for="option in sortOptions")
8
                 li(v-for="option in sortOptions")
15
             h3.t-up.t-b {{ type }} specific sidebar more
15
             h3.t-up.t-b {{ type }} specific sidebar more
16
 
16
 
17
         //- if not single layout Exhibitions sorting
17
         //- if not single layout Exhibitions sorting
18
-        .shadow(v-if="type === 'exhibitions' && layout !== 'single'")
18
+        .shadow(v-if="type === 'exhibition' && layout !== 'single'")
19
             h3.t-up sort {{ type }} by
19
             h3.t-up sort {{ type }} by
20
             ul.t-up
20
             ul.t-up
21
                 li(v-for="option in sortOptions")
21
                 li(v-for="option in sortOptions")
23
                         p {{ option }}
23
                         p {{ option }}
24
                 //- temporary reminder
24
                 //- temporary reminder
25
                 p 
25
                 p 
26
-                    router-link(:to="`/exhibitions`")
26
+                    router-link(:to="`/exhibition`")
27
                         p by all
27
                         p by all
28
 
28
 
29
         //- if not single layout Events sorting
29
         //- if not single layout Events sorting
30
-        .shadow(v-if="type === 'events' && layout === 'list'")
30
+        .shadow(v-if="type === 'event' && layout === 'list'")
31
             h3.t-up sort {{ type }} by
31
             h3.t-up sort {{ type }} by
32
             ul.t-up
32
             ul.t-up
33
                 li(v-for="option in sortOptions")
33
                 li(v-for="option in sortOptions")
35
                         p {{ option }}
35
                         p {{ option }}
36
                 //- temporary reminder
36
                 //- temporary reminder
37
                 p 
37
                 p 
38
-                    router-link(:to="`/events`")
38
+                    router-link(:to="`/event`")
39
                         p by all
39
                         p by all
40
 
40
 
41
         //- p2p types and related posts
41
         //- p2p types and related posts
46
         slot
46
         slot
47
 
47
 
48
         //- single layout Exhibitions sidebar
48
         //- single layout Exhibitions sidebar
49
-        .shadow(v-if="type === 'exhibitions' && layout === 'single'")
49
+        .shadow(v-if="type === 'exhibition' && layout === 'single'")
50
             events-sidebar
50
             events-sidebar
51
         //- single layout Events sindebar
51
         //- single layout Events sindebar
52
-        .shadow(v-if="type === 'events' && layout === 'single'")
52
+        .shadow(v-if="type === 'event' && layout === 'single'")
53
             exhibitions-sidebar
53
             exhibitions-sidebar
54
 
54
 
55
         //- list layout Exhibition sidebar show events
55
         //- list layout Exhibition sidebar show events
56
-        .shadow(v-if="type === 'exhibitions' && layout === 'list'")
56
+        .shadow(v-if="type === 'exhibition' && layout === 'list'")
57
             events-sidebar
57
             events-sidebar
58
         //- list layout Events sidebar show exhibitions
58
         //- list layout Events sidebar show exhibitions
59
-        .shadow(v-if="type === 'events' && layout === 'list'")
59
+        .shadow(v-if="type === 'event' && layout === 'list'")
60
             exhibitions-sidebar
60
             exhibitions-sidebar
61
 
61
 
62
 </template>
62
 </template>
108
         sortOptions() {
108
         sortOptions() {
109
             let opts = []
109
             let opts = []
110
             switch (this.type) {
110
             switch (this.type) {
111
-                case 'artists':
111
+                case 'artist':
112
                     opts = [
112
                     opts = [
113
                         Object.keys(this.sortTypes)[0],
113
                         Object.keys(this.sortTypes)[0],
114
                         Object.keys(this.sortTypes)[1],
114
                         Object.keys(this.sortTypes)[1],
115
                         Object.keys(this.sortTypes)[4],
115
                         Object.keys(this.sortTypes)[4],
116
                     ]
116
                     ]
117
                     break
117
                     break
118
-                case 'shorts':
118
+                case 'short':
119
                     opts = [
119
                     opts = [
120
                         Object.keys(this.sortTypes)[2],
120
                         Object.keys(this.sortTypes)[2],
121
                         Object.keys(this.sortTypes)[3],
121
                         Object.keys(this.sortTypes)[3],
122
                     ]
122
                     ]
123
                     break
123
                     break
124
-                case 'guides':
124
+                case 'guide':
125
                     opts = [
125
                     opts = [
126
                         Object.keys(this.sortTypes)[3],
126
                         Object.keys(this.sortTypes)[3],
127
                         Object.keys(this.sortTypes)[1],
127
                         Object.keys(this.sortTypes)[1],

+ 7
- 5
vue-theme/src/pages/mixin-post-types.js Bestand weergeven

9
  */
9
  */
10
 const getterHelper = {}
10
 const getterHelper = {}
11
 for (let type of postTypes) {
11
 for (let type of postTypes) {
12
-    const capitalized = convertTitleCase(type) + 's'
13
-    console.log(capitalized)
14
-    getterHelper[`all${capitalized}BySlug`] = `all${capitalized}BySlug`
15
-    getterHelper[`all${capitalized}`] = `all${capitalized}`
16
-    getterHelper[`all${capitalized}Loaded`] = `all${capitalized}Loaded`
12
+    if (type != 'sticky') {
13
+        const capitalized = convertTitleCase(type) + 's'
14
+
15
+        getterHelper[`all${capitalized}BySlug`] = `all${capitalized}BySlug`
16
+        getterHelper[`all${capitalized}`] = `all${capitalized}`
17
+        getterHelper[`all${capitalized}Loaded`] = `all${capitalized}Loaded`
18
+    }
17
 }
19
 }
18
 getterHelper[`upcomingAndCurrentEvents`] = `upcomingAndCurrentEvents`
20
 getterHelper[`upcomingAndCurrentEvents`] = `upcomingAndCurrentEvents`
19
 getterHelper[`pastEvents`] = `pastEvents`
21
 getterHelper[`pastEvents`] = `pastEvents`

+ 10
- 18
vue-theme/src/pages/single.vue Bestand weergeven

34
         //- end of article icon     
34
         //- end of article icon     
35
         footer.f-col
35
         footer.f-col
36
             img(src="../star.svg")
36
             img(src="../star.svg")
37
-
38
-    sidebar(v-if="sidebar" :type="`${type}`" layout="single" :related="p2pPostsByType")
39
 </template>
37
 </template>
40
 
38
 
41
 <script>
39
 <script>
42
 import card from '@/components/card.vue'
40
 import card from '@/components/card.vue'
43
-import sidebar from '@/components/sidebars/sidebar'
44
 import gallery from '@/components/gallery/'
41
 import gallery from '@/components/gallery/'
45
 import credits from '@/components/credits'
42
 import credits from '@/components/credits'
46
 import breadcrumb from '@/components/breadcrumb'
43
 import breadcrumb from '@/components/breadcrumb'
52
 const TIMEOUT = 1
49
 const TIMEOUT = 1
53
 
50
 
54
 export default {
51
 export default {
55
-    components: { sidebar, gallery, credits, card, breadcrumb },
52
+    components: { gallery, credits, card, breadcrumb },
56
     props: {
53
     props: {
57
-        sidebar: { type: Boolean },
58
         id: { type: Number },
54
         id: { type: Number },
59
     },
55
     },
60
     mixins: [postTypeGetters, scrollTop],
56
     mixins: [postTypeGetters, scrollTop],
75
          */
71
          */
76
         post() {
72
         post() {
77
             if (!this[this.type]) return
73
             if (!this[this.type]) return
78
-
79
             const type = dePluralize(this.type)
74
             const type = dePluralize(this.type)
80
 
75
 
81
             // State not a getter!
76
             // State not a getter!
197
              * !: posts watcher fires when this finishes
192
              * !: posts watcher fires when this finishes
198
              */
193
              */
199
             let type = convertTitleCase(this.type) + 's'
194
             let type = convertTitleCase(this.type) + 's'
200
-
195
+            // modules are NOT plural for some reason
201
             if (!this.$store.state[this.type]) return
196
             if (!this.$store.state[this.type]) return
202
-
203
             let allPostsOfType = this.$store.state[this.type].all
197
             let allPostsOfType = this.$store.state[this.type].all
204
 
198
 
205
             /**
199
             /**
208
             if (!this[`all${type}Loaded`] && allPostsOfType.length < 1) {
202
             if (!this[`all${type}Loaded`] && allPostsOfType.length < 1) {
209
                 const res = await this.$store.dispatch(`getAll${type}`)
203
                 const res = await this.$store.dispatch(`getAll${type}`)
210
                 allPostsOfType = res
204
                 allPostsOfType = res
211
-                // console.log(`reloaded ${type}...`)
205
+                console.log(`reloaded ${type}...`)
212
             }
206
             }
213
-
214
-            if (Object.values(allPostsOfType).length < 1) return
215
-            const singlePostData = Object.values(allPostsOfType).filter(
207
+            if (allPostsOfType.length < 1) return
208
+            const singlePostData = allPostsOfType.filter(
216
                 post => post.slug == this.$route.params.slug,
209
                 post => post.slug == this.$route.params.slug,
217
             )[0]
210
             )[0]
218
-
219
-            // console.log(this)
220
             if (!singlePostData) return
211
             if (!singlePostData) return
212
+            // NOT plural
221
             await this.$store.dispatch(
213
             await this.$store.dispatch(
222
-                `getSingle${dePluralize(type)}`,
214
+                `getSingle${convertTitleCase(this.type)}`,
223
                 singlePostData.id,
215
                 singlePostData.id,
224
             )
216
             )
225
         },
217
         },
247
         },
239
         },
248
     },
240
     },
249
     mounted() {
241
     mounted() {
250
-        if (this.$route.hash) {
251
-            setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
252
-        }
242
+        // if (this.$route.hash) {
243
+        //     setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
244
+        // }
253
     },
245
     },
254
     async created() {
246
     async created() {
255
         await this.loadPostData()
247
         await this.loadPostData()

+ 5
- 1
vue-theme/src/router/routes.js Bestand weergeven

75
         props: { sidebar: true, sortBy: null },
75
         props: { sidebar: true, sortBy: null },
76
     },
76
     },
77
     // Single Pages
77
     // Single Pages
78
-    { path: '/:type/:slug', component: singlePage, props: { sidebar: true } },
78
+    {
79
+        path: '/:type/:slug',
80
+        component: singlePage,
81
+        props: { sidebar: true },
82
+    },
79
 ]
83
 ]

+ 12
- 12
vue-theme/src/store/index.js Bestand weergeven

5
 import * as actions from './actions'
5
 import * as actions from './actions'
6
 import * as getters from './getters'
6
 import * as getters from './getters'
7
 
7
 
8
-import pages from './modules/page'
9
-import posts from './modules/post'
10
-import artists from './modules/artist'
11
-import episodes from './modules/episode'
12
-import events from './modules/event'
13
-import exhibitions from './modules/exhibition'
8
+import page from './modules/page'
9
+import post from './modules/post'
10
+import artist from './modules/artist'
11
+import episode from './modules/episode'
12
+import event from './modules/event'
13
+import exhibition from './modules/exhibition'
14
 import sticky from './modules/sticky'
14
 import sticky from './modules/sticky'
15
 
15
 
16
 const debug = process.env.NODE_ENV !== 'production'
16
 const debug = process.env.NODE_ENV !== 'production'
72
     mutations,
72
     mutations,
73
     state,
73
     state,
74
     modules: {
74
     modules: {
75
-        posts,
76
-        pages,
77
-        artists,
78
-        episodes,
79
-        events,
80
-        exhibitions,
75
+        post,
76
+        page,
77
+        artist,
78
+        episode,
79
+        event,
80
+        exhibition,
81
         sticky,
81
         sticky,
82
     },
82
     },
83
     strict: debug,
83
     strict: debug,

+ 1
- 0
vue-theme/src/store/modules/artist.js Bestand weergeven

28
     getSingleArtist({ commit }, id) {
28
     getSingleArtist({ commit }, id) {
29
         commit('CLEAR_SINGLE_ARTISTS')
29
         commit('CLEAR_SINGLE_ARTISTS')
30
         commit('ARTISTS_LOADED', false)
30
         commit('ARTISTS_LOADED', false)
31
+        console.log(id)
31
         api.getSingleType('artist', id, artist => {
32
         api.getSingleType('artist', id, artist => {
32
             commit('STORE_FETCHED_SINGLE_ARTIST', artist)
33
             commit('STORE_FETCHED_SINGLE_ARTIST', artist)
33
             commit('ARTISTS_LOADED', true)
34
             commit('ARTISTS_LOADED', true)

+ 0
- 1
vue-theme/src/store/modules/episode.js Bestand weergeven

26
         })
26
         })
27
     },
27
     },
28
     getSingleEpisode({ commit }, id) {
28
     getSingleEpisode({ commit }, id) {
29
-        console.log('clearing single ep from getSingle')
30
         commit('CLEAR_SINGLE_EPISODES')
29
         commit('CLEAR_SINGLE_EPISODES')
31
         commit('EPISODES_LOADED', false)
30
         commit('EPISODES_LOADED', false)
32
         api.getSingleType('episode', id, episode => {
31
         api.getSingleType('episode', id, episode => {

Laden…
Annuleren
Opslaan