diff options
author | Zero~Informatique | 2020-09-11 00:15:04 +0200 |
---|---|---|
committer | G.Fouet | 2020-09-11 21:53:18 +0200 |
commit | e6c2a8d9653ffde924632ca2f260c3a8cddc14ed (patch) | |
tree | ccc847bdec26d131ee260203410d7a16a0a6fbcf /viewer/src/components/LdCommandSort.vue | |
parent | d72e317896bcc2a675d21cec6f286e0b2730d77c (diff) | |
download | ldgallery-e6c2a8d9653ffde924632ca2f260c3a8cddc14ed.tar.gz |
viewer: item display order
github: resolves #28
Diffstat (limited to 'viewer/src/components/LdCommandSort.vue')
-rw-r--r-- | viewer/src/components/LdCommandSort.vue | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/viewer/src/components/LdCommandSort.vue b/viewer/src/components/LdCommandSort.vue new file mode 100644 index 0000000..1d2eac3 --- /dev/null +++ b/viewer/src/components/LdCommandSort.vue | |||
@@ -0,0 +1,57 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | ||
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | ||
5 | -- 2020 Pacien TRAN-GIRARD | ||
6 | -- | ||
7 | -- This program is free software: you can redistribute it and/or modify | ||
8 | -- it under the terms of the GNU Affero General Public License as | ||
9 | -- published by the Free Software Foundation, either version 3 of the | ||
10 | -- License, or (at your option) any later version. | ||
11 | -- | ||
12 | -- This program is distributed in the hope that it will be useful, | ||
13 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | -- GNU Affero General Public License for more details. | ||
16 | -- | ||
17 | -- You should have received a copy of the GNU Affero General Public License | ||
18 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
19 | --> | ||
20 | |||
21 | <template> | ||
22 | <b-dropdown v-model="selectedSort" :mobile-modal="false" append-to-body @change="onChangeSort"> | ||
23 | <a slot="trigger" class="link"> | ||
24 | <fa-icon icon="sort-amount-down" size="lg" /> | ||
25 | </a> | ||
26 | <b-dropdown-item v-for="(sort, idx) in SORTS" :key="idx" :value="idx"> | ||
27 | <fa-icon :icon="['far', idx === selectedSort ? 'dot-circle' : 'circle']" /> | ||
28 | <span :class="$style.ml1">{{ sort.name }}</span> | ||
29 | </b-dropdown-item> | ||
30 | </b-dropdown> | ||
31 | </template> | ||
32 | |||
33 | <script lang="ts"> | ||
34 | import { Component, Vue, Prop } from "vue-property-decorator"; | ||
35 | import { RawLocation } from "vue-router"; | ||
36 | import ItemSortFn from "@/services/itemSortFn"; | ||
37 | |||
38 | @Component | ||
39 | export default class LdCommandSort extends Vue { | ||
40 | readonly SORTS = [ | ||
41 | { name: this.$t("command.sort.byName"), fn: ItemSortFn.sortByName }, | ||
42 | { name: this.$t("command.sort.byDateDesc"), fn: ItemSortFn.sortByDateDesc }, | ||
43 | ]; | ||
44 | |||
45 | selectedSort = 0; | ||
46 | |||
47 | onChangeSort(newValue: number) { | ||
48 | this.$uiStore.setSortFn(this.SORTS[newValue].fn); | ||
49 | } | ||
50 | } | ||
51 | </script> | ||
52 | |||
53 | <style lang="scss" module> | ||
54 | .ml1 { | ||
55 | margin-left: 0.5em; | ||
56 | } | ||
57 | </style> | ||