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

bedre presentasjon av "alle søkeresultater"

parent 3c0581a1
No related branches found
No related tags found
No related merge requests found
<template> <template>
<li> <li>
<div class="preview"> <div class="preview">
<h4>{{searchHit.text || "Alle søkeresultater..."}}</h4> <h4>{{searchHit.text ||
(searchHit._source && searchHit._source.lemmas.map(l => l.lemma) || []).join(',') ||
"Alle søkeresultater..."}}</h4>
<h5 v-if="searchHit._source">{{group_list}}</h5> <h5 v-if="searchHit._source">{{group_list}}</h5>
{{previewText.substring(0, 40) + (previewText ? '...' : '')}} {{previewText.substring(0, 40) + (previewText ? '...' : '')}}
</div> </div>
......
<template> <template>
<section class=""> <section>
<h2 v-if="hits.length">Søkeresultater</h2> <h2 v-if="hits.length">Søkeresultater</h2>
<ul> <ul class="hits">
<li v-for="(result, index) in extended_results" :key="index"> <Preview v-for="(result, index) in hits" :key="index" :searchHit="result" @click.native="article_link_click(result._source)">
<router-link :to="result.id" @click.native="article_link_click(result.article)">
{{result.label}}; </Preview>
</router-link>
({{result.classification}})
</li>
</ul> </ul>
</section> </section>
</template> </template>
<script> <script>
import helpers from '../utils/helpers.js' import helpers from '../utils/helpers.js'
import Preview from './Preview.vue'
export default { export default {
name: 'SearchResults', name: 'SearchResults',
props: { props: {
...@@ -34,10 +33,30 @@ export default { ...@@ -34,10 +33,30 @@ export default {
} }
}, },
methods: { methods: {
article_link_click: function(item) { article_link_click: function(article) {
this.$emit('search-hit-click', item) this.$router.push('' + article.article_id)
this.$emit('search-hit-click', article)
} }
},
components: {
Preview
} }
} }
</script> </script>
<style>
.hits .preview {
margin: 10px;
padding: 5px;
cursor: pointer;
}
.hits .preview h4 {
color: rgb(0, 0, 238);
text-decoration: underline;
}
.hits {
margin-top: 20px;
}
</style>
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