Browse Source

Router Componente erstellt / Navbar bearbeitet

master
Edwina Barbalan 5 years ago
parent
commit
9375316956

+ 9
- 3
public/index.html View File

<script src="routes/profilCard.js"></script> <script src="routes/profilCard.js"></script>
<script src="routes/profilData.js"></script> <script src="routes/profilData.js"></script>
<script src="routes/login.js"></script> <script src="routes/login.js"></script>
<script src="routes/navRoutes.js"></script>


<title>OHM News</title> <title>OHM News</title>
</head> </head>


<div class="om-content"> <div class="om-content">
<div id=xxx></div> <div id=xxx></div>
<nav-router></nav-router>
<router-view></router-view> <router-view></router-view>
</div> </div>
</div>


<!--<b-tabs type="is-toggle" expanded> <!--<b-tabs type="is-toggle" expanded>
<b-tab-item><router-link to="/home" > <b-tab-item><router-link to="/home" >


</b-tabs>--> </b-tabs>-->


<!--
<nav class="navbar is-fixed-bottom is-expanded is-light is-hoverable" role="navigation" aria-label="main navigation"> <nav class="navbar is-fixed-bottom is-expanded is-light is-hoverable" role="navigation" aria-label="main navigation">
<div class="navbar-brand is-expanded"> <div class="navbar-brand is-expanded">
<router-link to="/home" class="navbar-item is-expanded has-text-centered is-active"> <router-link to="/home" class="navbar-item is-expanded has-text-centered is-active">
</div> </div>
</nav> </nav>


<!--<nav class="nav nav-tabs nav-justified om-nav" v-if="$route.path !=='/createMessage' ">
<nav class="nav nav-tabs nav-justified om-nav" v-if="$route.path !=='/createMessage' ">
<router-link to="/home" class="navbar-item has-text-centered"><i class="material-icons">home</i></router-link> <router-link to="/home" class="navbar-item has-text-centered"><i class="material-icons">home</i></router-link>
<router-link to="/files" class="navbar-item has-text-centered"><i class="material-icons">language</i></router-link> <router-link to="/files" class="navbar-item has-text-centered"><i class="material-icons">language</i></router-link>
<router-link to="/createMessage" class="navbar-item has-text-centered outlined"><i class="material-icons">add_circle</i></router-link> <router-link to="/createMessage" class="navbar-item has-text-centered outlined"><i class="material-icons">add_circle</i></router-link>
<router-link to="/bookmark" class="navbar-item has-text-centered"><i class="material-icons">bookmark</i></router-link> <router-link to="/bookmark" class="navbar-item has-text-centered"><i class="material-icons">bookmark</i></router-link>
<router-link to="/profil" class="navbar-item has-text-centered"><i class="material-icons">person</i></router-link> <router-link to="/profil" class="navbar-item has-text-centered"><i class="material-icons">person</i></router-link>
</nav>-->
</nav>
</div> </div>


<script> <script>
const router = new VueRouter({ const router = new VueRouter({
routes routes
}); });

-->
<script>
var app = new Vue({ var app = new Vue({
router, router,
el: '#api', el: '#api',

+ 16
- 7
public/routes/bookmark.js View File

<b>Betreff</b> <b>Betreff</b>
<img src="favicon.ico" width=20px height=20px> <img src="favicon.ico" width=20px height=20px>
</h6> </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>
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> <a href="#">#beispiel #tag</a></p>
<div class="om-card-footer"> <div class="om-user-line"> <div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i> <i class="material-icons">account_circle</i>
Erstellt von User 1</div> Erstellt von User 1</div>
<i class="material-icons">bookmark</i>
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
</div></div> </div></div>
<div class="om-card card"> <div class="om-card card">
<h6 class="msg-head"> <h6 class="msg-head">
<a href="#">#beispiel #tag</a></p> <a href="#">#beispiel #tag</a></p>
<div class="om-card-footer"> <div class="om-user-line"> <div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i> <i class="material-icons">account_circle</i>
Erstellt von User 1</div>
<i class="material-icons">bookmark</i>
Erstellt von User 2</div>
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
</div></div> </div></div>
<div class="om-card card"> <div class="om-card card">
<h6 class="msg-head"> <h6 class="msg-head">
<a href="#">#beispiel #tag</a></p> <a href="#">#beispiel #tag</a></p>
<div class="om-card-footer"> <div class="om-user-line"> <div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i> <i class="material-icons">account_circle</i>
Erstellt von User 1</div>
<i class="material-icons">bookmark</i>
Erstellt von User 3</div>
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
</div></div> </div></div>
</div> </div>
</div>`, </div>`,
data: function () { data: function () {
return { messages: _messages };
return {
messages: _messages,
isActive: false,
}
}, },
methods: { methods: {
myFilter () {
this.isActive = !this.isActive;
}
}, },
}; };

+ 8
- 28
public/routes/msgCard.js View File

<div class="om-card-footer"> <div class="om-user-line"> <div class="om-card-footer"> <div class="om-user-line">
<i class="material-icons">account_circle</i> <i class="material-icons">account_circle</i>
Erstellt von {{ msg.user }}</div> Erstellt von {{ msg.user }}</div>

<a href="#" v-if="isFavorited" @click.prevent="unFavorite(post)">
<i class="material-icons">bookmark_border</i></a>

<a href="#" v-else @click.prevent="favorite(post)">
<i class="bookmark"></i>
</a>

<i class="material-icons" @click="myFilter()" v-if="!isActive">bookmark_border</i>
<i class="material-icons" @click="myFilter()" v-else="isActive">bookmark</i>
</div></div>`, </div></div>`,
props: ['msg'], props: ['msg'],
// props: ['post', 'favorited'],

data: function () { data: function () {
return { return {
// isFavorited: '',
isActive: false,
}; };
}, },
/* mounted() {
this.isFavorited = this.isFavorite ? true : false;
},
computed: {
isFavorite() {
return this.favorited;
},
},*/

methods: { methods: {
/* favorite(post) {
$.ajax({url: "api/ids", method: "POST"})
.then(response => this.isFavorited = true)
.catch(response => console.log(response.data));
},
unFavorite(post) {
$.ajax({url: "api/ids", method: "POST"})
.then(response => this.isFavorited = false)
.catch(response => console.log(response.data));
}*/
myFilter: function() {
this.isActive = !this.isActive;
}, },
}
}); });

+ 42
- 0
public/routes/navRoutes.js View File

Vue.component('nav-router', {
template: `
<div>
<nav class="navbar is-fixed-bottom is-expanded is-primary" role="navigation" aria-label="main navigation">
<div class="navbar-brand is-expanded is-primary">
<router-link to="/home" class="navbar-item is-expanded has-text-centered">
<i class="material-icons">home</i>
</router-link>

<router-link to="/files" class="navbar-item is-expanded">
<i class="material-icons">language</i>
</router-link>

<router-link to="/createMessage" class="navbar-item is-expanded">
<i class="material-icons">add_circle</i>
</router-link>

<router-link to="/bookmark" class="navbar-item is-expanded">
<i class="material-icons">bookmark</i>
</router-link>

<router-link to="/profil" class="navbar-item is-expanded">
<i class="material-icons">person</i>
</router-link>
</div>
</nav>
</div>`,

});

const routes = [
{ path: "/", component: HomeRouter },
{ path: "/home", component: HomeRouter },
{ path: "/files", component: FileRouter },
{ path: "/createMessage", component: CreateMsgRouter },
{ path: "/bookmark", component: BookmarkRouter },
{ path: "/profil", component: ProfilRouter },
];

const router = new VueRouter({
routes,
});

+ 8
- 0
public/style/style.css View File

.om-nav i { .om-nav i {
color: white; color: white;
} }
.navbar-item {
display: inline-block;
text-align: center;
}
.navbar-item i {
margin: auto;
text-align: center;
}
.om-card { .om-card {
margin: 10px; margin: 10px;
margin-bottom: 20px; margin-bottom: 20px;

+ 10
- 0
public/style/style.less View File



} }


.navbar-item {
display: inline-block;
text-align: center;
i {
margin: auto;
text-align: center;
}
}


//msg-Card //msg-Card
.om-card{ .om-card{
margin: 10px; margin: 10px;

Loading…
Cancel
Save