Skip to content
Snippets Groups Projects
Commit 1e20c181 authored by moon's avatar moon
Browse files

Improved search suggestions

parent d52b911d
No related branches found
No related tags found
No related merge requests found
......@@ -106,7 +106,7 @@
<div slot="suggestion-item" slot-scope="{ suggestion }">
<span v-if="suggestion.type === 'protein'">{{suggestion.gene_name}} ({{suggestion.id}}): {{suggestion.species_name}}</span>
<span v-else-if="suggestion.type === 'condensate'">{{suggestion.id}}</span>
<span v-else-if="suggestion.type === 'search'">Search for <b>{{suggestion.id}}</b></span>
<span v-else-if="suggestion.type === 'search'">Search for <b>{{suggestion.id.replace(/\#/g, '')}}</b></span>
</div>
</vue-simple-suggest>
</div>
......@@ -265,6 +265,8 @@ export default {
onSelect(item) {
if (item.type === 'protein') {
this.keyword = '(' + item.id + ')';
} else if (item.type === 'search') {
this.keyword = item.id.replace(/\#/g, '');
} else {
this.keyword = item.id;
}
......@@ -330,7 +332,12 @@ export default {
}
}), 'id');
ret.push({id: query, type: 'search'})
if (ret.length > 9) {
ret.splice(9, 0, {id: '#' + query, type: 'search'})
} else {
ret.push({id: '#' + query, type: 'search'})
}
// console.log(ret);
return ret;
......
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