diff --git a/src/components/Autocomplete.vue b/src/components/Autocomplete.vue index 9cf14acb9b06e48f2dad319a34d25e352f80efab..8249f9d188939cc9252da9c4d668c9851eab6967 100644 --- a/src/components/Autocomplete.vue +++ b/src/components/Autocomplete.vue @@ -92,7 +92,7 @@ this.items.push({q: q, label: q, time: time, search: search}) } let self = this - self.api.get('suggest?', {params: {q: q, dict: self.$parent.lang, n: 80, scope: 'w', stage: self.$parent.stage}}) + self.api.get('suggest?', {params: {q: q, dict: self.$parent.lang, n: 80, scope: 'w', stage: self.$parent.stage, wc: self.$parent.pos_selected.tag}}) .then(async (response) => { if (self.$refs.autocomplete.searchInput == q & self.suggesting) { diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index dbf6de108470ee77a8955796a28f7480e66a2863..d850a52333eecf1c6b859bca75800dee30194c45 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -1,6 +1,7 @@ <template> <main> <div class="search_container"> + <div class="top_bar" fluid> <div class="lang_select_container"> <v-radio-group row v-model="lang" @change="update_lang_form"> <template v-slot:label tabindex="1"> @@ -28,6 +29,23 @@ </template> </v-radio> </v-radio-group> + </div> + <div class="pos_select_container"> + <v-select + dense + rounded + disable-lookup + flat + return-object + item-text="label" + outlined + hide-details="" + :menu-props="{maxHeight: $vuetify.breakpoint.name === 'xs' ? 190 : 500, transition: 'fade-transition', allowOverflow: true}" + v-model="pos_selected" + :items="pos" + label="Avgrens etter ordklasse" + ></v-select> + </div> </div> <Autocomplete v-on:submit="select_result" :api="get_search_endpoint"> </Autocomplete> @@ -96,6 +114,19 @@ const api = setup({ }) +const posOptions = [ + {label: "Alle ordklasser"}, + {label: "substantiv", tag: "NOUN"}, + {label: "pronomen", tag: "PRON"}, + {label: "determinativ", tag: "DET"}, + {label: "adjektiv", tag: "ADJ"}, + {label: "konjunksjon", tag: "CCONJ"}, + {label: "subjunksjon", tag: "SCONJ"}, + {label: "adverb", tag: "ADV"}, + {label: "preposisjon", tag: "ADP"}, + {label: "verb", tag: "VERB"}, + {label: "interjeksjon", tag: "INTJ"}, +] @@ -232,6 +263,8 @@ export default { article_key: 0, search_results: [], lang: 'bob,nob', + pos_selected: {label: "Alle ordklasser"}, + pos: posOptions, waiting_for_articles: true, waiting_for_metadata: true, article: null, @@ -449,10 +482,25 @@ div.monthly details, div.monthly h3 { color: var(--v-primary-base); } +.top_bar { + display: -webkit-box; + -webkit-box-orient: horizontal; + flex-direction: row; + flex-wrap: wrap; + vertical-align: bottom !important; + padding-bottom: 10px; +} + .lang_select_container { padding-left: 10px; } +.pos_select_container { + padding-left: 10px; + padding-right: 10px; + padding-bottom: 0px; +} + li.suggestion { font-weight: bold; padding-left: 20px;