Sfoglia il codice sorgente

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

tags/1.0.0
maeda 4 anni fa
parent
commit
5181204c5b

+ 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':

+ 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