|
11 | 11 | <template #activator="{ props: menuProps }">
|
12 | 12 | <v-icon
|
13 | 13 | v-bind="menuProps"
|
| 14 | + class="mr-6" |
14 | 15 | >
|
15 | 16 | mdi-cog
|
16 | 17 | </v-icon>
|
|
39 | 40 | </v-list-item>
|
40 | 41 | </v-list>
|
41 | 42 | </v-menu>
|
42 |
| - <div class="mx-6"> |
43 |
| - Sort By: |
44 |
| - </div> |
45 |
| - <v-chip-group |
46 |
| - :model-value="sortOption" |
47 |
| - selected-class="white text-light-blue bg-white" |
48 |
| - dark |
49 |
| - mandatory |
50 |
| - style="min-width: 25%" |
| 43 | + <DandisetSearchField class="flex-grow-1 mr-2" /> |
| 44 | + <v-btn |
| 45 | + variant="flat" |
51 | 46 | >
|
52 |
| - <v-chip |
53 |
| - v-for="(option, i) in sortingOptions" |
54 |
| - :key="option.name" |
55 |
| - @click="changeSort(i)" |
| 47 | + <span class="pr-2"> |
| 48 | + <span |
| 49 | + v-if="sortDir === 1" |
| 50 | + > |
| 51 | + <v-icon>mdi-sort-reverse-variant</v-icon> |
| 52 | + <v-icon>mdi-arrow-up-thin</v-icon> |
| 53 | + </span> |
| 54 | + <span v-else> |
| 55 | + <v-icon>mdi-sort-variant</v-icon> |
| 56 | + <v-icon>mdi-arrow-down-thin</v-icon> |
| 57 | + </span> |
| 58 | + </span> |
| 59 | + <span |
| 60 | + class="d-none d-sm-inline" |
56 | 61 | >
|
57 |
| - {{ option.name }} |
58 |
| - <v-icon end> |
59 |
| - <template v-if="sortDir === -1 || sortOption !== i"> |
60 |
| - mdi-sort-variant |
61 |
| - </template> |
62 |
| - <template v-else> |
63 |
| - mdi-sort-reverse-variant |
64 |
| - </template> |
65 |
| - </v-icon> |
66 |
| - </v-chip> |
67 |
| - </v-chip-group> |
68 |
| - <DandisetSearchField class="flex-grow-1" /> |
| 62 | + {{ sortingOptions[sortOption].name }} |
| 63 | + </span> |
| 64 | + <v-tooltip |
| 65 | + location="top" |
| 66 | + activator="parent" |
| 67 | + > |
| 68 | + <span>Sorting Options</span> |
| 69 | + </v-tooltip> |
| 70 | + <v-menu activator="parent"> |
| 71 | + <v-list> |
| 72 | + <v-item-group v-model="sortOption"> |
| 73 | + <v-list-subheader |
| 74 | + class="text-high-emphasis font-weight-bold" |
| 75 | + > |
| 76 | + Sort by |
| 77 | + </v-list-subheader> |
| 78 | + <v-item |
| 79 | + v-for="(option, i) in sortingOptions" |
| 80 | + :key="option.name" |
| 81 | + v-slot="{ isSelected, toggle }" |
| 82 | + :value="i" |
| 83 | + > |
| 84 | + <v-list-item |
| 85 | + class="pl-8" |
| 86 | + :active="isSelected" |
| 87 | + @click="toggle" |
| 88 | + > |
| 89 | + <template #append> |
| 90 | + <v-icon v-if="isSelected"> |
| 91 | + mdi-check |
| 92 | + </v-icon> |
| 93 | + </template> |
| 94 | + <v-list-item-title>{{ option.name }}</v-list-item-title> |
| 95 | + </v-list-item> |
| 96 | + </v-item> |
| 97 | + </v-item-group> |
| 98 | + <v-divider /> |
| 99 | + <v-item-group v-model="sortDir"> |
| 100 | + <v-list-subheader |
| 101 | + class="text-high-emphasis font-weight-bold" |
| 102 | + > |
| 103 | + Order |
| 104 | + </v-list-subheader> |
| 105 | + <v-item |
| 106 | + v-slot="{ isSelected, toggle }" |
| 107 | + :value="1" |
| 108 | + > |
| 109 | + <v-list-item |
| 110 | + class="pl-8" |
| 111 | + :active="isSelected" |
| 112 | + @click="toggle" |
| 113 | + > |
| 114 | + <template #append> |
| 115 | + <v-icon v-if="sortDir === 1"> |
| 116 | + mdi-check |
| 117 | + </v-icon> |
| 118 | + </template> |
| 119 | + <v-list-item-title>Ascending</v-list-item-title> |
| 120 | + </v-list-item> |
| 121 | + </v-item> |
| 122 | + <v-item |
| 123 | + v-slot="{ isSelected, toggle }" |
| 124 | + :value="-1" |
| 125 | + > |
| 126 | + <v-list-item |
| 127 | + class="pl-8" |
| 128 | + :active="isSelected" |
| 129 | + @click="toggle" |
| 130 | + > |
| 131 | + <template #append> |
| 132 | + <v-icon v-if="sortDir === -1"> |
| 133 | + mdi-check |
| 134 | + </v-icon> |
| 135 | + </template> |
| 136 | + <v-list-item-title>Descending</v-list-item-title> |
| 137 | + </v-list-item> |
| 138 | + </v-item> |
| 139 | + </v-item-group> |
| 140 | + </v-list> |
| 141 | + </v-menu> |
| 142 | + </v-btn> |
69 | 143 | </v-toolbar>
|
70 | 144 | <div
|
71 | 145 | v-if="props.search && djangoDandisetRequest"
|
@@ -203,16 +277,18 @@ watch(queryParams, (params) => {
|
203 | 277 | },
|
204 | 278 | });
|
205 | 279 | });
|
| 280 | +</script> |
206 | 281 |
|
207 |
| -function changeSort(index: number) { |
208 |
| - if (sortOption.value === index) { |
209 |
| - sortDir.value *= -1; |
210 |
| - } else { |
211 |
| - sortOption.value = index; |
212 |
| - sortDir.value = -1; |
213 |
| - } |
| 282 | +<style scoped> |
| 283 | +.btn-group--sort-options { |
| 284 | + min-width: 84px; |
| 285 | +} |
214 | 286 |
|
215 |
| - page.value = 1; |
| 287 | +.btn--sort-option { |
| 288 | + min-width: 56px; |
216 | 289 | }
|
217 | 290 |
|
218 |
| -</script> |
| 291 | +.btn--sort-order { |
| 292 | + min-width: 28px; |
| 293 | +} |
| 294 | +</style> |
0 commit comments