From 87c966f1b5c5ddba28e534ce22b4f608e89fb92f Mon Sep 17 00:00:00 2001 From: Henrik Askjer <henrik.askjer@uib.no> Date: Wed, 22 Dec 2021 09:59:03 +0100 Subject: [PATCH] null as default pos --- src/components/DictionaryView.vue | 12 ++++++------ src/components/SearchToolbar.vue | 4 ++-- src/locales/nno.json | 1 - src/locales/nob.json | 1 - 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index 3c97bc2a..0bf93138 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -317,6 +317,7 @@ export default { } }, select_suggestion: function (word) { + this.pos_selected = null this.event = null this.inflection_suggestions = null navigate_to_query(this, word) @@ -327,7 +328,7 @@ export default { let path = `/${this.lang}/search` let pos = this.pos_param() let query = {q: event.match || event.q} - if (pos != "all") query["pos"] = pos + if (pos) query["pos"] = pos if (this.scope) query["scope"] = this.scope this.$router.push({path, query}) navigate_to_query(this) @@ -384,9 +385,7 @@ export default { generate_path: function(q) { if (q) { - let path = `/${this.lang}/search?q=${q}` - let pos = this.pos_param() - if (pos != 'all') path += "&pos=" + pos + let path = `/${this.lang}/search?q=${q}&scope=${this.scope}` if (this.scope) path += "&scope=" + this.scope return path } @@ -398,7 +397,7 @@ export default { let path = `/${this.lang}/search` let pos = this.pos_param() let query = {q: q} - if (pos != 'all') query.pos = pos + if (pos) query.pos = pos if (this.scope) query.scope = this.scope this.$router.push({path, query}) navigate_to_query(this, q) @@ -465,7 +464,8 @@ export default { self.lang = self.$route.params.lang || this.$store.state.defaultDict if (self.$route.query.pos) { self.pos_selected = self.$route.query.pos.toUpperCase() - } + } else self.pos_selected = null + if (self.$route.query.scope) { self.scope = self.$route.query.scope } diff --git a/src/components/SearchToolbar.vue b/src/components/SearchToolbar.vue index 07aaf3a5..e5ea4c20 100644 --- a/src/components/SearchToolbar.vue +++ b/src/components/SearchToolbar.vue @@ -4,8 +4,8 @@ <v-row > <v-col :cols="$vuetify.breakpoint.smAndDown ? 12 : 3"> <v-autocomplete - auto-select-first + clearable v-model="$parent.pos_selected" hide-details @@ -99,7 +99,7 @@ export default { this.$emit('updateScope', "wb") }, updatePos (pos) { - this.$emit('updatePos', pos || 'ALL') + this.$emit('updatePos', pos) } } } diff --git a/src/locales/nno.json b/src/locales/nno.json index 7d0f57f2..dc315b89 100644 --- a/src/locales/nno.json +++ b/src/locales/nno.json @@ -42,7 +42,6 @@ "back": "Tilbake", "back_to_results": "Tilbake til søkjeresultat", "pos": { - "ALL": "alle ordklasser", "NOUN": "substantiv", "PRON": "pronomen", "DET": "determinativ", diff --git a/src/locales/nob.json b/src/locales/nob.json index 194a26de..12770029 100644 --- a/src/locales/nob.json +++ b/src/locales/nob.json @@ -42,7 +42,6 @@ "back": "Tilbake", "back_to_results": "Tilbake til søkeresultater", "pos": { - "ALL": "alle ordklasser", "NOUN": "substantiv", "PRON": "pronomen", "DET": "determinativ", -- GitLab