Просмотр исходного кода

:recycle: depluralized more things | altered module system key

tags/0.9.0
j 4 лет назад
Родитель
Сommit
5ceee0bac7

+ 1
- 1
vue-theme/src/components/breadcrumb.vue Просмотреть файл

@@ -1,7 +1,7 @@
1 1
 <template lang="pug">
2 2
 //- breadcrumb links at top of page, needs link routing
3 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 5
         h5.t-up {{ type }}
6 6
     router-link(v-else :to="`/${type}`")
7 7
         h5.t-up {{ type }}

+ 1
- 1
vue-theme/src/components/sidebars/events.vue Просмотреть файл

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

+ 1
- 1
vue-theme/src/components/sidebars/exhibitions.vue Просмотреть файл

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

+ 9
- 9
vue-theme/src/components/sidebars/related.vue Просмотреть файл

@@ -3,19 +3,19 @@ h3.t-up related {{ postType }}s
3 3
 p.t-up
4 4
     ul
5 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 7
                 p {{ relatedPost.title }}
8 8
 </template>
9 9
 
10 10
 <script>
11 11
 export default {
12 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 Просмотреть файл

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

+ 7
- 5
vue-theme/src/pages/mixin-post-types.js Просмотреть файл

@@ -9,11 +9,13 @@ import { mapGetters, mapState } from 'vuex'
9 9
  */
10 10
 const getterHelper = {}
11 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 20
 getterHelper[`upcomingAndCurrentEvents`] = `upcomingAndCurrentEvents`
19 21
 getterHelper[`pastEvents`] = `pastEvents`

+ 10
- 18
vue-theme/src/pages/single.vue Просмотреть файл

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

+ 5
- 1
vue-theme/src/router/routes.js Просмотреть файл

@@ -75,5 +75,9 @@ export default [
75 75
         props: { sidebar: true, sortBy: null },
76 76
     },
77 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 Просмотреть файл

@@ -5,12 +5,12 @@ import Vuex from 'vuex'
5 5
 import * as actions from './actions'
6 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 14
 import sticky from './modules/sticky'
15 15
 
16 16
 const debug = process.env.NODE_ENV !== 'production'
@@ -72,12 +72,12 @@ const store = new Vuex.Store({
72 72
     mutations,
73 73
     state,
74 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 81
         sticky,
82 82
     },
83 83
     strict: debug,

+ 1
- 0
vue-theme/src/store/modules/artist.js Просмотреть файл

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

+ 0
- 1
vue-theme/src/store/modules/episode.js Просмотреть файл

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

Загрузка…
Отмена
Сохранить