Changed file-folder structure

This commit is contained in:
2019-02-09 19:35:01 +01:00
parent 855dbf8ba7
commit f67e5184b3
17 changed files with 4 additions and 9 deletions
+48
View File
@@ -0,0 +1,48 @@
const BookmarkRouter = {
template: `
<div>
<div class="bookmark-headline"><h4>Gepeicherte Beiträge</h4></div>
<div class="om-card card">
<h6 class="msg-head">
<b>Betreff</b>
<img src="favicon.ico" width=20px height=20px>
</h6>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. <br><br>
<a href="#">#beispiel #tag</a></p>
<div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i>
Erstellt von User 1</div>
<i class="material-icons">bookmark</i>
</div></div>
<div class="om-card card">
<h6 class="msg-head">
<b>Betreff</b>
<img src="favicon.ico" width=20px height=20px>
</h6>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. <br><br>
<a href="#">#beispiel #tag</a></p>
<div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i>
Erstellt von User 1</div>
<i class="material-icons">bookmark</i>
</div></div>
<div class="om-card card">
<h6 class="msg-head">
<b>Betreff</b>
<img src="favicon.ico" width=20px height=20px>
</h6>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. <br><br>
<a href="#">#beispiel #tag</a></p>
<div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i>
Erstellt von User 1</div>
<i class="material-icons">bookmark</i>
</div></div>
</div>
</div>`,
data: function () {
return { messages: _messages };
},
methods: {
},
};
+51
View File
@@ -0,0 +1,51 @@
const CreateMsgRouter = {
template: `
<div class="card om-card">
<h4>Neue Nachricht erstellen</h4>
<form class="new-msg-form" @submit.prevent=createMsg>
<div class="form-group">
<label class="bmd-label-floating">User*</label>
<input type="text" class="form-control" id="user">
</div>
<div class="form-group bmd-form-group">
<label class="bmd-label-floating">Betreff*</label>
<input type="text" class="form-control" id="subject">
</div>
<div class="form-group bmd-form-group">
<label class="bmd-label-floating">Tags</label>
<input type="text" class="form-control" id="tag">
</div>
<div class="form-group">
<label class="bmd-label-floating">Nachricht*</label>
<textarea class="form-control" id="message" rows="5"></textarea>
</div>
<button class="btn btn-default"><a @click="$router.go(-1)">ABBRECHEN </a></button>
<button type="submit" class="btn btn-raised om-btn"><a @click="$router.push('/home')">SENDEN</a></button>
</form>
</div>
`,
data: function () {
return {};
},
methods: {
createMsg: function() {
var subject=$("#subject").val();
var message=$("#message").val();
var tag=$("#tag").val();
var user=$("#user").val();
console.log ("Message Created: "+tag+" "+message+" "+user);
$.ajax ({ url: "api/createMsg", data: {sub: subject, mess: message, use: user, ta: tag}, method: "POST" }) .done (have_result) .fail (have_error);
function have_result (res) {
console.log (res);
}
function have_error (err) {
console.log ("error: " + err.responseText);
console.log (err);
}
},
},
mounted: function() {
if ($(this).bootstrapMaterialDesign)
$(this).bootstrapMaterialDesign();
},
};
+16
View File
@@ -0,0 +1,16 @@
const FileRouter = {
template: `
<div>
<h4>Wichtige Links</h4>
<div class="empty-state">
<i class="material-icons"> widgets </i><br>
Diese Funktion steht noch nicht bereit.
</div>
</div>
`,
data: function () {
return {};
},
methods: {
},
};
+73
View File
@@ -0,0 +1,73 @@
const HomeRouter = {
template: `
<div id="om-msg-cards">
<MsgCard
v-for="id in messagelist.slice().reverse()"
:key="id"
:msg="messages[id] || {}"
></MsgCard>
</div>`,
data: function () {
return {
messagelist: _messagelist,
messages: _messages,
};
},
methods: {
/*refresh_messages: function () {
_messages.push({ //////// alt
id: 42,
subject: "xxx",
message: "warum habt ihr auch so viel",
user: "nobody",
tags: "foo"
});
},*/
list_messages: function () {
$.ajax({url: "api/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("err: " + e + f + g);
});
}
},
mounted: function () {
this.list_messages();
//this.refresh_messages();
}
};
function get_insert_message(id) {
$.ajax({ url: "api/msg/"+id, method: "GET" }).done(function (msg) {
Vue.set(_messages, id, msg);
}).fail(function (e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
}
/*$(document).ready(function () {
console.log("egal");
$.get('list.json').done(function (jd) {
// _messagelist = jd;
_messagelist.splice(0, _messagelist.length);
_messagelist.push.apply(_messagelist, jd);
console.log("egal2");
//$('#xxx').text(jd[0]);
for (var e in jd) {
if (!_messages[jd[e]]) {
get_insert_message(jd[e]);
}
}
}).fail(function (e, f, g) {
console.log("egal3: " + e + f + g);
});
});*/
+2
View File
@@ -0,0 +1,2 @@
_messagelist = [];
_messages = {};
+15
View File
@@ -0,0 +1,15 @@
Vue.component('MsgCard', {
template: `<div class="om-card card">
<h6 class="msg-head">
<b>{{ msg.subject }}</b>
<img src="favicon.ico" width=20px height=20px>
</h6>
{{ msg.message }}<br><br>
<a href="#">{{ msg.tag }}</a></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">bookmark_border</i>
</div></div>`,
props: ['msg']
});
+15
View File
@@ -0,0 +1,15 @@
const ProfilRouter = {
template: `
<div>
<ProfilCard
v-for="(profil, index) in profilcard"
:key="profil.id"
:profil="profil"
></ProfilCard>
</div>`,
data: function () {
return { profilcard: _profilcard };
},
methods: {
},
};
+19
View File
@@ -0,0 +1,19 @@
Vue.component('ProfilCard', {
template: `<div>
<img class="profil-img rounded-circle" src="img/profil_icon.png" width=120px height=120px>
<div class="profil-card card">
<div class="edit-item"><i class="material-icons">edit</i></div>
<div class="profil-text">
<h5><b>{{ profil.user }}</b></h5><br>
<h6>{{ profil.major }}<br><br>
{{ profil.semester }}</h6>
</div>
<hr>
<div class="om-tab">
<button class="tablinks om-tablinks"><b>Abonniert<br>{{ profil.abos }}</b></button>
<button class="tablinks om-tablinks"><b>Gespeichert<br>{{ profil.saved }}</b></button>
</div>
</div>
</div>`,
props: ['profil']
});
+10
View File
@@ -0,0 +1,10 @@
_profilcard = [
{
id: 1,
user: 'Benutzername',
major: 'Studiengang',
semester: 'Semester',
abos: '7',
saved: '3',
},
];