refactoring home.js; bookmark.js hinzugefügt

This commit is contained in:
Edwina Barbalan 2018-12-06 10:23:38 +01:00
parent 9b8fe37cc6
commit 2f9750eae4
7 changed files with 69 additions and 50 deletions

@ -0,0 +1,16 @@
const BookmarkRouter = {
template: `
<div>
<div class="bookmark-headline"><h4><b>Gepeicherte Beiträge</b></h4></div>
<MsgCard
v-for="(msg, index) in messages"
:key="msg.id"
:msg="msg"
></MsgCard>
</div>`,
data: function () {
return { messages: _messages };
},
methods: {
},
};

@ -1,43 +1,3 @@
_messages = [
{
id: 1,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bme #semester',
user: 'user_1'
},
{
id: 2,
subject: 'Betreff',
message: '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. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
tag: '#efi #fachschaft',
user: 'user_2'
},
{
id: 3,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bei #wichtig',
user: 'user_3'
},
];
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-user-line">
<i class="material-icons">account_circle</i>
Erstellt von {{ msg.user }}
</div></div>`,
props: ['msg']
});
const HomeRouter = { const HomeRouter = {
template: ` template: `
<div> <div>

@ -42,12 +42,14 @@
<script src=lib/vue.js></script> <script src=lib/vue.js></script>
<script src=lib/vue-router.js></script> <script src=lib/vue-router.js></script>
<!-- NOTE: Call Vue Components --> <!-- NOTE: JavaScript Libs & Files -->
<script src="home.js"></script> <script src="home.js"></script>
<!-- <script src="files.js"></script> --> <script src="files.js"></script>
<script src="createMessage.js"></script> <script src="createMessage.js"></script>
<script src="bookmark.js"></script> <script src="bookmark.js"></script>
<script src="profil.js"></script> <script src="profil.js"></script>
<script src="msgCard.js"></script>
<script src="messageData.js"></script>
<title>OMApp</title> <title>OMApp</title>
@ -83,10 +85,10 @@
const routes = [ const routes = [
{ path: "/", component: HomeRouter }, { path: "/", component: HomeRouter },
{ path: "/home", component: HomeRouter }, { path: "/home", component: HomeRouter },
/* { path: "/files", component: Files }, { path: "/bookmark", component: BookmarkRouter },
{ path: "/createMessage", component: CreateMsg }, /* { path: "/files", component: FileRouter },
{ path: "/bookmark", component: Bookmark }, { path: "/createMessage", component: CreateMsgRouter },
{ path: "/profil", component: Profil },*/ { path: "/profil", component: ProfilRouter },*/
]; ];
const router = new VueRouter({ const router = new VueRouter({
routes routes
@ -98,9 +100,6 @@
</script> </script>
<!-- NOTE: JavaScript Libs & Files -->
<!-- CDN_Vue.js developmement lib -->
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>-->
<!-- CDN_Vue.js minified lib --> <!-- CDN_Vue.js minified lib -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script> --> <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script> -->
<!-- CDN_jQuery minified lib --> <!-- CDN_jQuery minified lib -->
@ -112,7 +111,6 @@
<!-- NOTE: Call main.js --> <!-- NOTE: Call main.js -->
<script src="main.js"></script> <script src="main.js"></script>
</body> </body>
</html> </html>

23
public/messageData.js Normal file

@ -0,0 +1,23 @@
_messages = [
{
id: 1,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bme #semester',
user: 'user_1'
},
{
id: 2,
subject: 'Betreff',
message: '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. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
tag: '#efi #fachschaft',
user: 'user_2'
},
{
id: 3,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bei #wichtig',
user: 'user_3'
},
];

14
public/msgCard.js Normal file

@ -0,0 +1,14 @@
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-user-line">
<i class="material-icons">account_circle</i>
Erstellt von {{ msg.user }}
</div></div>`,
props: ['msg']
});

@ -62,6 +62,9 @@
.om-nav i { .om-nav i {
color: white; color: white;
} }
.bookmark-headline {
margin: 10px;
}
.form-group.is-focused .form-control { .form-group.is-focused .form-control {
background-image: linear-gradient(0deg, #0046a0 2px, rgba(0, 150, 136, 0) 0), linear-gradient(0deg, rgba(0, 0, 0, 0.26) 1px, transparent 0); background-image: linear-gradient(0deg, #0046a0 2px, rgba(0, 150, 136, 0) 0), linear-gradient(0deg, rgba(0, 0, 0, 0.26) 1px, transparent 0);
} }

@ -73,6 +73,11 @@
} }
} }
// bookmark
.bookmark-headline{
margin: 10px;
}
//bmd changes //bmd changes