Bladeren bron

:recycle: chopped down sidebar logic

tags/1.0.0
J 4 jaren geleden
bovenliggende
commit
ec2607243d
1 gewijzigde bestanden met toevoegingen van 24 en 59 verwijderingen
  1. 24
    59
      vue-theme/src/components/sidebars/sidebar.vue

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

@@ -2,65 +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
-                //- if 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
-                //- if other list sidebar 
18
-                template(v-if="['short', 'guide', 'publication', 'technique', 'object', 'post'].includes(type) && layout === 'list'")
19
-                    router-link(:to="`/${type}`")
20
-                        p by all
21 15
         
22 16
         //- if {{type}} sorted by-material show material options
23
-        .shadow(v-if="['artist', 'technique', 'short', 'object', 'guide'].includes(type) && layout !== 'single'")
17
+        .shadow(v-if="shouldShowMaterialSort.includes(type) && layout !== 'single'")
24 18
             h3.t-up {{ type }} by material
25 19
             ul.t-up
26 20
                 li
27
-                    router-link(v-if="type == 'artist', 'object'" :to="`/${type}/sorted/by-material#clay`")
28
-                        p {{ option }} clay
29
-                    router-link(v-if="type == 'artist', 'object'" :to="`/${type}/sorted/by-material#fiber`")
30
-                        p fiber
31
-                    router-link(v-if="type == 'artist', 'object'" :to="`/${type}/sorted/by-material#glass`")
32
-                        p glass
33
-                    router-link(v-if="type == 'artist', 'object'" :to="`/${type}/sorted/by-material#metal`")
34
-                        p metal
35
-                    router-link(v-if="type == 'artist', 'object'" :to="`/${type}/sorted/by-material#paper`")
36
-                        p paper
37
-                    router-link(v-if="type == 'artist', 'object'" :to="`/${type}/sorted/by-material#wood`")
38
-                        p wood
21
+                    template(v-for="material in materials") 
22
+                        router-link(:to="`/${type}/sorted/by-material#${material}`")
23
+                            p {{ material }}
39 24
 
40 25
         //- if artist sorted by-alpha show alpha options           
41 26
         .shadow(v-if="['artist'].includes(type) && layout !== 'single'")
42 27
             h3.t-up {{ type }} alpha 
43 28
             ul.t-up
44
-                li 
45
-                    router-link(:to="`/${type}/sorted/by-alpha#0`")
46
-                        p 0 a b  
47
-                    router-link(:to="`/${type}/sorted/by-alpha#c`")
48
-                        p c d e  
49
-                    router-link(:to="`/${type}/sorted/by-alpha#f`")
50
-                        p f g h  
51
-                    router-link(:to="`/${type}/sorted/by-alpha#i`")
52
-                        p i j k  
53
-                    router-link(:to="`/${type}/sorted/by-alpha#l`")
54
-                        p l m n 
55
-                    router-link(:to="`/${type}/sorted/by-alpha#o`")
56
-                        p o p q 
57
-                    router-link(:to="`/${type}/sorted/by-alpha#r`")
58
-                        p r s t  
59
-                    router-link(:to="`/${type}/sorted/by-alpha#u`")
60
-                        p u v w  
61
-                    router-link(:to="`/${type}/sorted/by-alpha#x`")
62
-                            p x y z 
63
-
29
+                li
30
+                    template(v-for="charaSet in charaSets") 
31
+                        router-link(:to="`/${type}/sorted/by-alpha#${charaSet[0]]}`")
32
+                            p {{ charaSet }}
64 33
 
65 34
         //- p2p types and related posts
66 35
         .shadow(v-if="layout === 'single' && Object.keys(related).length" v-for="p2pPostType in Object.keys(related)")
@@ -93,11 +62,6 @@ aside.sidebar
93 62
 import relatedSidebar from './related'
94 63
 import exhibitionsSidebar from './exhibitions'
95 64
 import eventsSidebar from './events'
96
-// import shortsSidebar from './shorts'
97
-// import talksSidebar from './talks'
98
-// import postsSidebar from './posts'
99
-// import publicationsSidebar from './publications'
100
-// import articlesSidebar from './articles'
101 65
 
102 66
 import { sortTypes } from '@/utils/helpers'
103 67
 
@@ -114,22 +78,23 @@ export default {
114 78
         },
115 79
     },
116 80
     components: {
117
-        exhibitionsSidebar,
118
-        eventsSidebar,
119
-        relatedSidebar,
81
+        exhibitionsSidebar, eventsSidebar, relatedSidebar,
120 82
     },
121 83
     data() {
122 84
         return {
123 85
             sortTypes: {
124
-                alphabetized: `${sortTypes.alpha}`,
125
-                'by material': `${sortTypes.material}`,
126
-                'by artist': `${sortTypes.artist}`,
127
-                'by episode': `${sortTypes.episode}`,
128
-                'by artist type': `${sortTypes.subtype}`,
129
-                'by event type': `${sortTypes.subtype}`,
130
-                'by post type': `${sortTypes.subtype}`,
131
-                // '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
132 90
             },
91
+            charaSets: ['0 a b', 'c d e', 'f g h', 'i j k', 'l m n', 'o p q', 'r s t', 'u v w', 'x y z'],
92
+            materials: ['clay', 'fiber', 'glass', 'metal', 'paper', 'wood'],
93
+            shouldShowListSort: ['artist', 'exhibition', 'event', 'short', 'guide', 'object', 'publication', 'technique', 'post'],
94
+            shouldShowMaterialSort: ['artist', 'technique', 'short', 'object', 'guide'],
95
+            shouldShowAlphaSort: ['artist'],
96
+            shouldShowDateSort: ['exhibition', 'event'],
97
+            shouldShowTypeSort: ['short', 'guide', 'publication', 'technique', 'object', 'post']
133 98
         }
134 99
     },
135 100
     computed: {
@@ -141,12 +106,12 @@ export default {
141 106
                         Object.keys(this.sortTypes)[0],
142 107
                         Object.keys(this.sortTypes)[3],
143 108
                         Object.keys(this.sortTypes)[1],
144
-                        Object.keys(this.sortTypes)[4],
109
+                        `by ${this.type} type`,
145 110
                     ]
146 111
                     break
147 112
                 case 'post':
148 113
                     opts = [
149
-                        Object.keys(this.sortTypes)[6],
114
+                        `by ${this.type} type`,
150 115
                     ]
151 116
                     break
152 117
                 case 'short':

Laden…
Annuleren
Opslaan