Compare commits

...

2 Commits

Author SHA1 Message Date
3478901450 search repaired 2019-07-02 11:37:59 +02:00
d48a3bf5ed search for tags / normal text search not working 2019-06-27 12:08:08 +02:00

View File

@ -99,7 +99,13 @@
<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()">
<b-field>
<b-taginput
<b-input
type="search"
v-model="searchtext"
icon="magnify"
placeholder="Suche...">
</b-input>
<!--<b-taginput
id="search-text"
type="search"
v-model="selected"
@ -107,10 +113,10 @@
autocomplete
allow-new:true
icon="magnify"
placeholder="suche.."
placeholder="Suche.."
@typing="getFilteredTags"
@input="saveTagsToArray">
</b-taginput>
</b-taginput>-->
</b-field>
</form>
</div>
@ -167,8 +173,8 @@
</div>
<script>
var tagArray = [];
const data=[
var tagArray = ["lorem"];
const dat=[
'th',
'efi',
'wichtig',
@ -192,12 +198,12 @@
return{
searchtext: "ipsum",
selected: [],
taglist: data,
taglist: dat,
};
},
methods: {
search: function() {
console.log("Searchtext: " +this.searchtext);
console.log("Searchtext: " +this.searchtext + tagArray);
$.ajax({
url: "api/msg/search/" + this.searchtext,
method: "GET"
@ -216,30 +222,49 @@
})
},
getFilteredTags(text) {
this.taglist = data.filter((option) => {
this.taglist = dat.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
this.search();
},
saveTagsToArray: function() {
tagArray = this.selected;
console.info(tagArray);
},
function get_insert_tag(id){
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){
$.ajax({ url: "api/tag/"+id, method: "GET" }).done(function (tag) {
data.push("#"+tag.name);
dat.push("#"+tag.name);
console.log("it worked!");
}).fail(function (e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
},
},
mounted: function () {
//this.search();
},
});
}