search for tags / normal text search not working

This commit is contained in:
Senta Mandutz 2019-06-27 12:08:08 +02:00
parent ab358abe98
commit d48a3bf5ed

View File

@ -97,7 +97,7 @@
<div class="om-header-container"> <div class="om-header-container">
<div class="om-header"> <div class="om-header">
<a class="logo-img" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a> <a class="logo-img" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a>
<form class="om-searchbar" @submit.prevent="search()"> <form class="om-searchbar" @submit.prevent="search">
<b-field> <b-field>
<b-taginput <b-taginput
id="search-text" id="search-text"
@ -168,7 +168,7 @@
<script> <script>
var tagArray = []; var tagArray = [];
const data=[ const dat=[
'th', 'th',
'efi', 'efi',
'wichtig', 'wichtig',
@ -216,7 +216,7 @@
}) })
}, },
getFilteredTags(text) { getFilteredTags(text) {
this.taglist = data.filter((option) => { this.taglist = dat.filter((option) => {
return option return option
.toString() .toString()
.toLowerCase() .toLowerCase()
@ -227,19 +227,37 @@
tagArray = this.selected; tagArray = this.selected;
console.info(tagArray); console.info(tagArray);
}, },
list_tags: function () {
$.ajax({url: "api/tag/ids",method: "GET"})
.done(jd => {
// NICHT SO wg. Vue: _messagelist = jd;
_taglist.splice(0, _taglist.length);
_taglist.push.apply(_taglist, jd);
console.log("tag: jd: " + jd);
for (var e in jd) {
if (!_tags[jd[e]]) {
get_insert_tag(jd[e]);
}
}
}).fail(function (e, f, g) {
console.log("err: " + e + f + g);
});
}
},
mounted: function () {
//this.search();
this.list_tags();
},
});
function get_insert_tag(id){ function get_insert_tag(id){
$.ajax({ url: "api/tag/"+id, method: "GET" }).done(function (tag) { $.ajax({ url: "api/tag/"+id, method: "GET" }).done(function (tag) {
data.push("#"+tag.name); dat.push("#"+tag.name);
console.log("it worked!"); console.log("it worked!");
}).fail(function (e, f, g) { }).fail(function (e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g); console.log("cannot load " + id + ".json: " + e + f + g);
}) })
}, }
},
mounted: function () {
//this.search();
},
});