Global refactor
This commit is contained in:
parent
577f041928
commit
6a69bbcaf7
@ -1,8 +1,8 @@
|
|||||||
db.users.insert([
|
db.users.insert([
|
||||||
// author,OHMNEWS2019
|
// User: author, Pwd: author
|
||||||
{"_id":"author","name":"Test Author","type":"author","roles":{"user":true,"author":true},"hash":"sha256","salt":"cy5CkPrplcEze6o4psURhw==","pwd":"Gc8ozlxjEGITkS+fW9tz2xLROzws44s04EOCWuP04qE=","abos":["wichtig","th"],"bookmarks":["th"],},
|
{"_id":"author","name":"Author","type":"MA@EFI;","roles":'{"user":true,"author":true}',"hash":"sha256","salt":"SIzKNsNKsCRVr8a9U90q6A==","pwd":"HZly68TSAKHioz6Kz0QCbXVTHpT6hMmabUbFYVlCMeE=","abos":["nulla","tempor","veniam","ipsum"],"bookmarks":[],},
|
||||||
// admin,oZuse1
|
// User: admin, Pwd: SwenMho
|
||||||
{"_id":"admin","name":"Test Admin","type":"admin","roles":{"user":true,"author":true,"admin":true},"hash":"sha256","salt":"PoIUHbDp7tP34ji31iQ0zw==","pwd":"mJpIfIksYs6LJJwYRBemFKqR6TacsSl2E0ZtpO1GMuk=","abos":["wichtig","th"],"bookmarks":["wichtig"],},
|
{"_id":"admin","name":"Test Admin","type":"MA@AMP;","roles":'{"user":true,"author":true,"admin":true}',"hash":"sha256","salt":"z3PNXGmQaWvaT7m2ZlT+0w==","pwd":"nfUfNv032J745xj3Hzya3Mkk43Dz/H0BmNTZhtx8UM0=","abos":["veniam","ipsum"],"bookmarks":[],},
|
||||||
])
|
])
|
||||||
|
|
||||||
//var c = require('./server/crypto.js'),
|
//var c = require('./server/crypto.js'),
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
<script src="routes/bookmark.js"></script>
|
<script src="routes/bookmark.js"></script>
|
||||||
<script src="routes/profil.js"></script>
|
<script src="routes/profil.js"></script>
|
||||||
<script src="routes/msgCard.js"></script>
|
<script src="routes/msgCard.js"></script>
|
||||||
<script src="routes/majorData.js"></script>
|
|
||||||
<script src="routes/profilCard.js"></script>
|
<script src="routes/profilCard.js"></script>
|
||||||
<script src="routes/navRoutes.js"></script>
|
<script src="routes/navRoutes.js"></script>
|
||||||
<script src="search.js"></script>
|
<script src="search.js"></script>
|
||||||
@ -88,13 +87,13 @@
|
|||||||
<div class="om-header">
|
<div class="om-header">
|
||||||
<a class="logo-img is-hidden-desktop" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a>
|
<a class="logo-img is-hidden-desktop" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a>
|
||||||
<a class="logo-img is-hidden-touch" href="index.html"><img src="img/app_icon_desk.png" width=100px height=100px></a>
|
<a class="logo-img is-hidden-touch" href="index.html"><img src="img/app_icon_desk.png" width=100px height=100px></a>
|
||||||
<search></search>
|
<search :key="vueRender.search"></search>
|
||||||
</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 :key="auth.user"></nav-router>
|
||||||
<router-view :key="vueRender.key"></router-view>
|
<router-view :key="vueRender.key"></router-view>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -104,8 +103,8 @@
|
|||||||
router,
|
router,
|
||||||
el: '#api',
|
el: '#api',
|
||||||
data: {
|
data: {
|
||||||
// Locally registered variables
|
|
||||||
vueRender : vueRender,
|
vueRender : vueRender,
|
||||||
|
auth: auth,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -152,7 +152,7 @@ Vue.component('login-panel', {
|
|||||||
function successful_login(res) {
|
function successful_login(res) {
|
||||||
console.info("Re-Auth: Correct credentials");
|
console.info("Re-Auth: Correct credentials");
|
||||||
this.closeLoginPanel;
|
this.closeLoginPanel;
|
||||||
vueForceRender();
|
vueForceRender('key');
|
||||||
|
|
||||||
//console.log(res);
|
//console.log(res);
|
||||||
router.push('/home')
|
router.push('/home')
|
||||||
|
@ -4,10 +4,11 @@ const CreateMsgRouter = {
|
|||||||
<div class="column pull-right-sm is-four-fifths-desktop">
|
<div class="column pull-right-sm is-four-fifths-desktop">
|
||||||
<div id="mobile" class="om-card card">
|
<div id="mobile" class="om-card card">
|
||||||
<h4>Neue Nachricht erstellen</h4>
|
<h4>Neue Nachricht erstellen</h4>
|
||||||
<b-field>
|
<!--<b-field>
|
||||||
<b-input placeholder="User" id="user"></b-input>
|
<b-input placeholder="User" id="user"></b-input>
|
||||||
</b-field>
|
</b-field>-->
|
||||||
|
|
||||||
|
<label class="label">{{ userName }}</label>
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-input placeholder="Betreff" id="subject"></b-input>
|
<b-input placeholder="Betreff" id="subject"></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
@ -38,6 +39,7 @@ const CreateMsgRouter = {
|
|||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
auth: auth,
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
searchtext : "",
|
searchtext : "",
|
||||||
@ -45,13 +47,16 @@ const CreateMsgRouter = {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
filteredDataArray() {
|
filteredDataArray: function() {
|
||||||
return this.taglist.filter((option) => {
|
return this.taglist.filter((option) => {
|
||||||
return option
|
return option
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.indexOf(this.searchtext.toLowerCase()) >= 0
|
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
userName: function() {
|
||||||
|
return 'User: '+auth.name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -62,8 +67,19 @@ const CreateMsgRouter = {
|
|||||||
createMsg: function () {
|
createMsg: function () {
|
||||||
var _subject = $("#subject").val();
|
var _subject = $("#subject").val();
|
||||||
var _message = $("#message").val();
|
var _message = $("#message").val();
|
||||||
|
var tmpArr = [];
|
||||||
|
tagArray.forEach(function(tag) {
|
||||||
|
console.info(tag);
|
||||||
|
tmpArr.push(tag.replace(/#/g, ''));
|
||||||
|
});
|
||||||
|
tagArray = tmpArr;
|
||||||
var _tag = tagArray;
|
var _tag = tagArray;
|
||||||
var _user = auth.name != '' ? auth.name : $("#user").val();
|
var _user = auth.name.split(' ');
|
||||||
|
if (_user.length < 2) {
|
||||||
|
_user = _user[0];
|
||||||
|
} else {
|
||||||
|
_user = _user[1] + ', ' + _user[0];
|
||||||
|
}
|
||||||
//console.log("Message Created: " + _tag + " " + _message + " " + _user);
|
//console.log("Message Created: " + _tag + " " + _message + " " + _user);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "api/msg",
|
url: "api/msg",
|
||||||
@ -112,21 +128,9 @@ const CreateMsgRouter = {
|
|||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("err: " + e + f + g);
|
console.log("err: " + e + f + g);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
var userField = $('#user');
|
|
||||||
if (auth != null && auth.mail != '') {
|
|
||||||
// userField.prop('placeholder',auth.name);
|
|
||||||
var authorName = auth.name.split(' ');
|
|
||||||
authorName = authorName[1] + ', ' + authorName[0];
|
|
||||||
userField.val(authorName);
|
|
||||||
userField.prop('disabled',true);
|
|
||||||
} else {
|
|
||||||
userField.prop('placeholder','User');
|
|
||||||
userField.prop('disabled',false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//this.list_tags();
|
//this.list_tags();
|
||||||
if ($(this).bootstrapMaterialDesign)
|
if ($(this).bootstrapMaterialDesign)
|
||||||
$(this).bootstrapMaterialDesign();
|
$(this).bootstrapMaterialDesign();
|
||||||
|
@ -1,16 +1,26 @@
|
|||||||
const HomeRouter = {
|
const HomeRouter = {
|
||||||
template: `
|
template: `
|
||||||
<div>
|
<div>
|
||||||
<div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
|
<div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
|
||||||
<a id="escape-search-link" @click="goBackToDashboard">< zurück zu allen Einträgen</a>
|
<b-button id="escape-search-link"
|
||||||
<b-button id="subscribe-btn" type="is-primary" @click="changeSubscribtion"><div id="btn-text"></div></b-button><br><br>
|
v-if="_isSearchActiv"
|
||||||
|
@click="goBackToDashboard"
|
||||||
|
icon-left="arrow-left"
|
||||||
|
type="is-primary"
|
||||||
|
@toggle-escape-search-link="toggleEscapeSearchLink"
|
||||||
|
outlined>
|
||||||
|
zurück zu allen Einträgen
|
||||||
|
</b-button>
|
||||||
|
<!--<b-button id="subscribe-btn" type="is-primary" v-if="_isSubscripeButtonActiv" @update-home-abo-button="updateHomeAboButton" @click="changeSubscribtion">
|
||||||
|
{{ subscripeTagName }}
|
||||||
|
</b-button>--><br><br>
|
||||||
<MsgCard
|
<MsgCard
|
||||||
v-for="id in messagelist.slice().reverse()"
|
v-for="id in messagelist.slice().reverse()"
|
||||||
:key="id"
|
:key="id"
|
||||||
:msg="messages[id] || {}"
|
:msg="messages[id] || {}"
|
||||||
:isBookmark="bookmarkArray[id]"
|
:isBookmark="bookmarkArray[id]">
|
||||||
></MsgCard>
|
</MsgCard>
|
||||||
</div>
|
</div>
|
||||||
</div>`,
|
</div>`,
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
@ -18,34 +28,51 @@ const HomeRouter = {
|
|||||||
messages: _messages,
|
messages: _messages,
|
||||||
isSearchActiv: _isSearchActiv,
|
isSearchActiv: _isSearchActiv,
|
||||||
isSubscripeButtonActiv: _isSubscripeButtonActiv,
|
isSubscripeButtonActiv: _isSubscripeButtonActiv,
|
||||||
|
isSubscriped: false,
|
||||||
|
subscripeTagName: '',
|
||||||
bookmarkArray: auth.bookmarks,
|
bookmarkArray: auth.bookmarks,
|
||||||
|
vueRender: vueRender,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
updateHomeAboButton: function(content) {
|
||||||
|
this.subscripeTagName = content;
|
||||||
|
console.info( this.subscripeTagName);
|
||||||
|
vueForceRender('key');
|
||||||
|
},
|
||||||
|
toggleEscapeSearchLink: function() {
|
||||||
|
console.info('got called');
|
||||||
|
this.isSearchActive = !this.isSearchActive;
|
||||||
|
vueForceRender('key');
|
||||||
|
console.info( this.isSearchActive);
|
||||||
|
},
|
||||||
list_messages: function() {
|
list_messages: function() {
|
||||||
messages();
|
messages();
|
||||||
},
|
},
|
||||||
goBackToDashboard: function() {
|
goBackToDashboard: function() {
|
||||||
vueForceRender();
|
_isSearchActiv = false;
|
||||||
$("#escape-search-link").css("visibility", "hidden");
|
this.$emit('reset-searchtext','');
|
||||||
$("#subscribe-btn").css("visibility", "hidden");
|
// $("#escape-search-link").css("visibility", "hidden");
|
||||||
|
// $("#subscribe-btn").css("visibility", "hidden");
|
||||||
|
_isSubscripeButtonActiv = false;
|
||||||
|
vueForceRender('key');
|
||||||
|
vueForceRender('search');
|
||||||
},
|
},
|
||||||
changeSubscribtion: function(){
|
changeSubscribtion: function(){
|
||||||
var btnString = $("#btn-text").text();
|
var btnString = $("#btn-text").text();
|
||||||
console.log(btnString);
|
console.log(btnString);
|
||||||
|
|
||||||
if($("#btn-text").hasClass("subscribed")){
|
if(this.isSubscriped){
|
||||||
$("#btn-text").removeClass("subscribed");
|
this.subscripeTagName.replace(/deabonnieren/g, '') + "abonnieren";
|
||||||
var newBtnString = btnString.replace(/deabonnieren/g, '') + "abonnieren";
|
|
||||||
//console.log(btnString);
|
//console.log(btnString);
|
||||||
$("#btn-text").text(newBtnString);
|
// $("#btn-text").text(newBtnString);
|
||||||
}else{
|
}else{
|
||||||
$("#btn-text").addClass("subscribed");
|
this.subscripeTagName.replace(/abonnieren/g, '') + "deabonnieren";
|
||||||
var newBtnString = btnString.replace(/abonnieren/g, '') + "deabonnieren";
|
|
||||||
//console.log(newBtnString);
|
//console.log(newBtnString);
|
||||||
$("#btn-text").text(newBtnString);
|
// $("#btn-text").text(newBtnString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.isSubscriped = !this.isSubscriped;
|
||||||
|
vueForceRender('key');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Global Variables
|
// Global Variables
|
||||||
// User
|
// User
|
||||||
var auth = {},
|
var auth = {},
|
||||||
majorList = [],
|
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
_messagelist = [],
|
_messagelist = [],
|
||||||
@ -14,19 +13,82 @@ var auth = {},
|
|||||||
|
|
||||||
// Search
|
// Search
|
||||||
_isSearchActiv = false,
|
_isSearchActiv = false,
|
||||||
_isSubscripeButtonActiv = true,
|
_isSubscripeButtonActiv = false,
|
||||||
data = [],
|
data = [],
|
||||||
search_data = [],
|
search_data = [],
|
||||||
|
|
||||||
// Vue Rerender Key
|
// Vue Rerender Key
|
||||||
vueRender = { key:0 };
|
vueRender = {
|
||||||
|
key: 0,
|
||||||
|
search: 0,
|
||||||
|
};
|
||||||
|
|
||||||
const authorRole = 'author';
|
const authorRole = 'author',
|
||||||
|
majorList = [
|
||||||
|
{id:'B-AC',name:'Bachelor Angewandte Chemie'},
|
||||||
|
{id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'},
|
||||||
|
{id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'},
|
||||||
|
{id:'B-AR',name:'Bachelor Architektur'},
|
||||||
|
{id:'B-BI',name:'Bachelor Bauingenieurwesen'},
|
||||||
|
{id:'B-BW',name:'Bachelor Betriebswirtschaft'},
|
||||||
|
{id:'B-BIO',name:'Bachelor Management in der Biobranche'},
|
||||||
|
{id:'B-IB',name:'Bachelor International Business'},
|
||||||
|
{id:'B-IBT',name:'Bachelor International Business and Technology'},
|
||||||
|
{id:'B-DE',name:'Bachelor Design'},
|
||||||
|
{id:'B-EI',name:'Bachelor Elektrotechnik und Informationstechnik'},
|
||||||
|
{id:'B-MED',name:'Bachelor Medizintechnik'},
|
||||||
|
{id:'B-MF',name:'Bachelor Mechatronik/Feinwerktechnik'},
|
||||||
|
{id:'B-ME',name:'Bachelor Media Engineering'},
|
||||||
|
{id:'B-IN',name:'Bachelor Informatik'},
|
||||||
|
{id:'B-MIN',name:'Bachelor Medieninformatik'},
|
||||||
|
{id:'B-WIN',name:'Bachelor Wirtschaftsinformatik'},
|
||||||
|
{id:'B-MB',name:'Bachelor Maschinenbau'},
|
||||||
|
{id:'B-EGT',name:'Bachelor Energie- und Gebäudetechnik'},
|
||||||
|
{id:'B-EBL',name:'Bachelor Soziale Arbeit: Erziehung und Bildung im Lebenslauf'},
|
||||||
|
{id:'B-SA',name:'Bachelor Soziale Arbeit'},
|
||||||
|
{id:'B-EPT',name:'Bachelor Energieprozesstechnik'},
|
||||||
|
{id:'B-VT',name:'Bachelor Verfahrenstechnik'},
|
||||||
|
{id:'B-WT',name:'Bachelor Werkstofftechnik'},
|
||||||
|
{id:'M-AMP',name:'Master Angewandte Mathematik und Physik'},
|
||||||
|
{id:'M-AR',name:'Master Architektur'},
|
||||||
|
{id:'M-BI',name:'Master Internationales Bauwesen'},
|
||||||
|
{id:'M-URB',name:'Master Urbane Mobilität (Verkehrsingenieurwesen)'},
|
||||||
|
{id:'M-BW',name:'Master Betriebswirtschaft'},
|
||||||
|
{id:'M-TAX',name:'Master Steuerberatung'},
|
||||||
|
{id:'M-WR',name:'Master Wirtschaftsrecht'},
|
||||||
|
{id:'M-IFE',name:'Master International Finance and Economics'},
|
||||||
|
{id:'M-IMA',name:'Master International Marketing'},
|
||||||
|
{id:'M-APR',name:'Master Applied Research in Engineering Sciences'},
|
||||||
|
{id:'M-SY',name:'Master Elektronische und Mechatronische Systeme'},
|
||||||
|
{id:'M-IN',name:'Master Informatik'},
|
||||||
|
{id:'M-MIN',name:'Master Medieninformatik'},
|
||||||
|
{id:'M-WIN',name:'Master Wirtschaftsinformatik'},
|
||||||
|
{id:'M-MB',name:'Master Maschinenbau'},
|
||||||
|
{id:'M-EE',name:'Master Energiemanagement und Energietechnik'},
|
||||||
|
{id:'M-GT',name:'Master Gebäudetechnik'},
|
||||||
|
{id:'M-SA',name:'Master Soziale Arbeit'},
|
||||||
|
{id:'M-VT',name:'Master Chemieingenieurwesen und Verfahrenstechnik'},
|
||||||
|
{id:'M-WT',name:'Master Werkstofftechnik'},
|
||||||
|
],
|
||||||
|
facultyList = [
|
||||||
|
{id:'AC',name:'Angewandte Chemie'},
|
||||||
|
{id:'AMP',name:'Angewandte Mathematik, Physik und Allgemeinwissenschaften'},
|
||||||
|
{id:'AR',name:'Architektur'},
|
||||||
|
{id:'BI',name:'Bauingeneurwesen'},
|
||||||
|
{id:'BW',name:'Betriebswirtschaft'},
|
||||||
|
{id:'D',name:'Design'},
|
||||||
|
{id:'EFI',name:'Elektrotechnik Feinwerktechnik Informationstechnik'},
|
||||||
|
{id:'IN',name:'Informatik'},
|
||||||
|
{id:'MB-VS',name:'Maschinenbau und Versorgungstechnik'},
|
||||||
|
{id:'SW',name:'Sozialwissenschaften'},
|
||||||
|
{id:'VT',name:'Verfahrenstechnik'},
|
||||||
|
{id:'WT',name:'Werkstofftechnik'},
|
||||||
|
];
|
||||||
|
|
||||||
// Global Functions
|
// Global Functions
|
||||||
function vueForceRender() {
|
function vueForceRender(keyName) {
|
||||||
if (vueRender.key >= 10) {
|
if (vueRender[keyName] >= 10) {
|
||||||
vueRender.key = 0;
|
vueRender[keyName] = 0;
|
||||||
}
|
}
|
||||||
vueRender.key++;
|
vueRender[keyName]++;
|
||||||
}
|
}
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
majorList = [
|
|
||||||
{id:'B-AC',name:'Bachelor Angewandte Chemie'},
|
|
||||||
{id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'},
|
|
||||||
{id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'},
|
|
||||||
{id:'B-AR',name:'Bachelor Architektur'},
|
|
||||||
{id:'B-BI',name:'Bachelor Bauingenieurwesen'},
|
|
||||||
{id:'B-BW',name:'Bachelor Betriebswirtschaft'},
|
|
||||||
{id:'B-BIO',name:'Bachelor Management in der Biobranche'},
|
|
||||||
{id:'B-IB',name:'Bachelor International Business'},
|
|
||||||
{id:'B-IBT',name:'Bachelor International Business and Technology'},
|
|
||||||
{id:'B-DE',name:'Bachelor Design'},
|
|
||||||
{id:'B-EI',name:'Bachelor Elektrotechnik und Informationstechnik'},
|
|
||||||
{id:'B-MED',name:'Bachelor Medizintechnik'},
|
|
||||||
{id:'B-MF',name:'Bachelor Mechatronik/Feinwerktechnik'},
|
|
||||||
{id:'B-ME',name:'Bachelor Media Engineering'},
|
|
||||||
{id:'B-IN',name:'Bachelor Informatik'},
|
|
||||||
{id:'B-MIN',name:'Bachelor Medieninformatik'},
|
|
||||||
{id:'B-WIN',name:'Bachelor Wirtschaftsinformatik'},
|
|
||||||
{id:'B-MB',name:'Bachelor Maschinenbau'},
|
|
||||||
{id:'B-EGT',name:'Bachelor Energie- und Gebäudetechnik'},
|
|
||||||
{id:'B-EBL',name:'Bachelor Soziale Arbeit: Erziehung und Bildung im Lebenslauf'},
|
|
||||||
{id:'B-SA',name:'Bachelor Soziale Arbeit'},
|
|
||||||
{id:'B-EPT',name:'Bachelor Energieprozesstechnik'},
|
|
||||||
{id:'B-VT',name:'Bachelor Verfahrenstechnik'},
|
|
||||||
{id:'B-WT',name:'Bachelor Werkstofftechnik'},
|
|
||||||
{id:'M-AMP',name:'Master Angewandte Mathematik und Physik'},
|
|
||||||
{id:'M-AR',name:'Master Architektur'},
|
|
||||||
{id:'M-BI',name:'Master Internationales Bauwesen'},
|
|
||||||
{id:'M-URB',name:'Master Urbane Mobilität (Verkehrsingenieurwesen)'},
|
|
||||||
{id:'M-BW',name:'Master Betriebswirtschaft'},
|
|
||||||
{id:'M-TAX',name:'Master Steuerberatung'},
|
|
||||||
{id:'M-WR',name:'Master Wirtschaftsrecht'},
|
|
||||||
{id:'M-IFE',name:'Master International Finance and Economics'},
|
|
||||||
{id:'M-IMA',name:'Master International Marketing'},
|
|
||||||
{id:'M-APR',name:'Master Applied Research in Engineering Sciences'},
|
|
||||||
{id:'M-SY',name:'Master Elektronische und Mechatronische Systeme'},
|
|
||||||
{id:'M-IN',name:'Master Informatik'},
|
|
||||||
{id:'M-MIN',name:'Master Medieninformatik'},
|
|
||||||
{id:'M-WIN',name:'Master Wirtschaftsinformatik'},
|
|
||||||
{id:'M-MB',name:'Master Maschinenbau'},
|
|
||||||
{id:'M-EE',name:'Master Energiemanagement und Energietechnik'},
|
|
||||||
{id:'M-GT',name:'Master Gebäudetechnik'},
|
|
||||||
{id:'M-SA',name:'Master Soziale Arbeit'},
|
|
||||||
{id:'M-VT',name:'Master Chemieingenieurwesen und Verfahrenstechnik'},
|
|
||||||
{id:'M-WT',name:'Master Werkstofftechnik'},
|
|
||||||
];
|
|
@ -11,7 +11,7 @@ Vue.component('nav-router', {
|
|||||||
<i class="material-icons">search</i>
|
<i class="material-icons">search</i>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
<router-link v-if="isAuthor" to="/createMessage" class="navbar-item is-primary is-expanded is-hidden-desktop">
|
<router-link v-if="auth.roles.author" to="/createMessage" class="navbar-item is-primary is-expanded is-hidden-desktop">
|
||||||
<i class="material-icons">add_circle</i>
|
<i class="material-icons">add_circle</i>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ Vue.component('nav-router', {
|
|||||||
<i class="material-icons">search</i> Search
|
<i class="material-icons">search</i> Search
|
||||||
</router-link></li>
|
</router-link></li>
|
||||||
|
|
||||||
<li><router-link v-if="isAuthor" to="/createMessage">
|
<li><router-link v-if="auth.roles.author" to="/createMessage">
|
||||||
<i class="material-icons">add_circle</i> Create Message
|
<i class="material-icons">add_circle</i> Create Message
|
||||||
</router-link></li>
|
</router-link></li>
|
||||||
|
|
||||||
@ -55,18 +55,9 @@ Vue.component('nav-router', {
|
|||||||
</div>`,
|
</div>`,
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
isAuthor: this.isAuthorCheck(),
|
auth: auth,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
isAuthorCheck: function() {
|
|
||||||
console.info(auth.roles.author === authorRole);
|
|
||||||
return (auth.roles.author === authorRole);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
updated: function() {
|
|
||||||
this.isAuthorChecked();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
|
@ -11,7 +11,9 @@ Vue.component('profil-card', {
|
|||||||
|
|
||||||
<div class="profil-text">
|
<div class="profil-text">
|
||||||
<span style="font-size:120%; display:inline-block; margin: 0.8rem 0 0 0;"><b>{{ auth.name }}</b></span><br><br>
|
<span style="font-size:120%; display:inline-block; margin: 0.8rem 0 0 0;"><b>{{ auth.name }}</b></span><br><br>
|
||||||
<span style="font-size:90%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ major }}</b></span>
|
<span style="font-size:100%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ labelMajorOrFaculty }}</b></span>
|
||||||
|
<br>
|
||||||
|
<span style="font-size:90%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ majorOrFaculty }}</b></span>
|
||||||
<br><br>
|
<br><br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -57,8 +59,20 @@ Vue.component('profil-card', {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
major: function() {
|
majorOrFaculty: function() {
|
||||||
// e.g. ST@B-ME;ST@EFI;
|
// e.g. ST@B-ME;ST@EFI;
|
||||||
|
if (auth.roles.author) {
|
||||||
|
var facultyID = auth.type.split(';');
|
||||||
|
console.info(facultyID[facultyID.length-2]);
|
||||||
|
facultyID = facultyID[facultyID.length-2].split('@')[1];
|
||||||
|
var facultyName = '';
|
||||||
|
facultyList.forEach(function(faculty) {
|
||||||
|
if (faculty.id == facultyID) {
|
||||||
|
facultyName = faculty.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return facultyName;
|
||||||
|
} else {
|
||||||
var majorID = auth.type.split(';')[0].split('@')[1];
|
var majorID = auth.type.split(';')[0].split('@')[1];
|
||||||
//console.info(majorID);
|
//console.info(majorID);
|
||||||
//console.info(majorList);
|
//console.info(majorList);
|
||||||
@ -69,13 +83,21 @@ Vue.component('profil-card', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return majorName;
|
return majorName;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
labelMajorOrFaculty: function() {
|
||||||
|
if (auth.roles.author) {
|
||||||
|
return 'Fakultät:'
|
||||||
|
} else {
|
||||||
|
return 'Studiengang:'
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
logout: function() {
|
logout: function() {
|
||||||
clearAuthState();
|
clearAuthState();
|
||||||
$.ajax({ url: "api/logout", method: "POST" });
|
$.ajax({ url: "api/logout", method: "POST" });
|
||||||
vueForceRender();
|
vueForceRender('key');
|
||||||
router.push('/profil');
|
router.push('/profil');
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -8,30 +8,34 @@ Vue.component('search',{
|
|||||||
:data="filteredDataArray"
|
:data="filteredDataArray"
|
||||||
placeholder="suche..."
|
placeholder="suche..."
|
||||||
icon="magnify"
|
icon="magnify"
|
||||||
|
@reset-searchtext="resetSearchtext($event)"
|
||||||
@select="option => selected = option">
|
@select="option => selected = option">
|
||||||
</b-autocomplete>
|
</b-autocomplete>
|
||||||
<button class="clearButton" @click="clear">x</button>
|
<button class="clearButton" @click="clear">x</button>
|
||||||
</b-field>
|
</b-field>
|
||||||
</form>`,
|
</form>`,
|
||||||
data: function() {
|
data: function() {
|
||||||
return{
|
return {
|
||||||
searchtext: "",
|
searchtext: "",
|
||||||
selected: [],
|
selected: [],
|
||||||
taglist: data,
|
taglist: data,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
filteredDataArray() {
|
filteredDataArray: function() {
|
||||||
return this.taglist.filter((option) => {
|
return this.taglist.filter((option) => {
|
||||||
return option
|
return option
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.indexOf(this.searchtext.toLowerCase()) >= 0
|
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFilteredTags(text) {
|
resetSearchtext: function(param) {
|
||||||
|
this.searchtext = param;
|
||||||
|
},
|
||||||
|
getFilteredTags: function(text) {
|
||||||
this.taglist = data.filter((option) => {
|
this.taglist = data.filter((option) => {
|
||||||
return option
|
return option
|
||||||
.toString()
|
.toString()
|
||||||
@ -41,7 +45,12 @@ Vue.component('search',{
|
|||||||
this.search();
|
this.search();
|
||||||
},
|
},
|
||||||
search: function() {
|
search: function() {
|
||||||
searching(this.searchtext);
|
var btnString = '';
|
||||||
|
btnString = searching(this.searchtext, btnString);
|
||||||
|
console.info(btnString);
|
||||||
|
this.$emit('update-home-abo-button', btnString);
|
||||||
|
vueForceRender('key');
|
||||||
|
|
||||||
},
|
},
|
||||||
saveTagsToArray: function() {
|
saveTagsToArray: function() {
|
||||||
tagArray = this.selected;
|
tagArray = this.selected;
|
||||||
@ -69,13 +78,17 @@ Vue.component('search',{
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
clear: function() {
|
clear: function() {
|
||||||
//_isSearchActiv = false;
|
|
||||||
this.searchtext = "";
|
this.searchtext = "";
|
||||||
this.list_messages();
|
this.list_messages();
|
||||||
//router.push('/files')
|
//router.push('/files')
|
||||||
//router.push('/home')
|
//router.push('/home')
|
||||||
$("#escape-search-link").css("visibility", "hidden");
|
_isSearchActiv = false;
|
||||||
$("#subscribe-btn").css("visibility", "hidden");
|
_isSubscripeButtonActiv = false;
|
||||||
|
this.$emit('toggle-escape-search-link');
|
||||||
|
vueForceRender('key');
|
||||||
|
console.info('done');
|
||||||
|
// $("#escape-search-link").css("visibility", "hidden");
|
||||||
|
// $("#subscribe-btn").css("visibility", "hidden");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
@ -90,27 +103,28 @@ function get_insert_tag(id) {
|
|||||||
url: "api/tag/id/" + id,
|
url: "api/tag/id/" + id,
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).done(function(tag) {
|
}).done(function(tag) {
|
||||||
data.push("#" + tag.name);
|
data.push('#'+tag.name);
|
||||||
}).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);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function searching(searchtext) {
|
function searching(searchtext,btnString) {
|
||||||
_isSearchActiv = true;
|
_isSearchActiv = true;
|
||||||
$("#escape-search-link").css("visibility", "visible");
|
// $("#escape-search-link").css("visibility", "visible");
|
||||||
//console.log(_tags);
|
//console.log(_tags);
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
|
|
||||||
if(data.indexOf(searchtext) > -1){
|
if(data.indexOf(searchtext) > -1){
|
||||||
var btnString = "#" + searchtext.replace(/#/g, '') + " abonnieren";
|
btnString = searchtext + " abonnieren";
|
||||||
$("#btn-text").text(btnString);
|
// $("#btn-text").text(btnString);
|
||||||
$("#subscribe-btn").css("visibility", "visible");
|
// $("#subscribe-btn").css("visibility", "visible");
|
||||||
|
_isSubscripeButtonActiv = true;
|
||||||
}else{
|
}else{
|
||||||
$("#subscribe-btn").css("visibility", "hidden");
|
// $("#subscribe-btn").css("visibility", "hidden");
|
||||||
|
_isSubscripeButtonActiv = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (searchtext !== '') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "api/msg/search/" + searchtext.replace(/#/g, ''),
|
url: "api/msg/search/" + searchtext.replace(/#/g, ''),
|
||||||
method: "GET"
|
method: "GET"
|
||||||
@ -127,7 +141,8 @@ function searching(searchtext) {
|
|||||||
}).fail(function(e, f, g) {
|
}).fail(function(e, f, g) {
|
||||||
console.log("searching: err: " + e + f + g);
|
console.log("searching: err: " + e + f + g);
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
return btnString;
|
||||||
}
|
}
|
||||||
|
|
||||||
function messages() {
|
function messages() {
|
||||||
|
@ -243,10 +243,10 @@ button.clearButton {
|
|||||||
}
|
}
|
||||||
#subscribe-btn {
|
#subscribe-btn {
|
||||||
float: right;
|
float: right;
|
||||||
visibility: hidden;
|
-visibility: hidden;
|
||||||
}
|
}
|
||||||
#escape-search-link {
|
#escape-search-link {
|
||||||
visibility: hidden;
|
-visibility: hidden;
|
||||||
}
|
}
|
||||||
#bockmark-not-active {
|
#bockmark-not-active {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
|
@ -287,10 +287,10 @@ button.clearButton{
|
|||||||
|
|
||||||
#subscribe-btn{
|
#subscribe-btn{
|
||||||
float: right;
|
float: right;
|
||||||
visibility: hidden;
|
-visibility: hidden;
|
||||||
}
|
}
|
||||||
#escape-search-link{
|
#escape-search-link{
|
||||||
visibility: hidden;
|
-visibility: hidden;
|
||||||
}
|
}
|
||||||
#bockmark-not-active{
|
#bockmark-not-active{
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
|
@ -20,7 +20,7 @@ function getUserRole(found) {
|
|||||||
// Mail contains no number
|
// Mail contains no number
|
||||||
roles += ',"author"';
|
roles += ',"author"';
|
||||||
}
|
}
|
||||||
return roles;
|
return JSON.stringify('{'+roles+'}');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in session object
|
// Fill in session object
|
||||||
@ -37,6 +37,7 @@ function fillSession (req, user, roles, cb) {
|
|||||||
req.session.user = user._id;
|
req.session.user = user._id;
|
||||||
}
|
}
|
||||||
req.session.roles = roles;
|
req.session.roles = roles;
|
||||||
|
console.info(req.session);
|
||||||
}
|
}
|
||||||
return cb (err);
|
return cb (err);
|
||||||
});
|
});
|
||||||
@ -128,7 +129,7 @@ const authorization = {
|
|||||||
if (entry != null && entry.pwd) {
|
if (entry != null && entry.pwd) {
|
||||||
if (crypto.checkLocalAuth (entry, req.body.pwd)) {
|
if (crypto.checkLocalAuth (entry, req.body.pwd)) {
|
||||||
console.info(entry.roles);
|
console.info(entry.roles);
|
||||||
return fillSession (req, entry, JSON.stringify(entry.roles), returnSession);
|
return fillSession (req, entry, JSON.parse(entry.roles), returnSession);
|
||||||
}
|
}
|
||||||
return returnError ();
|
return returnError ();
|
||||||
}
|
}
|
||||||
|
@ -81,35 +81,6 @@ const dbs = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"usr/bookmark/ids": {
|
|
||||||
/* GET /api/usr/bookmark/ids [no args]
|
|
||||||
* -> Array of message schema object ids
|
|
||||||
* Get bookmark message ids
|
|
||||||
*/
|
|
||||||
|
|
||||||
get: function (req, res) {
|
|
||||||
|
|
||||||
model.Users.find({
|
|
||||||
|
|
||||||
},
|
|
||||||
function (err, result) {
|
|
||||||
if (err) {
|
|
||||||
return res.status(401).json(err.message);
|
|
||||||
} else {
|
|
||||||
var parsed = [];
|
|
||||||
for (var i in result) {
|
|
||||||
parsed.push(result[i].bookmarks);
|
|
||||||
}
|
|
||||||
console.log("bookmarks:" + JSON.stringify(parsed));
|
|
||||||
res.send(parsed);
|
|
||||||
}
|
|
||||||
if (result == null) {
|
|
||||||
return res.status(500).json("Can save bookmark.")
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"msg": {
|
"msg": {
|
||||||
/* POST /api/msg
|
/* POST /api/msg
|
||||||
* <- Message schema
|
* <- Message schema
|
||||||
@ -190,6 +161,32 @@ const dbs = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"usr/bookmark/ids": {
|
||||||
|
/* GET /api/usr/bookmark/ids [no args]
|
||||||
|
* -> Array of message schema object ids
|
||||||
|
* Get bookmark message ids
|
||||||
|
*/
|
||||||
|
|
||||||
|
get: function (req, res) {
|
||||||
|
model.Users.find({
|
||||||
|
},
|
||||||
|
function (err, result) {
|
||||||
|
if (err) {
|
||||||
|
return res.status(401).json(err.message);
|
||||||
|
} else {
|
||||||
|
var parsed = [];
|
||||||
|
for (var i in result) {
|
||||||
|
parsed.push(result[i].bookmarks);
|
||||||
|
}
|
||||||
|
console.log("bookmarks:" + JSON.stringify(parsed));
|
||||||
|
res.send(parsed);
|
||||||
|
}
|
||||||
|
if (result == null) {
|
||||||
|
return res.status(500).json("Can save bookmark.")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
"usr/id": {
|
"usr/id": {
|
||||||
params: ":id",
|
params: ":id",
|
||||||
/* GET /api/usr/[usr-id]
|
/* GET /api/usr/[usr-id]
|
||||||
@ -380,7 +377,7 @@ const dbs = {
|
|||||||
bookmarks: { type: [String],
|
bookmarks: { type: [String],
|
||||||
_comment: "" },
|
_comment: "" },
|
||||||
sessionid: { type: String },
|
sessionid: { type: String },
|
||||||
roles: { type: [String], required: true,
|
roles: { type: String, required: true,
|
||||||
_comment: "" },
|
_comment: "" },
|
||||||
});
|
});
|
||||||
model.Users = common.mongoose.model('users', userSchema);
|
model.Users = common.mongoose.model('users', userSchema);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user