Skip to content
Snippets Groups Projects
Commit e5ec60e1 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

carry out search when selecting part of speech. Pusj to router

parent 691040e9
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</v-radio-group> </v-radio-group>
</div> </div>
<div class="pos_select_container"> <div class="pos_select_container">
<v-select <v-select @change="update_pos"
dense dense
rounded rounded
disable-lookup disable-lookup
...@@ -194,7 +194,7 @@ function navigate_to_query(self, word) { ...@@ -194,7 +194,7 @@ function navigate_to_query(self, word) {
let query = self.event ? self.event : {q: word} let query = self.event ? self.event : {q: word}
// Get article IDs // Get article IDs
api.get('articles?', {params: {w: query.match || query.q, dict: self.lang, scope: "w", stage: self.stage}}).then((response) => { api.get('articles?', {params: {w: query.match || query.q, dict: self.lang, scope: "w", stage: self.stage, wc: self.pos_selected.tag}}).then((response) => {
let article_ids = response.data let article_ids = response.data
let unwrapped = [] let unwrapped = []
for (const d in article_ids) { for (const d in article_ids) {
...@@ -332,6 +332,23 @@ export default { ...@@ -332,6 +332,23 @@ export default {
navigate_to_query(this, query) navigate_to_query(this, query)
} }
}, },
update_pos: function (pos) {
this.pos_selected = pos
let name = null
let query = null
if(this.$route.name == 'word') {
name = "w"
query = this.$route.params.word
this.$router.push(`/${this.lang}/${name}/${query}/${pos.tag.toLowerCase()}`)
navigate_to_query(this, query)
}
else if (this.$route.name == 'search') {
name = "search"
query = this.$route.params.query
this.$router.push(`/${this.lang}/${query}/${pos.tag.toLowerCase()}`)
navigate_to_query(this, query)
}
},
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