add form items to LibraryOptions

This commit is contained in:
axolotle
2021-03-11 15:47:38 +01:00
parent 5e0c6a12a3
commit 6c5675ad79
3 changed files with 82 additions and 4 deletions
+22 -1
View File
@@ -9,5 +9,26 @@
"gallery": "Créations numériques",
"blog": "Blog"
},
"siblings": "Textes rebonds"
"options": {
"display": {
"title": "Gestion de l'affichage",
"choices": {
"tree-map": "Arborescent",
"card-map": "Aléatoire",
"card-list": "Alphabétique"
}
},
"filters": {
"title": "Filtres",
"choices": {
"tags": "Tags",
"strangeness": "Degré d'étrangement"
}
},
"search": {
"title": "Rechercher"
}
},
"siblings": "Textes rebonds",
"tags": "Tags"
}
+58 -2
View File
@@ -1,13 +1,69 @@
<template>
<component-debug :component="this" v-if="show" />
<div v-if="show" class="d-flex justify-content-between">
<b-form-group
:label="$t('options.display.title')"
v-slot="{ ariaDescribedby }"
>
<b-form-radio-group
id="mode-select"
v-model="currentMode" :options="modes"
name="mode-select" :aria-describedby="ariaDescribedby" buttons
size="sm"
/>
</b-form-group>
<b-form-group
v-if="currentMode !== 'tree-map'"
:label="$t('options.filters.title')"
label-for="tags-select"
>
<multiple-tags-select id="tags-select" v-model="selectedTags" :options="tags" />
</b-form-group>
<b-form-group
:label="$t('options.search.title')"
label-for="search-input"
>
<b-input-group size="sm" append="search-icon">
<b-form-input v-model="search" id="search-input" trim />
</b-input-group>
</b-form-group>
</div>
</template>
<script>
import MultipleTagsSelect from '@/components/formItems/MultipleTagsSelect'
export default {
name: 'LibraryOptions',
components: {
MultipleTagsSelect
},
props: {
show: { type: Boolean, default: true }
show: { type: Boolean, required: true },
mode: { type: String, required: true },
tags: { type: Array, default: () => ([]) }
},
data () {
return {
modes: [
{ text: this.$t('options.display.choices.tree-map'), value: 'tree-map' },
{ text: this.$t('options.display.choices.card-map'), value: 'card-map' },
{ text: this.$t('options.display.choices.card-list'), value: 'card-list' }
],
currentMode: this.mode,
selectedTags: [],
search: ''
}
},
watch: {
currentMode (mode) {
this.$router.push({ query: { mode } })
}
}
}
</script>
+2 -1
View File
@@ -38,7 +38,8 @@ export default [
return { mode, texts }
},
options: ({ query }) => ({
show: !('texts' in query && query.texts.length)
show: !('texts' in query && query.texts.length),
mode: query.mode || 'tree-map'
})
}
},