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

Merge branch 'reload_lang_change' into 'master'

Reload lang change

See merge request spraksamlingane/beta.ordbok.uib.no!11
parents bb49b3ca 2ca700d0
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="force_rerender">
<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,9 +197,11 @@ export default { ...@@ -195,9 +197,11 @@ export default {
}, },
methods: { methods: {
select_result: function(event) { select_result: function(event) {
this.event = event
if(event.articles){ 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)
console.log(this.$router)
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}))
this.article = null this.article = null
this.error = null this.error = null
...@@ -211,6 +215,15 @@ export default { ...@@ -211,6 +215,15 @@ 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>'}})
} }
}, },
force_rerender: function(event) {
if (this.event){
this.event.articles = null
this.select_result(this.event)
}
else{
navigate_to_search(this, this.$router.history.current.params.word)
}
},
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