Sfoglia il codice sorgente

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

tags/1.0.0
maeda 4 anni fa
parent
commit
b8bd3b16c4

+ 6
- 0
vue-theme/src/components/navigation/navigation.vue Vedi File

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

+ 54
- 27
vue-theme/src/components/sidebars/sidebar.vue Vedi File

@@ -2,22 +2,34 @@
2 2
 aside.sidebar
3 3
     section
4 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 6
             h3.t-up sort {{ type }}
7 7
             ul.t-up
8 8
                 li(v-for="option in sortOptions")
9 9
                     router-link(:to="`/${type}/sorted/${sortTypes[option]}`")
10 10
                         p {{ option }}
11
-                //- exhibition, event list sidebar
12
-                template(v-if="['exhibition', 'event'].includes(type) && layout === 'list'")
13 11
                     router-link(:to="`/${type}`")
14 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 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 34
         //- p2p types and related posts
23 35
         .shadow(v-if="layout === 'single' && Object.keys(related).length" v-for="p2pPostType in Object.keys(related)")
@@ -50,13 +62,8 @@ aside.sidebar
50 62
 import relatedSidebar from './related'
51 63
 import exhibitionsSidebar from './exhibitions'
52 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 68
 export default {
62 69
     props: {
@@ -71,22 +78,42 @@ export default {
71 78
         },
72 79
     },
73 80
     components: {
74
-        exhibitionsSidebar,
75
-        eventsSidebar,
76
-        relatedSidebar,
81
+        exhibitionsSidebar, eventsSidebar, relatedSidebar,
77 82
     },
78 83
     data() {
79 84
         return {
80 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 119
     computed: {
@@ -98,12 +125,12 @@ export default {
98 125
                         Object.keys(this.sortTypes)[0],
99 126
                         Object.keys(this.sortTypes)[3],
100 127
                         Object.keys(this.sortTypes)[1],
101
-                        Object.keys(this.sortTypes)[4],
128
+                        `by ${this.type} type`,
102 129
                     ]
103 130
                     break
104 131
                 case 'post':
105 132
                     opts = [
106
-                        Object.keys(this.sortTypes)[6],
133
+                        `by ${this.type} type`,
107 134
                     ]
108 135
                     break
109 136
                 case 'short':

+ 2
- 2
vue-theme/src/pages/index.vue Vedi File

@@ -28,7 +28,7 @@
28 28
         section
29 29
             ul.flipped
30 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 32
                         card(:content="post" :type="type")
33 33
 </template>
34 34
 
@@ -45,7 +45,7 @@ export default {
45 45
         return {
46 46
             firstRow: ['episode', 'exhibition', 'event', 'short', 'post'],
47 47
             secondRow: 'artist', // This is only ONE post
48
-            thirdRow: ['object', 'technique', 'publication', 'center', 'guide'],
48
+            thirdRow: ['object', 'technique', 'publication', 'page', 'guide'],
49 49
             // ideal iteration
50 50
             // thirdRow: ['object', 'talks', 'publication', 'center', 'guide'],
51 51
         }

+ 2
- 2
vue-theme/src/pages/list.vue Vedi File

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

+ 2
- 2
vue-theme/src/store/modules/post.js Vedi File

@@ -30,7 +30,7 @@ const _arrangeByType = postsList => {
30 30
 }
31 31
 
32 32
 const actions = {
33
-    getAllPosts({ commit }, { sortType, params }) {
33
+    async getAllPosts({ commit }, { sortType, params }) {
34 34
         commit('CLEAR_POSTS')
35 35
         commit('POSTS_LOADED', false)
36 36
         const storeFetch = (posts => {
@@ -41,7 +41,7 @@ const actions = {
41 41
             commit('STORE_FETCHED_POSTS', { posts: repacked })
42 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 46
     getMorePosts({ commit }, { sortType, params }) {
47 47
         const storeFetch = (posts => {

+ 0
- 1
vue-theme/src/store/modules/search.js Vedi File

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

+ 10
- 0
vue-theme/src/utils/helpers.js Vedi File

@@ -3,6 +3,15 @@ const convertTitleCase = type => {
3 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 15
 const sortTypes = {
7 16
     alpha: 'by-alpha',
8 17
     recent: 'by-recent',
@@ -77,6 +86,7 @@ const formatDate = (unix, includeTime) => {
77 86
 
78 87
 export {
79 88
     convertTitleCase,
89
+    materials,
80 90
     sortTypes,
81 91
     postTypes,
82 92
     ytThumbnail,

Loading…
Annulla
Salva