aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components
diff options
context:
space:
mode:
authorZero~Informatique2020-09-11 20:10:56 +0200
committerG.Fouet2020-09-11 21:53:18 +0200
commitf89ed0bd94ea570d9e6533301783d13b13033db0 (patch)
tree668596be054bf064334553a32f20fc83302a51d8 /viewer/src/components
parent12b8f20f3dc1cdbda820808755545a8ce1382123 (diff)
downloadldgallery-f89ed0bd94ea570d9e6533301783d13b13033db0.tar.gz
viewer: PR #238 code review changes
Diffstat (limited to 'viewer/src/components')
-rw-r--r--viewer/src/components/LdCommandSort.vue6
-rw-r--r--viewer/src/components/LdProposition.vue13
2 files changed, 12 insertions, 7 deletions
diff --git a/viewer/src/components/LdCommandSort.vue b/viewer/src/components/LdCommandSort.vue
index 1d2eac3..1eef5d3 100644
--- a/viewer/src/components/LdCommandSort.vue
+++ b/viewer/src/components/LdCommandSort.vue
@@ -25,7 +25,7 @@
25 </a> 25 </a>
26 <b-dropdown-item v-for="(sort, idx) in SORTS" :key="idx" :value="idx"> 26 <b-dropdown-item v-for="(sort, idx) in SORTS" :key="idx" :value="idx">
27 <fa-icon :icon="['far', idx === selectedSort ? 'dot-circle' : 'circle']" /> 27 <fa-icon :icon="['far', idx === selectedSort ? 'dot-circle' : 'circle']" />
28 <span :class="$style.ml1">{{ sort.name }}</span> 28 <span :class="$style.dropdownLabel">{{ sort.name }}</span>
29 </b-dropdown-item> 29 </b-dropdown-item>
30 </b-dropdown> 30 </b-dropdown>
31</template> 31</template>
@@ -38,7 +38,7 @@ import ItemSortFn from "@/services/itemSortFn";
38@Component 38@Component
39export default class LdCommandSort extends Vue { 39export default class LdCommandSort extends Vue {
40 readonly SORTS = [ 40 readonly SORTS = [
41 { name: this.$t("command.sort.byName"), fn: ItemSortFn.sortByName }, 41 { name: this.$t("command.sort.byNameAsc"), fn: ItemSortFn.sortByNameAsc },
42 { name: this.$t("command.sort.byDateDesc"), fn: ItemSortFn.sortByDateDesc }, 42 { name: this.$t("command.sort.byDateDesc"), fn: ItemSortFn.sortByDateDesc },
43 ]; 43 ];
44 44
@@ -51,7 +51,7 @@ export default class LdCommandSort extends Vue {
51</script> 51</script>
52 52
53<style lang="scss" module> 53<style lang="scss" module>
54.ml1 { 54.dropdownLabel {
55 margin-left: 0.5em; 55 margin-left: 0.5em;
56} 56}
57</style> 57</style>
diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue
index e19e01a..34ddf51 100644
--- a/viewer/src/components/LdProposition.vue
+++ b/viewer/src/components/LdProposition.vue
@@ -47,8 +47,8 @@
47 47
48 <div class="disabled" :title="$t('tag-propositions.item-count')">{{ proposed.count }}</div> 48 <div class="disabled" :title="$t('tag-propositions.item-count')">{{ proposed.count }}</div>
49 </div> 49 </div>
50 <div v-if="showMore > 0" class="showmore" @click="limit += showMore"> 50 <div v-if="showMoreCount > 0" class="showmore" @click="limit += showMoreCount">
51 {{ $t("tag-propositions.showmore", [showMore]) }}<fa-icon icon="angle-double-down" /> 51 {{ $t("tag-propositions.showmore", [showMoreCount]) }}<fa-icon icon="angle-double-down" />
52 </div> 52 </div>
53 </div> 53 </div>
54</template> 54</template>
@@ -65,10 +65,15 @@ export default class LdProposition extends Vue {
65 @Prop({ required: true }) readonly tagsIndex!: Tag.Index; 65 @Prop({ required: true }) readonly tagsIndex!: Tag.Index;
66 @PropSync("searchFilters", { type: Array, required: true }) model!: Tag.Search[]; 66 @PropSync("searchFilters", { type: Array, required: true }) model!: Tag.Search[];
67 67
68 readonly INITIAL_TAG_DISPLAY_LIMIT = this.$galleryStore.config?.initialTagDisplayLimit ?? 10; 68 readonly INITIAL_TAG_DISPLAY_LIMIT = this.getInitialTagDisplayLimit();
69 69
70 limit: number = this.INITIAL_TAG_DISPLAY_LIMIT; 70 limit: number = this.INITIAL_TAG_DISPLAY_LIMIT;
71 71
72 getInitialTagDisplayLimit() {
73 const limit = this.$galleryStore.config?.initialTagDisplayLimit ?? 10;
74 return limit > 0 ? limit : 1000;
75 }
76
72 @Watch("$route") 77 @Watch("$route")
73 onRouteChange() { 78 onRouteChange() {
74 this.limit = this.INITIAL_TAG_DISPLAY_LIMIT; 79 this.limit = this.INITIAL_TAG_DISPLAY_LIMIT;
@@ -105,7 +110,7 @@ export default class LdProposition extends Vue {
105 .map(entry => ({ rawTag: entry[0], count: entry[1] })); 110 .map(entry => ({ rawTag: entry[0], count: entry[1] }));
106 } 111 }
107 112
108 get showMore(): number { 113 get showMoreCount(): number {
109 return Object.keys(this.propositions).length - Object.keys(this.proposedTags).length; 114 return Object.keys(this.propositions).length - Object.keys(this.proposedTags).length;
110 } 115 }
111 116