Skip to content
Snippets Groups Projects
Commit 88cbeb27 authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

re meta#300 navigasjon tilbake til søkeresultater for mobil

parent a95c495f
No related branches found
No related tags found
No related merge requests found
......@@ -60,17 +60,11 @@ export default {
props: {
article: Object
},
data: function() {
return {
source: null
}
},
computed: {
link_to_self: function() {
return {
ref: '/' + this.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma),
article: this.article,
source: this.source
article: this.article
}
},
dictionary: function() {
......@@ -96,10 +90,6 @@ export default {
details_click: function(item) {
this.$emit('details-click', item)
}
},
created: function() {
// make non reactive
this.source = this.$route.path
}
}
</script>
......
......@@ -39,8 +39,13 @@
:lang="lang"
@article-click="article_link_click"
@details-click="details_click"
v-if="search_results.length && ! waiting" />
v-if="search_results.length && ! waiting && ! article" />
<div id="single_article_container" v-if="article">
<div class="return_to_results" v-if="search_results">
<router-link :to="article.source" @click.native="return_to_results()">
🡠 Tilbake til søkeresultater
</router-link>
</div>
<Article :key="article_key" :article="article" @article-click="article_link_click" />
</div>
<div class="welcome" v-if="! (article || error || search_results.length || waiting)">
......@@ -179,8 +184,9 @@ export default {
methods: {
select_result: function(event) {
if(event.articles){
this.$router.push('/' + this.lang + '/w/' + event.word)
this.search_results = event.articles
let source = '/' + this.lang + '/w/' + event.word
this.$router.push(source)
this.search_results = event.articles.map(a => Object.assign(a, {source: source}))
this.article = null
this.error = null
history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang, error: this.error}, '')
......@@ -204,9 +210,11 @@ export default {
}
},
details_click: function(item) {
this.article = Object.assign(item.article, {source: item.source})
this.search_results = []
this.article = item.article
history.replaceState({article: this.article, search_results: [], lang: this.lang, error: null}, '')
},
return_to_results: function() {
this.article = null
}
},
mounted: function(){
......
......@@ -42,7 +42,7 @@ export default {
this.$emit('article-click', item)
},
details_click: function(item) {
this.$emit('details-click', Object.assign(item, {results: this.hits}))
this.$emit('details-click', item)
}
},
components: {
......
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