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

Various fixes

parent 87f70d16
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
debounced: debounce(function(q, self) { debounced: debounce(function(q, self) {
self.loading = true self.loading = true
return axios.get(self.endpoint + 'suggest?', { params: {q: q, return axios.get(self.endpoint + 'suggest?', { params: {q: q,
dict: this.$parent.lang, dict: self.$parent.lang,
n: 9}} ) n: 9}} )
.then( .then(
function(response) { function(response) {
...@@ -89,35 +89,35 @@ ...@@ -89,35 +89,35 @@
if (typeof item != 'string') { if (typeof item != 'string') {
let self = this let self = this
console.log(item.lang) console.log(item.lang)
if (item.articles) {
axios.get(self.endpoint + 'articles?', {params: {lord: item.match, axios.get(self.endpoint + 'articles?', {params: {lord: item.match,
dict: item.lang.join(",")}}) dict: self.$parent.lang}})
.then( .then(
function(response) { function(response) {
if (item.articles) {
console.log(item)
['bob', 'nob'].forEach((dict_tag) => { ['bob', 'nob'].forEach((dict_tag) => {
alert(dict_tag) response.data[dict_tag].forEach((article_id) => {
response[dict_tag].forEach((article_id) => {
let article = {} let article = {}
article.article_id = article_id article.article_id = article_id
article.dictionary = dict_tag article.dictionary = dict_tag
//article.source = `/${self.$parent.lang}/w/${item.match}`
article.match = item.match
item.articles.push(article) item.articles.push(article)
})
}) })
}) }
} )
console.log(item) }
console.log(item)
self.$emit('submit', item) self.$emit('submit', item)
this.items = []
this.suggesting = false
} setTimeout(() => {
) self.$refs.autocomplete.$refs.input.select()
this.items = []
setTimeout(() => { this.suggesting = false
self.$refs.autocomplete.$refs.input.select() }, 1)
}, 1)
} }
// If blurred // If blurred
else { else {
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
methods: { methods: {
run_query(q) { run_query(q) {
this.suggesting = true this.suggesting = true
// Put full text search in the list while processing suggestions
if (this.items[0]) { if (this.items[0]) {
if (this.items[0].lang) { if (this.items[0].lang) {
this.items.unshift({q: q, label: q}) this.items.unshift({q: q, label: q})
......
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