Browse Source

extended search

master
Senta Mandutz 5 years ago
parent
commit
70befa7c4d
5 changed files with 306 additions and 278 deletions
  1. 215
    204
      public/index.html
  2. 75
    67
      public/routes/files.js
  3. 7
    4
      public/routes/home.js
  4. 6
    2
      public/routes/msgCard.js
  5. 3
    1
      server/dbs.js

+ 215
- 204
public/index.html View File

<html lang="en"> <html lang="en">


<head> <head>
<!-- NOTE: Meta Tags -->
<meta charset="utf-8">
<meta name="description" content="Ohm management app">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- NOTE: Meta Tags -->
<meta charset="utf-8">
<meta name="description" content="Ohm management app">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--for demonstration:--> <!--for demonstration:-->
<!-- <meta http-equiv="refresh" content="10">
<!-- <meta http-equiv="refresh" content="10">
<!-- <meta http-equiv="refresh" content="30"> --> <!-- <meta http-equiv="refresh" content="30"> -->


<!-- NOTE: Define Theme Color -->
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#0046a0">
<!-- NOTE: Icon for tab recognition -->
<!-- highest resolution for Chrome & Opera -->
<link rel="icon" sizes="192x192" href="favicon.ico">
<!-- icons for Safari -> iOS Icons -->
<!-- icons for IE & Windows phone -->
<meta name="msapplication-square70x70logo" content="icon_smalltile.png">
<meta name="msapplication-square150x150logo" content="icon_mediumtile.png">
<meta name="msapplication-square310x310logo" content="icon_largetile.png">
<meta name="msapplication-wide310x150logo" content="icon_widetile.png">
<!-- NOTE: iOS - Add to Homescreen -->
<!-- Hide Safari UI Components -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- iOS Status bar: black or black-translucent -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- iOS App Name next to Icon -->
<meta name="apple-mobile-web-app-title" content="OHM News">
<!-- Icon: No transparency allowed -->
<link rel="apple-touch-icon" href="img/launcher/ios_launcher_app_icon_192.png"> <!-- iphone -->
<link rel="apple-touch-icon" sizes="152x152" href="img/launcher/ios_launcher_app_icon_152.png"><!-- ipad -->
<link rel="apple-touch-icon" sizes="180x180" href="img/launcher/ios_launcher_app_icon_180.png"><!-- iphone-retina -->
<link rel="apple-touch-icon" sizes="167x167" href="img/launcher/ios_launcher_app_icon_167.png"><!-- ipad-retina -->
<!-- Splash screen: If not set, will be white screen -->
<link rel="apple-touch-startup-image" sizes="2048x2732" href="ios-splash/apple_splash_2048.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1668x2224"href="ios-splash/apple_splash_1668.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1536x2048" href="ios-splash/apple_splash_1536.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1125x2436" href="ios-splash/apple_splash_1125.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="1242x2208" href="ios-splash/apple_splash_1242.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="750x1334" href="ios-splash/apple_splash_750.png" /><!-- Phone -->
<link rel="apple-touch-startup-image" sizes="640x1136" href="ios-splash/apple_splash_640.png" /><!-- Phone -->
<!-- NOTE: CSS -->
<!-- CSS_Material Design for Bootstrap fonts and icons -->
<link rel="stylesheet" href="lib/bootstrap-font-and-icons.css">
<!-- CSS_Material Design for Bootstrap minified CSS -->
<!--<link rel="stylesheet" href="lib/bootstrap-material-design.min.css">-->
<!-- NOTE: Define Theme Color -->
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#0046a0">
<!-- NOTE: Icon for tab recognition -->
<!-- highest resolution for Chrome & Opera -->
<link rel="icon" sizes="192x192" href="favicon.ico">
<!-- icons for Safari -> iOS Icons -->
<!-- icons for IE & Windows phone -->
<meta name="msapplication-square70x70logo" content="icon_smalltile.png">
<meta name="msapplication-square150x150logo" content="icon_mediumtile.png">
<meta name="msapplication-square310x310logo" content="icon_largetile.png">
<meta name="msapplication-wide310x150logo" content="icon_widetile.png">
<!-- NOTE: iOS - Add to Homescreen -->
<!-- Hide Safari UI Components -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- iOS Status bar: black or black-translucent -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- iOS App Name next to Icon -->
<meta name="apple-mobile-web-app-title" content="OHM News">
<!-- Icon: No transparency allowed -->
<link rel="apple-touch-icon" href="img/launcher/ios_launcher_app_icon_192.png"> <!-- iphone -->
<link rel="apple-touch-icon" sizes="152x152" href="img/launcher/ios_launcher_app_icon_152.png"><!-- ipad -->
<link rel="apple-touch-icon" sizes="180x180" href="img/launcher/ios_launcher_app_icon_180.png"><!-- iphone-retina -->
<link rel="apple-touch-icon" sizes="167x167" href="img/launcher/ios_launcher_app_icon_167.png"><!-- ipad-retina -->
<!-- Splash screen: If not set, will be white screen -->
<link rel="apple-touch-startup-image" sizes="2048x2732" href="ios-splash/apple_splash_2048.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1668x2224" href="ios-splash/apple_splash_1668.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1536x2048" href="ios-splash/apple_splash_1536.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1125x2436" href="ios-splash/apple_splash_1125.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="1242x2208" href="ios-splash/apple_splash_1242.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="750x1334" href="ios-splash/apple_splash_750.png" /><!-- Phone -->
<link rel="apple-touch-startup-image" sizes="640x1136" href="ios-splash/apple_splash_640.png" /><!-- Phone -->
<!-- NOTE: CSS -->
<!-- CSS_Material Design for Bootstrap fonts and icons -->
<link rel="stylesheet" href="lib/bootstrap-font-and-icons.css">
<!-- CSS_Material Design for Bootstrap minified CSS -->
<!--<link rel="stylesheet" href="lib/bootstrap-material-design.min.css">-->


<!-- NOTE: Call manifest.json --> <!-- NOTE: Call manifest.json -->
<link rel="manifest" href="manifest.json">
<link rel="manifest" href="manifest.json">


<!-- NOTE: Load JQuery, Vue.js, VueRouter, Vuetify --> <!-- NOTE: Load JQuery, Vue.js, VueRouter, Vuetify -->
<script src="lib/jquery-3.3.1.min.js"></script> <script src="lib/jquery-3.3.1.min.js"></script>
<script src="lib/vue-2.6.10.js"></script> <script src="lib/vue-2.6.10.js"></script>
<script src="lib/vue-router-3.0.1.js"></script> <script src="lib/vue-router-3.0.1.js"></script>


<!-- Buefy/Vuetify -->
<!-- Buefy/Vuetify -->
<script src="lib/buefy-0.7.5.js"></script> <script src="lib/buefy-0.7.5.js"></script>
<!-- <script src="lib/buefy-0.7.5.min.js"></script>-->
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.5.94/css/materialdesignicons.min.css">
<!-- <script src="lib/buefy-0.7.5.min.js"></script>-->
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.5.94/css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.css"> <link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.css">
<!--<link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.min.css">-->
<!--<link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.min.css">-->


<!-- <script src="lib/vuetify-1.5.14.js"></script>-->
<!-- <script src="lib/vuetify-1.5.14.min.js"></script>-->
<!-- <link rel="stylesheet" type="text/css" href="lib/vuetify-1.5.14.css">-->
<!-- <link rel="stylesheet" type="text/css" href="lib/vuetify-1.5.14.min.css">-->
<!-- <script src="lib/vuetify-1.5.14.js"></script>-->
<!-- <script src="lib/vuetify-1.5.14.min.js"></script>-->
<!-- <link rel="stylesheet" type="text/css" href="lib/vuetify-1.5.14.css">-->
<!-- <link rel="stylesheet" type="text/css" href="lib/vuetify-1.5.14.min.css">-->


<!-- CSS_Custom Design -->
<link rel="stylesheet" type="text/css" href="style/style.css">
<!-- CSS_Custom Design -->
<link rel="stylesheet" type="text/css" href="style/style.css">


<!-- NOTE: JavaScript Libs & Files -->
<!-- NOTE: JavaScript Libs & Files -->
<script src="routes/home.js"></script> <script src="routes/home.js"></script>
<script src="routes/files.js"></script> <script src="routes/files.js"></script>
<script src="routes/createMessage.js"></script> <script src="routes/createMessage.js"></script>
<script src="routes/msgCard.js"></script> <script src="routes/msgCard.js"></script>
<script src="routes/messageData.js"></script> <script src="routes/messageData.js"></script>
<script src="routes/tagData.js"></script> <script src="routes/tagData.js"></script>
<script src="routes/profilCard.js"></script>
<script src="routes/profilData.js"></script>
<script src="routes/login.js"></script>
<script src="routes/profilCard.js"></script>
<script src="routes/profilData.js"></script>
<script src="routes/login.js"></script>
<script src="routes/navRoutes.js"></script> <script src="routes/navRoutes.js"></script>


<title>OHM News</title>
<title>OHM News</title>
</head> </head>


<body> <body>
<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-autocomplete
rounded
v-model="searchtext"
@keydown.native.enter="search"
:data="filteredDataArray"
placeholder="suche..."
icon="magnify"
@select="option => selected = option">
</b-autocomplete>
<b-autocomplete rounded v-model="searchtext" @keydown.native.enter="search" :data="filteredDataArray" placeholder="suche..." icon="magnify" @select="option => selected = option">
</b-autocomplete>


<!--<b-input <!--<b-input
type="search" type="search"
icon="magnify" icon="magnify"
placeholder="Suche..."> placeholder="Suche...">
</b-input>--> </b-input>-->
<!--<b-taginput
<!--<b-taginput
id="search-text" id="search-text"
type="search" type="search"
v-model="selected" v-model="selected"
@typing="getFilteredTags" @typing="getFilteredTags"
@input="saveTagsToArray"> @input="saveTagsToArray">
</b-taginput>--> </b-taginput>-->
<button @click="clear">x</button>
</b-field>
<b-button type="is-light" @click="clear">X</b-button>
</b-field>
</form> </form>
</div> </div>
</div> </div>


<div class="om-content"> <div class="om-content">
<div id=xxx></div>
<div id=xxx></div>
<nav-router></nav-router> <nav-router></nav-router>
<router-view></router-view> <router-view></router-view>
</div> </div>
</div> </div>


<!--<b-tabs type="is-toggle" expanded>
<!--<b-tabs type="is-toggle" expanded>
<b-tab-item><router-link to="/home" > <b-tab-item><router-link to="/home" >
<b-icon <b-icon
pack="fas" pack="fas"


</b-tabs>--> </b-tabs>-->


<!--
<!--
<nav class="navbar is-fixed-bottom is-expanded is-light is-hoverable" role="navigation" aria-label="main navigation"> <nav class="navbar is-fixed-bottom is-expanded is-light is-hoverable" role="navigation" aria-label="main navigation">
<div class="navbar-brand is-expanded"> <div class="navbar-brand is-expanded">
<router-link to="/home" class="navbar-item is-expanded has-text-centered is-active"> <router-link to="/home" class="navbar-item is-expanded has-text-centered is-active">
</div> </div>
--> -->
<script> <script>
var tagArray = ["lorem"];
const dat=[
'th',
'efi',
'wichtig',
];
var isSearchActive = false;
var tagArray = ["lorem"];
const dat = [
'th',
'efi',
'wichtig',
];

</script> </script>


<!-- const routes = [
<!-- const routes = [
{ path: "/", component: HomeRouter }, { path: "/", component: HomeRouter },
{ path: "/home", component: HomeRouter }, { path: "/home", component: HomeRouter },
{ path: "/files", component: FileRouter }, { path: "/files", component: FileRouter },
var app = new Vue({ var app = new Vue({
router, router,
el: '#api', el: '#api',
data: function() {
data: function() {
return { return {
searchtext: "", searchtext: "",
isSearchActiv: false,
selected: [],
taglist: dat,
//isSearchActiv: false,
selected: [],
taglist: dat,
}; };
},
computed:{
},
computed: {
filteredDataArray() { filteredDataArray() {
return this.taglist.filter((option) => { return this.taglist.filter((option) => {
return option return option
} }
}, },
methods: { methods: {
search: function() {
this.isSearchActiv = true;
console.log("Searchtext: " +this.searchtext.replace(/#/g,''));
$.ajax({
url: "api/msg/search/" + this.searchtext.replace(/#/g, ''),
method: "GET"
}).done(jd => {
// NICHT SO wg. Vue: _messagelist = jd;
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, jd);
//console.log("jd: "+jd);
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
}).fail(function(e, f, g) {
console.log("searching: err: " + e + f + g);
})
},
list_messages: function () {
$.ajax({url: "api/msg/ids", method: "GET"})
.done(jd => {
// NICHT SO wg. Vue: _messagelist = jd;
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, jd);
//console.log("jd: "+jd);
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
}).fail(function (e, f, g) {
console.log("list_msg: err: " + e + f + g);
});
},

getFilteredTags(text) { getFilteredTags(text) {
this.taglist = dat.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
this.taglist = dat.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
this.search(); this.search();
},
saveTagsToArray: function() {
tagArray = this.selected;
console.info(tagArray);
},
list_tags: function () {
$.ajax({url: "api/tag/ids",method: "GET"})
},
saveTagsToArray: function() {
tagArray = this.selected;
console.info(tagArray);
},
search: function() {
searching(this.searchtext);
},
list_messages: function() {
messages();
},
list_tags: function() {
$.ajax({
url: "api/tag/ids",
method: "GET"
})
.done(jd => { .done(jd => {
// NICHT SO wg. Vue: _messagelist = jd; // NICHT SO wg. Vue: _messagelist = jd;
_taglist.splice(0, _taglist.length); _taglist.splice(0, _taglist.length);
get_insert_tag(jd[e]); get_insert_tag(jd[e]);
} }
} }
}).fail(function (e, f, g) {
}).fail(function(e, f, g) {
console.log("err: " + e + f + g); console.log("err: " + e + f + g);
});
});
}, },


clear: function() {
console.log("clear");
clear: function() {
console.log("clear");


this.isSearchActiv = false;
this.searchtext = "";
this.list_messages();
},
isSearchActiv = false;
this.searchtext = "";
this.list_messages();
},


},
mounted: function () {
},
mounted: function() {
//this.search(); //this.search();
this.list_tags();
this.list_tags();
}, },
}); });
function get_insert_tag(id){
$.ajax({ url: "api/tag/"+id, method: "GET" }).done(function (tag) {
dat.push("#"+tag.name);
console.log("it worked!");
}).fail(function (e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
}



function get_insert_tag(id) {
$.ajax({
url: "api/tag/" + id,
method: "GET"
}).done(function(tag) {
dat.push("#" + tag.name);
console.log("it worked!");
}).fail(function(e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
}

function searching(searchtext) {
isSearchActiv = true;
console.log("Searchtext: " + searchtext.replace(/#/g, ''));
$.ajax({
url: "api/msg/search/" + searchtext.replace(/#/g, ''),
method: "GET"
}).done(jd => {
// NICHT SO wg. Vue: _messagelist = jd;
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, jd);
//console.log("jd: "+jd);
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
}).fail(function(e, f, g) {
console.log("searching: err: " + e + f + g);
})
}
function messages() {
$.ajax({
url: "api/msg/ids",
method: "GET"
})
.done(jd => {
// NICHT SO wg. Vue: _messagelist = jd;
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, jd);
//console.log("jd: "+jd);
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
}).fail(function(e, f, g) {
console.log("list_msg: err: " + e + f + g);
});
}


const search_data = []; const search_data = [];
/*
export.default {
data: function () {
return {
selected: [],
taglist: data,
/*
export.default {
data: function () {
return {
selected: [],
taglist: data,
};
},
computed: {
filteredTagArray() {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(this.name.toLowerCase()) >= 0
})
},

},
methods: {
evaluate(text) {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
},
},
mounted: function () {
if ($(this).bootstrapMaterialDesign)
$(this).bootstrapMaterialDesign();
},
}; };
},
computed: {
filteredTagArray() {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(this.name.toLowerCase()) >= 0
})
},

},
methods: {
evaluate(text) {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
},
},
mounted: function () {
if ($(this).bootstrapMaterialDesign)
$(this).bootstrapMaterialDesign();
},
};
*/
*/


</script> </script>


<!-- CDN_Vue.js minified lib -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script> -->
<!-- CDN_jQuery minified lib -->
<!--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>-->
<!-- Load Popper.js -->
<script src="lib/popper-1.12.6.js"></script>
<!-- Load Bootstrap.js -->
<script src="lib/bootstrap-material-design.js"></script>
<!-- NOTE: Call main.js -->
<script src="main.js"></script>
<!-- CDN_Vue.js minified lib -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script> -->
<!-- CDN_jQuery minified lib -->
<!--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>-->
<!-- Load Popper.js -->
<script src="lib/popper-1.12.6.js"></script>
<!-- Load Bootstrap.js -->
<script src="lib/bootstrap-material-design.js"></script>
<!-- NOTE: Call main.js -->
<script src="main.js"></script>


</body> </body>



+ 75
- 67
public/routes/files.js View File

var tagArray = []; var tagArray = [];
const data=[];


const FileRouter = { const FileRouter = {
template: ` template: `
<b-input id="freeSe"></b-input> <b-input id="freeSe"></b-input>
</b-field> </b-field>


<b-field v-if="selectedOptions=='tags'"">
<b-taginput
id="tag"
v-model="selected"
:data=taglist
autocomplete
allow-new:false
icon="label"
placeholder="#"
@typing="getFilteredTags"
@input="saveTagsToArray">
</b-taginput>
<b-field v-if="selectedOptions=='tags'">
<b-autocomplete rounded v-model="searchtext"
:data="filteredDataArray"
placeholder="suche..." icon="magnify"
@select="option => selected = option">
</b-autocomplete>
</b-field> </b-field>


<b-button type="is-primary" @click="">SUCHE</b-button>
<b-button type="is-primary" @click="search">SUCHE</b-button>


<div id="om-msg-cards">
<MsgCard
v-for="id in messagelist.slice().reverse()"
:key="id"
:msg="messages[id] || {}"
></MsgCard>
</div>
</div> </div>
`, `,
data: function () { data: function () {
return {
return {
searchtext: "",
selectedOptions: [], selectedOptions: [],
selected: [],
taglist: data,
selected: [],
taglist: data,
messagelist: _messagelist,
messages: _messages,
}
},
computed: {
filteredDataArray() {
return this.taglist.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(this.searchtext.toLowerCase()) >= 0
})
} }
}, },
methods: { methods: {
saveTagsToArray: function() {
tagArray = this.selected;
list_messages: function () {
messages();
},
saveTagsToArray: function () {
tagArray = this.selected;
console.info(tagArray); console.info(tagArray);
}, },
createMsg: function () {
var _subject = $("#subject").val();
var _message = $("#message").val();
var _tag = tagArray;
var _user = $("#user").val();
//console.log("Message Created: " + _tag + " " + _message + " " + _user);
$.ajax({
url: "api/msg",
data: {
subject: _subject,
message: _message,
user: _user,
tag: _tag
},
method: "POST"
}).done(have_result).fail(have_error);

function have_result(res) {
//console.log(res);
router.push('/home')
}

function have_error(err) {
console.log("error: " + err.responseText);
console.log(err);
}
},
getFilteredTags(text) {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
getFilteredTags(text) {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
this.search();
}, },
list_tags: function () { 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]);
}
$.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);
});
}
}
}).fail(function (e, f, g) {
console.log("err: " + e + f + g);
});
},
saveTagsToArray: function () {
tagArray = this.selected;
console.info(tagArray);
},
search: function () {
searching(this.searchtext);
},
list_messages: function () {
messages();
},
},
mounted: function () {
//this.search();
this.list_tags();
//this.list_messages();
}, },
}; };

+ 7
- 4
public/routes/home.js View File

tags: "foo" tags: "foo"
}); });
},*/ },*/
list_messages: function () {
list_messages: function() {
messages();
}
/*list_messages: function () {
$.ajax({url: "api/msg/ids", method: "GET"}) $.ajax({url: "api/msg/ids", method: "GET"})
.done(jd => { .done(jd => {
// NICHT SO wg. Vue: _messagelist = jd; // NICHT SO wg. Vue: _messagelist = jd;
get_insert_message(jd[e]); get_insert_message(jd[e]);
} }
} }
/*if(!($".om-searchbar" = "")){
if(!($".om-searchbar" = "")){
for (var e in jd) { for (var e in jd) {
if (!_messages[jd[e]]) { if (!_messages[jd[e]]) {
get_insert_message(jd[e]); get_insert_message(jd[e]);
get_search_message(jd[e]); get_search_message(jd[e]);
} }
} }
}*/
}
}).fail(function (e, f, g) { }).fail(function (e, f, g) {
console.log("list_msg: err: " + e + f + g); console.log("list_msg: err: " + e + f + g);
}); });
}
}*/
}, },


mounted: function () { mounted: function () {

+ 6
- 2
public/routes/msgCard.js View File

<img src="favicon.ico" width=20px height=20px> <img src="favicon.ico" width=20px height=20px>
</h6> </h6>
{{ msg.message }}<br><br> {{ msg.message }}<br><br>
<!--<a v-for="tag in msg.tag" href="#">#{{ tag }} </a>-->
<b-button class="tags" type="is-text" v-for="tag in msg.tag>#{{ tag }} </b-button>
<a v-for="tag in msg.tag" @click="filterForTag(tag)">#{{ tag }} </a>
<!--<b-button class="tags" type="is-text" v-for="tag in msg.tag">#{{ tag }} </b-button>-->
</p> </p>
<div class="om-card-footer"> <div class="om-user-line"> <div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i> <i class="material-icons">account_circle</i>
myFilter: function() { myFilter: function() {
this.isActive = !this.isActive; this.isActive = !this.isActive;
}, },
filterForTag: function(tag) {
console.log("link: " +tag);
searching(tag);
},
} }
}); });

+ 3
- 1
server/dbs.js View File

* Get a particular message * Get a particular message
*/ */
get: function(req, res) { get: function(req, res) {
model.Messages.find({$text: {$search: req.params.phrase}})
model.Messages.find(
{$text: {$search: req.params.phrase}})
.sort({tag:1, user:1, message:1, subject:1})
.exec().then(results => { .exec().then(results => {
//selects id from message: //selects id from message:
var parsed = []; var parsed = [];

Loading…
Cancel
Save