Merge remote-tracking branch 'origin/developer' into developer

# Conflicts:
#	public/routes/home.js
#	public/style/style.css
#	public/style/style.less
This commit is contained in:
2019-07-23 17:38:11 +02:00
13 changed files with 157 additions and 79 deletions
+3 -5
View File
@@ -122,6 +122,8 @@ Vue.component('login-panel', {
function successful_login(resData) {
fillAuthState(resData);
// updateUserInDB();
auth.abos = [];
auth.bookmarks = [];
console.info("Correct credentials");
this.closeLoginPanel;
@@ -150,6 +152,7 @@ Vue.component('login-panel', {
function successful_login(res) {
console.info("Re-Auth: Correct credentials");
this.closeLoginPanel;
vueForceRender();
//console.log(res);
router.push('/home')
@@ -163,10 +166,5 @@ Vue.component('login-panel', {
console.log(err);
}
},
logout: function() {
clearAuthState();
$.ajax({ url: "api/logout", method: "POST" });
this.closeLoginPanel;
},
},
});
+16 -2
View File
@@ -36,7 +36,21 @@ const BookmarkRouter = {
},
getMessages: function(){
var _usrid = "5d360f06b8f3ce67d12ccc92";
var arr = auth.bookmarks;
console.log("arr: "+arr+" auth.bookmarks: "+auth.bookmarks);
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, arr);
for (var e in arr) {
if (!_messages[arr[e]]) {
//arr[e] =arr[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
console.log("getinsertmessage: "+ arr[e]);
get_insert_message(arr[e]);
}
}
/*var _usrid = auth.user;
$.ajax({
url: "api/usr/id/" + _usrid,
method: "GET"
@@ -59,7 +73,7 @@ const BookmarkRouter = {
function have_error(err) {
console.log("error: " + err.responseText);
console.log(err);
}
}*/
}
},
mounted: function (){
+4 -1
View File
@@ -8,6 +8,7 @@ const HomeRouter = {
v-for="id in messagelist.slice().reverse()"
:key="id"
:msg="messages[id] || {}"
:isBookmark="bookmarkArray[id]"
></MsgCard>
</div>
</div>`,
@@ -16,7 +17,8 @@ const HomeRouter = {
messagelist: _messagelist,
messages: _messages,
isSearchActiv: _isSearchActiv,
isSubscripeButtonActiv: _isSubscripeButtonActiv
isSubscripeButtonActiv: _isSubscripeButtonActiv,
bookmarkArray: auth.bookmarks,
};
},
methods: {
@@ -48,6 +50,7 @@ const HomeRouter = {
}
}
},
mounted: function () {
this.list_messages();
+12 -1
View File
@@ -16,6 +16,17 @@ var auth = {},
_isSearchActiv = false,
_isSubscripeButtonActiv = true,
data = [],
search_data = []
search_data = [],
// Vue Rerender Key
vueRender = { key:0 };
const authorRole = 'author';
// Global Functions
function vueForceRender() {
if (vueRender.key >= 10) {
vueRender.key = 0;
}
vueRender.key++;
}
+53 -24
View File
@@ -1,36 +1,51 @@
Vue.component('MsgCard', {
template: `<div class="om-card card">
<h6 class="msg-head">
template: `
<div class="om-card card">
<h6 class="msg-head">
<b>{{ msg.subject }}</b>
<div id="msgid">{{msg._id}}</div>
<div id="msgid" >{{msg._id}}</div>
<img src="favicon.ico" width=20px height=20px>
</h6>
{{ msg.message }}<br>
<a v-for="tag in msg.tag" @click="filterForTag(tag)">#{{ tag }} </a>
<br>
</p>
<div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i>
Erstellt von {{ msg.user }}</div>
<i class="material-icons" @click="myFilter(msg._id)" v-if="!isActive">bookmark_border</i>
<i class="material-icons" @click="myFilter(msg._id)" v-else="isActive">bookmark</i>
</div></div>`,
props: ['msg'],
</h6>
{{ msg.message }}<br>
<a v-for="tag in msg.tag" @click="filterForTag(tag)">#{{ tag }} </a>
<br>
<div class="om-card-footer">
<div class="om-user-line">
<i class="material-icons">account_circle</i>
Erstellt von {{ msg.user }}
</div>
<i id="bockmark-not-active" class="material-icons" :key="isActive" @click="myFilter(msg._id)" v-if="!isActive">bookmark_border</i>
<i id="bockmark-active" class="material-icons" :key="isActive" @click="myFilter(msg._id)" v-else>bookmark</i>
</div>
</div>`,
props: ['msg', 'isBookmark'],
data: function () {
return {
isActive: false,
isActive: this.isBookmark,
isActive_: 0,
msgid: this.msg._id,
bookmarkArray: auth.bookmarks,
};
},
methods: {
myFilter: function(_messageid) {
myFilter: function (_messageid) {
//var _messageid = $("#msgid").text();
if (this.isActive == true) {
var index = this.bookmarkArray.indexOf(_messageid);
var _bookmark = auth.bookmarks;
_bookmark.push(_messageid);
console.log("msgid"+_bookmark);
var _userid = "5d360f06b8f3ce67d12ccc92";
if (index > -1) {
this.bookmarkArray.splice(index, 1);
}
this.isActive = false;
} else {
console.log("_messsageid: "+_messageid+" bookmarks: "+this.bookmarkArray);
this.bookmarkArray.push(_messageid);
this.isActive =true;
}
/*console.log("msgid"+_bookmark);
var _userid = auth.user;
this.isActive = !this.isActive;
if(this.isActive){
$.ajax({
@@ -50,11 +65,25 @@ Vue.component('MsgCard', {
console.log("error: " + err.responseText);
console.log(err);
}
}
}*/
},
filterForTag: function(tag) {
console.log("link: " +tag);
filterForTag: function (tag) {
console.log("link: " + tag);
searching(tag);
},
isBookmarkActive: function (msgid) {
//console.log("isBookmarkActive(): " + msgid);
if (this.bookmarkArray.indexOf(msgid) > -1) {
// $("#bockmark-not-active").css("visibility","hidden");
// $("#bockmark-active").css("visibility","visible");
this.isActive = true;
//console.log("isBookmarkActive(): " + this.isActive);
this.isActive_ = 1;
}
}
},
beforeMount: function () {
//this.isBookmarkActive();
}
});
+16 -2
View File
@@ -11,7 +11,7 @@ Vue.component('nav-router', {
<i class="material-icons">search</i>
</router-link>
<router-link to="/createMessage" class="navbar-item is-primary is-expanded is-hidden-desktop">
<router-link v-if="isAuthor" to="/createMessage" class="navbar-item is-primary is-expanded is-hidden-desktop">
<i class="material-icons">add_circle</i>
</router-link>
@@ -37,7 +37,7 @@ Vue.component('nav-router', {
<i class="material-icons">search</i> Search
</router-link></li>
<li><router-link to="/createMessage">
<li><router-link v-if="isAuthor" to="/createMessage">
<i class="material-icons">add_circle</i> Create Message
</router-link></li>
@@ -53,6 +53,20 @@ Vue.component('nav-router', {
</div>
</div>
</div>`,
data: function() {
return {
isAuthor: this.isAuthorCheck(),
};
},
methods: {
isAuthorCheck: function() {
console.info(auth.roles.author === authorRole);
return (auth.roles.author === authorRole);
},
},
updated: function() {
this.isAuthorChecked();
}
});
const routes = [
+15 -15
View File
@@ -2,22 +2,22 @@ const ProfilRouter = {
template: `
<div>
<div class="column pull-right-sm is-four-fifths-desktop">
<div v-if="isAuth">
<profil-card></profil-card>
</div>
<div v-else>
<button class="button is-primary is-medium"
@click="isLPVisible = true">
Login
</button>
<div v-if="isAuth">
<profil-card></profil-card>
</div>
<div v-else>
<button class="button is-primary is-medium"
@click="isLPVisible = true">
Login
</button>
<b-modal :active.sync="isLPVisible"
@close-login-panel="closeLoginPanel"
@show-login-panel="showLoginPanel"
has-modal-card>
<login-panel></login-panel>
</b-modal>
</div>
<b-modal :active.sync="isLPVisible"
@close-login-panel="closeLoginPanel"
@show-login-panel="showLoginPanel"
has-modal-card>
<login-panel></login-panel>
</b-modal>
</div>
</div>
</div>`,
data: function () {
+6 -5
View File
@@ -18,15 +18,15 @@ Vue.component('profil-card', {
<hr class="first">
<div class="btnprofil">
<button @click="isCardModalActive = true"><b>Abonniert: <br/>{{ abo }}</b> <br/></button>
<button @click="$router.push('/bookmark')"><b>Gespeichert:<br/> {{ saved }}</b><br/></button>
<button @click="isCardModalActive = true"><b>Abonniert: <br/>{{ abos }}</b> <br/></button>
<button @click="$router.push('/bookmark')"><b>Gespeichert:<br/> {{ bookmarks }}</b><br/></button>
</div>
<section>
<b-modal :active.sync="isCardModalActive" :width="600" scroll="keep">
<div class="card">
<header class="modal-card-head">
<p class="modal-card-title">Abonnierte Kanäle</p>
<p class="modal-card-title">Abonnierte Tags</p>
</header>
<div class="card-content">
<div class="content">
@@ -51,8 +51,8 @@ Vue.component('profil-card', {
data: function () {
return {
auth: auth,
abo: 7,
saved: 3,
abos: auth.abos ? auth.abos.length : '-',
bookmarks: auth.bookmarks ? auth.bookmarks.length : '-',
isCardModalActive: false,
};
},
@@ -75,6 +75,7 @@ Vue.component('profil-card', {
logout: function() {
clearAuthState();
$.ajax({ url: "api/logout", method: "POST" });
vueForceRender();
router.push('/profil');
},
}