Skip to content
Snippets Groups Projects
Commit dad4bea9 authored by Petr Kalashnikov's avatar Petr Kalashnikov
Browse files

Reload search result when the lang is changed

parent 916ca868
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<main> <main>
<div class="search_container"> <div class="search_container">
<div class="lang_select_container"> <div class="lang_select_container">
<v-radio-group row v-model="lang"> <v-radio-group row v-model="lang" @change="forceRerender">
<template v-slot:label> <template v-slot:label>
<span>VIS</span> <span>VIS</span>
</template> </template>
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
</div> </div>
<SearchResults :hits="search_results" <SearchResults :hits="search_results"
:lang="lang" :lang="lang"
:key="lang"
@article-click="article_link_click" @article-click="article_link_click"
@details-click="details_click" @details-click="details_click"
v-if="search_results.length && ! waiting && ! article" /> v-if="search_results.length && ! waiting && ! article" />
...@@ -177,7 +178,8 @@ export default { ...@@ -177,7 +178,8 @@ export default {
article: null, article: null,
error: null, error: null,
monthly_bm: null, monthly_bm: null,
monthly_nn: null monthly_nn: null,
event: null
} }
}, },
computed: { computed: {
...@@ -195,7 +197,10 @@ export default { ...@@ -195,7 +197,10 @@ export default {
}, },
methods: { methods: {
select_result: function(event) { select_result: function(event) {
if(event.articles){ this.event = event
if(!event){
return false
}else if(event.articles){
let source = '/' + this.lang + '/w/' + event.word let source = '/' + this.lang + '/w/' + event.word
this.$router.push(source) this.$router.push(source)
this.search_results = event.articles.sort(compare_by_hgno(decodeURIComponent(event.word))).map(a => Object.assign(a, {source: source})) this.search_results = event.articles.sort(compare_by_hgno(decodeURIComponent(event.word))).map(a => Object.assign(a, {source: source}))
...@@ -211,6 +216,10 @@ export default { ...@@ -211,6 +216,10 @@ export default {
this.$plausible.trackEvent('dropdown selection', {props: {query: event.label, match: '<fritekstsøk>'}}) this.$plausible.trackEvent('dropdown selection', {props: {query: event.label, match: '<fritekstsøk>'}})
} }
}, },
forceRerender: function(event) {
if (this.event){this.event.articles = null}
this.select_result(this.event)
},
article_link_click: function(item) { article_link_click: function(item) {
if (this.article && this.article.article_id == item.article_id){ if (this.article && this.article.article_id == item.article_id){
this.article_key++ this.article_key++
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment