Login + Logout implemented; ProfilCard v1 implemented;
This commit is contained in:
1 parent
1fe9f22109
commit
5f0c8c1d2f
45 files changed
+2534
-708
No files matched your search
File renamed without changes.
+61
-245
@@ -1,15 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>OHM News</title>
|
||||
<!-- 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:-->
|
||||
<!-- <meta http-equiv="refresh" content="10">
|
||||
<!--for demonstration:-->
|
||||
<!-- <meta http-equiv="refresh" content="30"> -->
|
||||
|
||||
<!-- NOTE: Define Theme Color -->
|
||||
@@ -47,265 +46,82 @@
|
||||
<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">-->
|
||||
<link rel="stylesheet" href="lib/bootstrap-material-design-icons-2.5.94.min.css">
|
||||
<!-- CSS_Buefy-->
|
||||
<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">-->
|
||||
<!-- CSS_Custom Design -->
|
||||
<link rel="stylesheet" type="text/css" href="style/style.css">
|
||||
|
||||
<!-- NOTE: Call manifest.json -->
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<!-- NOTE: Load JQuery, Vue.js, VueRouter, Vuetify -->
|
||||
<script src="lib/jquery-3.3.1.min.js"></script>
|
||||
<script src="lib/vue-2.6.10.js"></script>
|
||||
<script src="lib/vue-router-3.0.1.js"></script>
|
||||
|
||||
<!-- Buefy/Vuetify -->
|
||||
<script src="lib/buefy-0.7.5.js"></script>
|
||||
<!-- <script src="lib/buefy-0.7.5.min.js"></script>-->
|
||||
<!-- NOTE: Material Icons e.g. seach -->
|
||||
<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.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">-->
|
||||
<!-- NOTE: Load .js Libraries -->
|
||||
<script src="lib/vue-2.6.10.js"></script>
|
||||
<script src="lib/vue-router-3.0.1.js"></script>
|
||||
<script src="lib/buefy-0.7.5.js"></script>
|
||||
<!-- <script src="lib/buefy-0.7.5.min.js"></script>-->
|
||||
<script src="lib/jquery-3.3.1.min.js"></script>
|
||||
|
||||
<!-- CSS_Custom Design -->
|
||||
<link rel="stylesheet" type="text/css" href="style/style.css">
|
||||
|
||||
<!-- NOTE: JavaScript Libs & Files -->
|
||||
<script src="routes/home.js"></script>
|
||||
<script src="routes/files.js"></script>
|
||||
<script src="routes/createMessage.js"></script>
|
||||
<script src="routes/bookmark.js"></script>
|
||||
<script src="routes/profil.js"></script>
|
||||
<script src="routes/msgCard.js"></script>
|
||||
<script src="routes/messageData.js"></script>
|
||||
<script src="routes/tagData.js"></script>
|
||||
<!-- NOTE: Include .js Routes -->
|
||||
<script src="routes/auth.js"></script><!-- Must load before profile.js -->
|
||||
<script src="routes/home.js"></script>
|
||||
<script src="routes/files.js"></script>
|
||||
<script src="routes/createMessage.js"></script>
|
||||
<script src="routes/bookmark.js"></script>
|
||||
<script src="routes/profil.js"></script>
|
||||
<script src="routes/msgCard.js"></script>
|
||||
<script src="routes/messageData.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/navRoutes.js"></script>
|
||||
|
||||
<title>OHM News</title>
|
||||
<script src="routes/navRoutes.js"></script>
|
||||
<script src="search.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="api">
|
||||
<div class="om-header-container">
|
||||
<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>
|
||||
<div id="api">
|
||||
<div class="om-header-container">
|
||||
<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-touch" href="index.html"><img src="img/app_icon_desk.png" width=100px height=100px></a>
|
||||
<form class="om-searchbar" @submit.prevent="search()">
|
||||
<b-field>
|
||||
<b-autocomplete v-model="searchtext" @keydown.native.enter="search" :data="filteredDataArray" placeholder="suche..." icon="magnify" @select="option => selected = option">
|
||||
</b-autocomplete>
|
||||
<button class="clearButton" @click="clear">x</button>
|
||||
</b-field>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<search></search>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="om-content">
|
||||
<div id=xxx></div>
|
||||
<nav-router></nav-router>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
<div class="om-content">
|
||||
<div id=xxx></div>
|
||||
<nav-router></nav-router>
|
||||
<router-view :key="auth.user"></router-view>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var isSearchActive = false;
|
||||
var tagArray = ["lorem"];
|
||||
const dat = [
|
||||
'th',
|
||||
'efi',
|
||||
'wichtig',
|
||||
];
|
||||
<script>
|
||||
new Vue({
|
||||
router,
|
||||
el: '#api',
|
||||
components: {
|
||||
// Locally registered components
|
||||
},
|
||||
data: {
|
||||
// Locally registered variables
|
||||
auth: auth,
|
||||
},
|
||||
computed:{
|
||||
// Methods to change data appearance, does cache results
|
||||
},
|
||||
methods: {
|
||||
// Methods to change data content, run always again
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
router,
|
||||
el: '#api',
|
||||
data: function() {
|
||||
return {
|
||||
searchtext: "",
|
||||
//isSearchActiv: false,
|
||||
selected: [],
|
||||
taglist: dat,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
filteredDataArray() {
|
||||
return this.taglist.filter((option) => {
|
||||
return option
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
getFilteredTags(text) {
|
||||
this.taglist = dat.filter((option) => {
|
||||
return option
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.indexOf(text.toLowerCase()) >= 0
|
||||
})
|
||||
this.search();
|
||||
},
|
||||
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 => {
|
||||
// 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);
|
||||
});
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
console.log("clear");
|
||||
|
||||
isSearchActiv = false;
|
||||
this.searchtext = "";
|
||||
this.list_messages();
|
||||
},
|
||||
|
||||
},
|
||||
mounted: function() {
|
||||
//this.search();
|
||||
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 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 = [];
|
||||
/*
|
||||
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();
|
||||
},
|
||||
};
|
||||
*/
|
||||
</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>
|
||||
<!-- NOTE: Call SW registration -->
|
||||
<script src="registerSW.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/* MaterialDesignIcons.com */@font-face{font-family:"Material Design Icons";src:url("../fonts/materialdesignicons-webfont.eot?v=2.5.94");src:url("../fonts/materialdesignicons-webfont.eot?#iefix&v=2.5.94") format("embedded-opentype"),url("../fonts/materialdesignicons-webfont.woff2?v=2.5.94") format("woff2"),url("../fonts/materialdesignicons-webfont.woff?v=2.5.94") format("woff"),url("../fonts/materialdesignicons-webfont.ttf?v=2.5.94") format("truetype"),url("../fonts/materialdesignicons-webfont.svg?v=2.5.94#materialdesigniconsregular") format("svg");font-weight:normal;font-style:normal}.mdi:before,.mdi-set{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.mdi-access-point:before{content:"\F002"}.mdi-access-point-network:before{content:"\F003"}.mdi-account:before{content:"\F004"}.mdi-account-alert:before{content:"\F005"}.mdi-account-box:before{content:"\F006"}.mdi-account-box-multiple:before{content:"\F933"}.mdi-account-box-outline:before{content:"\F007"}.mdi-account-card-details:before{content:"\F5D2"}.mdi-account-check:before{content:"\F008"}.mdi-account-circle:before{content:"\F009"}.mdi-account-convert:before{content:"\F00A"}.mdi-account-edit:before{content:"\F6BB"}.mdi-account-group:before{content:"\F848"}.mdi-account-heart:before{content:"\F898"}.mdi-account-key:before{content:"\F00B"}.mdi-account-location:before{content:"\F00C"}.mdi-account-minus:before{content:"\F00D"}.mdi-account-multiple:before{content:"\F00E"}.mdi-account-multiple-check:before{content:"\F8C4"}.mdi-account-multiple-minus:before{content:"\F5D3"}.mdi-account-multiple-outline:before{content:"\F00F"}.mdi-account-multiple-plus:before{content:"\F010"}.mdi-account-multiple-plus-outline:before{content:"\F7FF"}.mdi-account-network:before{content:"\F011"}.mdi-account-off:before{content:"\F012"}.mdi-account-outline:before{content:"\F013"}.mdi-account-plus:before{content:"\F014"}.mdi-account-plus-outline:before{content:"\F800"}.mdi-account-remove:before{content:"\F015"}.mdi-account-search:before{content:"\F016"}.mdi-account-search-outline:before{content:"\F934"}.mdi-account-settings:before{content:"\F630"}.mdi-account-settings-variant:before{content:"\F631"}.mdi-account-star:before{content:"\F017"}.mdi-account-switch:before{content:"\F019"}.mdi-accusoft:before{content:"\F849"}.mdi-adjust:before{content:"\F01A"}.mdi-adobe:before{content:"\F935"}.mdi-air-conditioner:before{content:"\F01B"}.mdi-airballoon:before{content:"\F01C"}.mdi-airplane:before{content:"\F01D"}.mdi-airplane-landing:before{content:"\F5D4"}.mdi-airplane-off:before{content:"\F01E"}.mdi-airplane-takeoff:before{content:"\F5D5"}.mdi-airplay:before{content:"\F01F"}.mdi-airport:before{content:"\F84A"}.mdi-alarm:before{content:"\F020"}.mdi-alarm-bell:before{content:"\F78D"}.mdi-alarm-check:before{content:"\F021"}.mdi-alarm-light:before{content:"\F78E"}.mdi-alarm-multiple:before{content:"\F022"}.mdi-alarm-off:before{content:"\F023"}.mdi-alarm-plus:before{content:"\F024"}.mdi-alarm-snooze:before{content:"\F68D"}.mdi-album:before{content:"\F025"}.mdi-alert:before{content:"\F026"}.mdi-alert-box:before{content:"\F027"}.mdi-alert-circle:before{content:"\F028"}.mdi-alert-circle-outline:before{content:"\F5D6"}.mdi-alert-decagram:before{content:"\F6BC"}.mdi-alert-octagon:before{content:"\F029"}.mdi-alert-octagram:before{content:"\F766"}.mdi-alert-outline:before{content:"\F02A"}.mdi-alien:before{content:"\F899"}.mdi-all-inclusive:before{content:"\F6BD"}.mdi-alpha:before{content:"\F02B"}.mdi-alphabetical:before{content:"\F02C"}.mdi-altimeter:before{content:"\F5D7"}.mdi-amazon:before{content:"\F02D"}.mdi-amazon-alexa:before{content:"\F8C5"}.mdi-amazon-drive:before{content:"\F02E"}.mdi-ambulance:before{content:"\F02F"}.mdi-amplifier:before{content:"\F030"}.mdi-anchor:before{content:"\F031"}.mdi-android:before{content:"\F032"}.mdi-android-debug-bridge:before{content:"\F033"}.mdi-android-head:before{content:"\F78F"}.mdi-android-studio:before{content:"\F034"}.mdi-angle-acute:before{content:"\F936"}.mdi-angle-obtuse:before{content:"\F937"}.mdi-angle-right:before{content:"\F938"}.mdi-angular:before{content:"\F6B1"}.mdi-angularjs:before{content:"\F6BE"}.mdi-animation:before{content:"\F5D8"}.mdi-animation-play:before{content:"\F939"}.mdi-anvil:before{content:"\F89A"}.mdi-apple:before{content:"\F035"}.mdi-apple-finder:before{content:"\F036"}.mdi-apple-icloud:before{content:"\F038"}.mdi-apple-ios:before{content:"\F037"}.mdi-apple-keyboard-caps:before{content:"\F632"}.mdi-apple-keyboard-command:before{content:"\F633"}.mdi-apple-keyboard-control:before{content:"\F634"}.mdi-apple-keyboard-option:before{content:"\F635"}.mdi-apple-keyboard-shift:before{content:"\F636"}.mdi-apple-safari:before{content:"\F039"}.mdi-application:before{content:"\F614"}.mdi-approval:before{content:"\F790"}.mdi-apps:before{content:"\F03B"}.mdi-arch:before{content:"\F8C6"}.mdi-archLine truncated
|
||||
/*# sourceMappingURL=materialdesignicons.min.css.map */
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************
|
||||
* Main JavaScript file - Entry point of all JS files *
|
||||
******************************************************/
|
||||
/*
|
||||
* Register ServiceWorker - load as last script
|
||||
*/
|
||||
|
||||
// Wait until page loaded
|
||||
window.addEventListener('load', () => {
|
||||
@@ -18,9 +18,3 @@ window.addEventListener('load', () => {
|
||||
return;
|
||||
}*/
|
||||
});
|
||||
|
||||
// NOTE: Set Bootstrap materialdesign
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
$('body').bootstrapMaterialDesign();
|
||||
}, false);
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
var auth = {};
|
||||
|
||||
function clearAuthState() {
|
||||
auth.user = ''; // Login name
|
||||
auth.name = ''; // Full name
|
||||
auth.type = ''; // type of login (domain specific)
|
||||
auth.mail = ''; // Full mail address
|
||||
auth.roles = {}; // Role authorizations e.g. {user: true}
|
||||
auth.gender = ''; // Gender (e.g. Frau)
|
||||
}
|
||||
clearAuthState();
|
||||
|
||||
function fillAuthState(state) {
|
||||
// Shallow copy
|
||||
if (auth === undefined) {
|
||||
auth = state;
|
||||
}
|
||||
for (e in auth) {
|
||||
auth[e] = state[e];
|
||||
}
|
||||
}
|
||||
|
||||
// Login component: Login panel (if not logged in) or Logout element (if logged in)
|
||||
Vue.component('login-panel', {
|
||||
template: `
|
||||
<div class="modal-card" style="width: auto">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Login (Ohmportal)</p>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<b-field>
|
||||
<b-input
|
||||
v-model=user
|
||||
placeholder="User"
|
||||
:value="user"
|
||||
required>
|
||||
</b-input>
|
||||
</b-field>
|
||||
<b-field>
|
||||
<b-input
|
||||
v-model=pwd
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
:value="pwd"
|
||||
@keyup.enter.native="login"
|
||||
required>
|
||||
</b-input>
|
||||
</b-field>
|
||||
<b-checkbox>Eingeloggt bleiben</b-checkbox>
|
||||
<div v-if="error" style="color:red;"> Versuche es nochmal.</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button" type="button" @click.prevent="$parent.close()">Close</button>
|
||||
<button class="button is-primary" @click.prevent="login">Login</button>
|
||||
</footer>
|
||||
</div>`,
|
||||
data: function () {
|
||||
return {
|
||||
auth: auth,
|
||||
user: '',
|
||||
pwd: '',
|
||||
error: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
closeLoginPanel: function() {
|
||||
this.$emit('close-login-panel');
|
||||
},
|
||||
showLoginPanel: function() {
|
||||
this.$emit('show-login-panel');
|
||||
},
|
||||
pwd_changed: function(evt) {
|
||||
// Only required for PasswordInsert Apps etc. who send only(!) change events
|
||||
this.pwd = e.target.value;
|
||||
// Alternative call the input event
|
||||
//e.target.dispatchEvent(new Event('input'));
|
||||
},
|
||||
login: function() {
|
||||
clearAuthState();
|
||||
|
||||
$.ajax({
|
||||
url: "api/login",
|
||||
data: {
|
||||
user: this.user,
|
||||
pwd: this.pwd
|
||||
},
|
||||
method: "POST"
|
||||
}).done(successful_login).fail(failed_login);
|
||||
|
||||
function successful_login(resData) {
|
||||
fillAuthState(resData);
|
||||
console.info("Correct credentials");
|
||||
this.closeLoginPanel;
|
||||
|
||||
//console.log(resData);
|
||||
router.push('/home');
|
||||
}
|
||||
|
||||
function failed_login(err) {
|
||||
console.info("Wrong credentials");
|
||||
this.showError=true;
|
||||
this.showLoginPanel;
|
||||
|
||||
console.log("error: " + err.responseText);
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
checkData: function() {
|
||||
clearAuthState();
|
||||
|
||||
$.ajax({
|
||||
url: "api/login",
|
||||
data: undefined,
|
||||
method: "POST"
|
||||
}).done(successful_login).fail(failed_login);
|
||||
|
||||
function successful_login(res) {
|
||||
console.info("Re-Auth: Correct credentials");
|
||||
this.closeLoginPanel;
|
||||
|
||||
//console.log(res);
|
||||
router.push('/home')
|
||||
}
|
||||
|
||||
function failed_login(err) {
|
||||
console.info("Re-Auth: Wrong credentials");
|
||||
this.showError=true;
|
||||
this.showLoginPanel;
|
||||
|
||||
console.log("error: " + err.responseText);
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
logout: function() {
|
||||
clearAuthState();
|
||||
$.ajax({ url: "api/logout", method: "POST" });
|
||||
this.closeLoginPanel;
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,57 +0,0 @@
|
||||
Vue.component('login-panel', {
|
||||
template: `
|
||||
<form action="">
|
||||
<div class="modal-card" style="width: auto">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Login</p>
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<b-field>
|
||||
<b-input
|
||||
placeholder="User (Ohmportal)"
|
||||
:value="user"
|
||||
v-model=user
|
||||
required>
|
||||
</b-input>
|
||||
</b-field>
|
||||
<b-field>
|
||||
<b-input
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
:value="pwd"
|
||||
required>
|
||||
</b-input>
|
||||
</b-field>
|
||||
<b-checkbox>Eingeloggt bleiben</b-checkbox>
|
||||
<div v-if="showError" style="color:red;"> Versuche es nochmal.</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button" type="button" @click="$parent.close()">Close</button>
|
||||
<button class="button is-primary" @click="checkData()">Login</button>
|
||||
</footer>
|
||||
</div>
|
||||
</form>`,
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
user: "name",
|
||||
pwd:"password",
|
||||
showError:false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
checkData(){
|
||||
if(this.user === "name" && this.pwd === "password"){
|
||||
console.log("correct");
|
||||
this.$parent.close();
|
||||
}else{
|
||||
console.log("wrong");
|
||||
this.showError=true;
|
||||
}
|
||||
},
|
||||
|
||||
logIn(){
|
||||
$parent.close();
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -53,7 +53,6 @@ Vue.component('nav-router', {
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
});
|
||||
|
||||
const routes = [
|
||||
@@ -63,7 +62,7 @@ const routes = [
|
||||
{ path: "/createMessage", component: CreateMsgRouter },
|
||||
{ path: "/bookmark", component: BookmarkRouter },
|
||||
{ path: "/profil", component: ProfilRouter },
|
||||
];
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
|
||||
+34
-37
@@ -1,45 +1,42 @@
|
||||
const ProfilRouter = {
|
||||
template: `
|
||||
<div>
|
||||
<div v-if="isAuthentified">
|
||||
<ProfilCard
|
||||
v-for="(profil, index) in profilcard"
|
||||
:key="profil.id"
|
||||
:profil="profil"
|
||||
></ProfilCard>
|
||||
<b-button type="button" class="btn btn-primary" data-dismiss="modal" v-on:click="logOut()">Logout</b-button>
|
||||
</div>
|
||||
<div>
|
||||
<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-else-if="!isAuthentified">
|
||||
<button class="button is-primary is-medium"
|
||||
@click="showLoginModal = true">
|
||||
Login
|
||||
</button>
|
||||
|
||||
<b-modal :active.sync="showLoginModal" has-modal-card>
|
||||
<login-panel></login-panel>
|
||||
</b-modal>
|
||||
</div>
|
||||
</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>`,
|
||||
data: function () {
|
||||
return {
|
||||
showLoginModal: false,
|
||||
isAuthentified: false,
|
||||
profilcard: _profilcard,
|
||||
isAuth: false,
|
||||
isLPVisible: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
closeLoginPanel: function() {
|
||||
this.isLPVisible = false;
|
||||
},
|
||||
showLoginPanel: function() {
|
||||
this.isLPVisible = true;
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
//console.info(auth);
|
||||
},
|
||||
beforeMount: function() {
|
||||
this.isAuth = (auth != null && auth.mail != '');
|
||||
//console.info('beforeMount: '+this.isAuth);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
$('#myModal').on('show.bs.modal', function (event) {
|
||||
console.log("Modal Opened")
|
||||
var button = $(event.relatedTarget) // Button that triggered the modal
|
||||
var recipient = button.data('whatever') // Extract info from data-* attributes
|
||||
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
|
||||
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
|
||||
var modal = $(this)
|
||||
modal.find('.modal-title').text('New message to ' + recipient)
|
||||
modal.find('.modal-body input').val(recipient)
|
||||
})
|
||||
*/
|
||||
+57
-58
@@ -1,72 +1,71 @@
|
||||
Vue.component('ProfilCard', {
|
||||
template: `<div>
|
||||
<div class="profil-card card">
|
||||
<br/>
|
||||
<img class="prof-image" src="img/profil_icon.png" alt="Card image cap">
|
||||
Vue.component('profil-card', {
|
||||
template: `
|
||||
<div class="profil-card card">
|
||||
<img class="prof-image" src="img/profil_icon.png" alt="Card image cap">
|
||||
|
||||
<div class="logout-item"><i class="material-icons" @click="$router.push('/login')">exit_to_app</i></div>
|
||||
<div class="logout-item" style="float: right;">
|
||||
<b-button type="button" class="btn btn-primary" data-dismiss="modal" @click.prevent="logout">
|
||||
<i class="material-icons" style="float: left; margin: -0.1rem 0.2rem 0 -0.2rem;" @click.prevent="logout">exit_to_app</i>
|
||||
Logout</b-button>
|
||||
</div>
|
||||
|
||||
<div class="profil-text">
|
||||
<h6><b>Benutzername:</b><br><br>
|
||||
<b>{{ profil.user }}</b><br><br>
|
||||
<b>Studiengang:</b><br><br>
|
||||
{{ profil.major }}<br><br>
|
||||
<b>Semester:</b><br><br>
|
||||
{{ profil.semester }}<br></h6>
|
||||
</div>
|
||||
<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:90%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ auth.type }}</b></span>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<hr class="first">
|
||||
<hr class="first">
|
||||
|
||||
<div class="btnprofil">
|
||||
<button @click="isCardModalActive = true"><b>Abonniert: <br/>{{ profil.abos }}</b> <br/></button>
|
||||
<button @click="$router.push('/bookmark')"><b>Gespeichert:<br/> {{ profil.saved }}</b><br/></button>
|
||||
</div>
|
||||
<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>
|
||||
</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>
|
||||
</header>
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<ul>
|
||||
<li>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
<li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="modal-card-foot">
|
||||
<b-button size="is-medium" @click="isCardModalActive = false">Close</b-button>
|
||||
</footer>
|
||||
<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>
|
||||
</header>
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<ul>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
<li></li>
|
||||
</ul>
|
||||
</div>
|
||||
</b-modal>
|
||||
</section>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
props: ['profil'],
|
||||
|
||||
</div>
|
||||
<footer class="modal-card-foot">
|
||||
<b-button size="is-medium" @click="isCardModalActive = false">Close</b-button>
|
||||
</footer>
|
||||
</div>
|
||||
</b-modal>
|
||||
</section>
|
||||
</div>`,
|
||||
data: function () {
|
||||
return {
|
||||
isCardModalActive: false
|
||||
auth: auth,
|
||||
abo: 7,
|
||||
saved: 3,
|
||||
isCardModalActive: false,
|
||||
majorList: {
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
close: function () {
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
logout: function() {
|
||||
clearAuthState();
|
||||
$.ajax({ url: "api/logout", method: "POST" });
|
||||
router.push('/profil');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,144 @@
|
||||
var isSearchActive = false,
|
||||
tagArray = ["lorem"];
|
||||
|
||||
const dat=[
|
||||
'th',
|
||||
'efi',
|
||||
'wichtig',
|
||||
],
|
||||
search_data = [];
|
||||
|
||||
Vue.component('search',{
|
||||
template: `
|
||||
<form class="om-searchbar" @submit.prevent="search()">
|
||||
<b-field>
|
||||
<b-autocomplete
|
||||
v-model="searchtext"
|
||||
@keydown.native.enter="search"
|
||||
:data="filteredDataArray"
|
||||
placeholder="suche..."
|
||||
icon="magnify"
|
||||
@select="option => selected = option">
|
||||
</b-autocomplete>
|
||||
<button class="clearButton" @click="clear">x</button>
|
||||
</b-field>
|
||||
</form>`,
|
||||
data: function() {
|
||||
return{
|
||||
searchtext: "",
|
||||
selected: [],
|
||||
taglist: dat,
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
filteredDataArray() {
|
||||
return this.taglist.filter((option) => {
|
||||
return option
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getFilteredTags(text) {
|
||||
this.taglist = dat.filter((option) => {
|
||||
return option
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.indexOf(text.toLowerCase()) >= 0
|
||||
})
|
||||
this.search();
|
||||
},
|
||||
search: function() {
|
||||
searching(this.searchtext);
|
||||
},
|
||||
saveTagsToArray: function() {
|
||||
tagArray = this.selected;
|
||||
// console.info(tagArray);
|
||||
},
|
||||
list_messages: function() {
|
||||
messages();
|
||||
},
|
||||
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);
|
||||
});
|
||||
},
|
||||
clear: function() {
|
||||
console.log("clear");
|
||||
|
||||
isSearchActiv = false;
|
||||
this.searchtext = "";
|
||||
this.list_messages();
|
||||
},
|
||||
},
|
||||
mounted: function() {
|
||||
//this.search();
|
||||
this.list_tags();
|
||||
},
|
||||
});
|
||||
|
||||
// Global Functions !!!
|
||||
function get_insert_tag(id) {
|
||||
$.ajax({
|
||||
url: "api/tag/" + id,
|
||||
method: "GET"
|
||||
}).done(function(tag) {
|
||||
dat.push("#" + tag.name);
|
||||
}).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);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user