Skip to content

Commit

Permalink
Search for tag value by clicking on it
Browse files Browse the repository at this point in the history
  • Loading branch information
iandk committed Mar 16, 2021
1 parent 6bad62c commit 30015ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions public/app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ var app = new Vue({
this.ips = "";
this.price = "";
this.notes = "";
},
searchTag(tag) {
// Tag is already set, clear the input field
if(this.searchQuery == tag) {
this.searchQuery = null;
}
// Set searchQuery to the tag value
else {
this.searchQuery = tag;
}


}
},
computed: {
Expand Down
4 changes: 2 additions & 2 deletions public/view/component/list.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@
</td>
<td class="px-6 py-6 ">
<div class="text-sm text-gray-600">
<div v-for="tag in filterTags(host.tags)" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold bg-indigo-100 text-indigo-800 m-1">
<button @click="searchTag(tag)" v-for="tag in filterTags(host.tags)" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-semibold bg-indigo-100 text-indigo-800 m-1">
{{ tag }}
</div>
</button @click="searchQuery = tag">
<div v-if="host.tags === 'undefined' || host.tags === 'null' || !host.tags" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium border border-dashed border-gray-300 text-gray-300 m-1">
none
</div>
Expand Down

0 comments on commit 30015ec

Please sign in to comment.