Parcourir la source

Merge branch 'dev' of craft-in-america/vue-wp into master

tags/1.0.0
maeda il y a 4 ans
Parent
révision
b8bd3b16c4

+ 6
- 0
vue-theme/src/components/navigation/navigation.vue Voir le fichier

325
                     /* padding: 0 */
325
                     /* padding: 0 */
326
                     margin: 0
326
                     margin: 0
327
 
327
 
328
+    @media (max-width: $large)
329
+        .menu
330
+            display: none
331
+
328
     @media (min-width: $large)
332
     @media (min-width: $large)
329
         .menu
333
         .menu
330
             display: flex
334
             display: flex
335
     @media (min-width:  $extra-large)
339
     @media (min-width:  $extra-large)
336
         .menu > ul
340
         .menu > ul
337
             max-width: $max-width
341
             max-width: $max-width
342
+
343
+    
338
 </style>
344
 </style>

+ 54
- 27
vue-theme/src/components/sidebars/sidebar.vue Voir le fichier

2
 aside.sidebar
2
 aside.sidebar
3
     section
3
     section
4
         //- if not single layout with sorting
4
         //- if not single layout with sorting
5
-        .shadow(v-if="['artist', 'exhibition', 'event', 'short', 'guide', 'object', 'publication', 'technique', 'post'].includes(type) && layout !== 'single'")
5
+        .shadow(v-if="shouldShowListSort.includes(type) && layout !== 'single'")
6
             h3.t-up sort {{ type }}
6
             h3.t-up sort {{ type }}
7
             ul.t-up
7
             ul.t-up
8
                 li(v-for="option in sortOptions")
8
                 li(v-for="option in sortOptions")
9
                     router-link(:to="`/${type}/sorted/${sortTypes[option]}`")
9
                     router-link(:to="`/${type}/sorted/${sortTypes[option]}`")
10
                         p {{ option }}
10
                         p {{ option }}
11
-                //- exhibition, event list sidebar
12
-                template(v-if="['exhibition', 'event'].includes(type) && layout === 'list'")
13
                     router-link(:to="`/${type}`")
11
                     router-link(:to="`/${type}`")
14
                         p by all
12
                         p by all
15
-                    router-link(:to="`/${type}/sorted/by-current-and-upcoming`")
13
+                    router-link(v-if="shouldShowDateSort.includes(type) && layout !== 'single'" :to="`/${type}/sorted/by-current-and-upcoming`")
16
                         p by current and upcoming
14
                         p by current and upcoming
17
-                //- list sidebar 
18
-                template(v-if="['short', 'guide', 'publication', 'technique', 'post'].includes(type) && layout === 'list'")
19
-                    router-link(:to="`/${type}`")
20
-                        p by all
15
+        
16
+        //- if {{type}} sorted by-material show material options
17
+        .shadow(v-if="shouldShowMaterialSort.includes(type) && layout !== 'single'")
18
+            h3.t-up {{ type }} by material
19
+            ul.t-up
20
+                li
21
+                    template(v-for="material in materials") 
22
+                        router-link(:to="`/${type}/sorted/by-material#${material}`")
23
+                            p {{ material }}
24
+
25
+        //- if artist sorted by-alpha show alpha options           
26
+        .shadow(v-if="['artist'].includes(type) && layout !== 'single'")
27
+            h3.t-up {{ type }} alpha 
28
+            ul.t-up
29
+                li
30
+                    template(v-for="charaSet in charaSets") 
31
+                        router-link(:to="`/${type}/sorted/by-alpha#${charaSet[0]}`")
32
+                            p {{ charaSet }}
21
 
33
 
22
         //- p2p types and related posts
34
         //- p2p types and related posts
23
         .shadow(v-if="layout === 'single' && Object.keys(related).length" v-for="p2pPostType in Object.keys(related)")
35
         .shadow(v-if="layout === 'single' && Object.keys(related).length" v-for="p2pPostType in Object.keys(related)")
50
 import relatedSidebar from './related'
62
 import relatedSidebar from './related'
51
 import exhibitionsSidebar from './exhibitions'
63
 import exhibitionsSidebar from './exhibitions'
52
 import eventsSidebar from './events'
64
 import eventsSidebar from './events'
53
-// import shortsSidebar from './shorts'
54
-// import talksSidebar from './talks'
55
-// import postsSidebar from './posts'
56
-// import publicationsSidebar from './publications'
57
-// import articlesSidebar from './articles'
58
 
65
 
59
-import { sortTypes } from '@/utils/helpers'
66
+import { sortTypes, materials } from '@/utils/helpers'
60
 
67
 
61
 export default {
68
 export default {
62
     props: {
69
     props: {
71
         },
78
         },
72
     },
79
     },
73
     components: {
80
     components: {
74
-        exhibitionsSidebar,
75
-        eventsSidebar,
76
-        relatedSidebar,
81
+        exhibitionsSidebar, eventsSidebar, relatedSidebar,
77
     },
82
     },
78
     data() {
83
     data() {
79
         return {
84
         return {
80
             sortTypes: {
85
             sortTypes: {
81
-                alphabetized: `${sortTypes.alpha}`,
82
-                'by material': `${sortTypes.material}`,
83
-                'by artist': `${sortTypes.artist}`,
84
-                'by episode': `${sortTypes.episode}`,
85
-                'by artist type': `${sortTypes.subtype}`,
86
-                'by event type': `${sortTypes.subtype}`,
87
-                'by post type': `${sortTypes.subtype}`,
88
-                // 'by exhibition type': `${sortTypes.exhibitiontypes}`,
86
+                alphabetized: `${sortTypes.alpha}`,       //:0
87
+                'by material': `${sortTypes.material}`,   //:1
88
+                'by artist': `${sortTypes.artist}`,       //:2
89
+                'by episode': `${sortTypes.episode}`,     //:3
89
             },
90
             },
91
+            charaSets: [
92
+                '0 a b', 'c d e', 'f g h',
93
+                'i j k', 'l m n', 'o p q',
94
+                'r s t', 'u v w', 'x y z'
95
+            ],
96
+            materials: materials,
97
+            shouldShowListSort: [
98
+                'artist', 'exhibition', 'event', 
99
+                'short', 'guide', 'object',
100
+                'publication', 'technique', 'post'
101
+            ],
102
+            shouldShowMaterialSort: [
103
+                'artist', 
104
+                'short', 'guide', 'object',
105
+                'technique',
106
+            ],
107
+            shouldShowAlphaSort: [
108
+                'artist'
109
+            ],
110
+            shouldShowDateSort: [
111
+                'exhibition', 'event'
112
+            ],
113
+            shouldShowTypeSort: [
114
+                'short', 'guide', 'object',
115
+                'publication', 'technique', 'post'
116
+            ]
90
         }
117
         }
91
     },
118
     },
92
     computed: {
119
     computed: {
98
                         Object.keys(this.sortTypes)[0],
125
                         Object.keys(this.sortTypes)[0],
99
                         Object.keys(this.sortTypes)[3],
126
                         Object.keys(this.sortTypes)[3],
100
                         Object.keys(this.sortTypes)[1],
127
                         Object.keys(this.sortTypes)[1],
101
-                        Object.keys(this.sortTypes)[4],
128
+                        `by ${this.type} type`,
102
                     ]
129
                     ]
103
                     break
130
                     break
104
                 case 'post':
131
                 case 'post':
105
                     opts = [
132
                     opts = [
106
-                        Object.keys(this.sortTypes)[6],
133
+                        `by ${this.type} type`,
107
                     ]
134
                     ]
108
                     break
135
                     break
109
                 case 'short':
136
                 case 'short':

+ 2
- 2
vue-theme/src/pages/index.vue Voir le fichier

28
         section
28
         section
29
             ul.flipped
29
             ul.flipped
30
                 li.post.shadow(v-for="type in thirdRow")
30
                 li.post.shadow(v-for="type in thirdRow")
31
-                     .random--wrapper(v-for="post in randomPosts.filter(p => p.type == type)")
31
+                    .random--wrapper(v-for="post in [...randomPosts, ...allPages.filter(p => p.slug == 'center')].filter(p => p.type == type)")
32
                         card(:content="post" :type="type")
32
                         card(:content="post" :type="type")
33
 </template>
33
 </template>
34
 
34
 
45
         return {
45
         return {
46
             firstRow: ['episode', 'exhibition', 'event', 'short', 'post'],
46
             firstRow: ['episode', 'exhibition', 'event', 'short', 'post'],
47
             secondRow: 'artist', // This is only ONE post
47
             secondRow: 'artist', // This is only ONE post
48
-            thirdRow: ['object', 'technique', 'publication', 'center', 'guide'],
48
+            thirdRow: ['object', 'technique', 'publication', 'page', 'guide'],
49
             // ideal iteration
49
             // ideal iteration
50
             // thirdRow: ['object', 'talks', 'publication', 'center', 'guide'],
50
             // thirdRow: ['object', 'talks', 'publication', 'center', 'guide'],
51
         }
51
         }

+ 2
- 2
vue-theme/src/pages/list.vue Voir le fichier

18
         ul.posts.f-col(v-if="posts && loaded" :class="{ 'is-grid': grid }")
18
         ul.posts.f-col(v-if="posts && loaded" :class="{ 'is-grid': grid }")
19
             template(v-for="(post, i) in posts" :key="post.slug")
19
             template(v-for="(post, i) in posts" :key="post.slug")
20
                 li.post.shadow(v-if="!post.inbetween" )
20
                 li.post.shadow(v-if="!post.inbetween" )
21
-                    card(:content="post" :type="type" :wide="isWide")
21
+                    card(:content="post" :type="post.type" :wide="isWide")
22
                 li.post.shadow.inbetween.t-up.f-row.w-max(v-else-if="post.inbetween" :id="post.slug")
22
                 li.post.shadow.inbetween.t-up.f-row.w-max(v-else-if="post.inbetween" :id="post.slug")
23
                     p {{ post.slug }}
23
                     p {{ post.slug }}
24
             
24
             
67
             return gridTypes.includes(this.type)
67
             return gridTypes.includes(this.type)
68
         },
68
         },
69
         isSearch() {
69
         isSearch() {
70
-            return this.$route.path == '/search'
70
+            return this.searchTerm
71
         },
71
         },
72
         isWide() {
72
         isWide() {
73
             return wideTypes.includes(this.type)
73
             return wideTypes.includes(this.type)

+ 2
- 2
vue-theme/src/store/modules/post.js Voir le fichier

30
 }
30
 }
31
 
31
 
32
 const actions = {
32
 const actions = {
33
-    getAllPosts({ commit }, { sortType, params }) {
33
+    async getAllPosts({ commit }, { sortType, params }) {
34
         commit('CLEAR_POSTS')
34
         commit('CLEAR_POSTS')
35
         commit('POSTS_LOADED', false)
35
         commit('POSTS_LOADED', false)
36
         const storeFetch = (posts => {
36
         const storeFetch = (posts => {
41
             commit('STORE_FETCHED_POSTS', { posts: repacked })
41
             commit('STORE_FETCHED_POSTS', { posts: repacked })
42
             commit('POSTS_LOADED', true)
42
             commit('POSTS_LOADED', true)
43
         }) 
43
         }) 
44
-        return api.getByType({ type: 'post', sort: sortType, params, cb: storeFetch })
44
+        return await api.getByType({ type: 'post', sort: sortType, params, cb: storeFetch })
45
     },
45
     },
46
     getMorePosts({ commit }, { sortType, params }) {
46
     getMorePosts({ commit }, { sortType, params }) {
47
         const storeFetch = (posts => {
47
         const storeFetch = (posts => {

+ 0
- 1
vue-theme/src/store/modules/search.js Voir le fichier

22
 
22
 
23
 const mutations = {
23
 const mutations = {
24
     ADD_TO_FETCHED_SEARCH_RESULTS(state, { searchResults }) {
24
     ADD_TO_FETCHED_SEARCH_RESULTS(state, { searchResults }) {
25
-        console.log('adding results', searchResults)
26
         state.all = [...state.all, ...searchResults]
25
         state.all = [...state.all, ...searchResults]
27
     },
26
     },
28
     STORE_FETCHED_SEARCH_RESULTS(state, { searchResults }) {
27
     STORE_FETCHED_SEARCH_RESULTS(state, { searchResults }) {

+ 10
- 0
vue-theme/src/utils/helpers.js Voir le fichier

3
     return type.charAt(0).toUpperCase() + type.slice(1)
3
     return type.charAt(0).toUpperCase() + type.slice(1)
4
 }
4
 }
5
 
5
 
6
+const materials = [
7
+    'clay',
8
+    'fiber',
9
+    'glass',
10
+    'metal',
11
+    'paper',
12
+    'wood'
13
+]
14
+
6
 const sortTypes = {
15
 const sortTypes = {
7
     alpha: 'by-alpha',
16
     alpha: 'by-alpha',
8
     recent: 'by-recent',
17
     recent: 'by-recent',
77
 
86
 
78
 export {
87
 export {
79
     convertTitleCase,
88
     convertTitleCase,
89
+    materials,
80
     sortTypes,
90
     sortTypes,
81
     postTypes,
91
     postTypes,
82
     ytThumbnail,
92
     ytThumbnail,

Chargement…
Annuler
Enregistrer