c3lf-system-3/src/components/Navbar.vue

93 lines
3.8 KiB
Vue
Raw Normal View History

2019-11-14 02:59:17 +00:00
<template>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark sticky-top">
<div class="dropdown">
2019-12-01 21:00:06 +00:00
<button class="btn text-light dropdown-toggle btn-heading" type="button" id="dropdownMenuButton"
2019-11-14 02:59:17 +00:00
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{getEventSlug}}
2019-11-14 02:59:17 +00:00
</button>
<div class="dropdown-menu bg-dark" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item text-light" href="#" v-for="(event, index) in events" v-bind:key="index"
:class="{ active: event.slug === getEventSlug }" @click="changeEvent(event)">{{ event.slug }}</a>
2019-11-14 02:59:17 +00:00
</div>
</div>
2019-11-14 03:24:36 +00:00
<div class="custom-control-inline mr-1">
2019-11-14 02:59:17 +00:00
<button type="button" class="btn mx-1 text-nowrap" v-for="(button, index) in buttons" v-bind:key="index" :class="['btn-' + button.color]">
<font-awesome-icon :icon="button.icon"/><span class="d-none d-md-inline">&nbsp;{{ button.title }}</span>
2019-11-14 02:59:17 +00:00
</button>
2019-11-15 19:00:40 +00:00
<div class="btn-group btn-group-toggle">
<button :class="['btn', 'btn-info', { active: layout === 'cards' }]" @click="setLayout('cards')">
<font-awesome-icon icon="th"/>
</button>
<button :class="['btn', 'btn-info', { active: layout === 'table' }]" @click="setLayout('table')">
<font-awesome-icon icon="list"/>
</button>
</div>
2019-11-14 02:59:17 +00:00
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<form class="form-inline mt-1 my-lg-auto my-xl-auto w-100 d-inline">
<input class="form-control w-100" type="search" placeholder="Search" aria-label="Search">
</form>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
2019-12-01 22:23:44 +00:00
<li class="nav-item dropdown">
<button class="btn nav-link dropdown-toggle" type="button" id="dropdownMenuButton"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2019-12-05 22:27:24 +00:00
{{getActiveView}}
2019-12-01 22:23:44 +00:00
</button>
<ul class="dropdown-menu bg-dark" aria-labelledby="dropdownMenuButton">
2019-12-05 22:27:24 +00:00
<li class="" v-for="(link, index) in views" v-bind:key="index" :class="{ active: link.path === getActiveView }">
<a class="nav-link text-nowrap" href="#" @click="changeView(link)">{{ link.title }}</a>
2019-12-01 22:23:44 +00:00
</li>
</ul>
</li>
2019-11-14 02:59:17 +00:00
<li class="nav-item" v-for="(link, index) in links" v-bind:key="index">
2019-11-29 23:59:04 +00:00
<a class="nav-link text-nowrap" :href="link.path">{{ link.title }}</a>
2019-11-14 02:59:17 +00:00
</li>
</ul>
</div>
</nav>
</template>
<script>
import { mapState, mapActions, mapMutations, mapGetters} from 'vuex';
2019-11-14 02:59:17 +00:00
export default {
name: 'Navbar',
data: () => ({
2019-12-01 22:23:44 +00:00
views: [
2019-12-05 22:27:24 +00:00
{'title':'items','path':'items'},
{'title':'boxes','path':'boxes'},
2019-12-01 22:23:44 +00:00
{'title':'mass-edit','path':'/#'},
],
links: [
2019-11-29 23:59:04 +00:00
{'title':'howto engel','path':'/howto/'}
],
2019-11-14 02:59:17 +00:00
buttons: [
{ title: 'Add', icon: 'plus', color: 'success' },
2019-12-01 21:00:06 +00:00
//{ title: 'Refresh', icon: 'sync-alt', color: 'primary' },
2019-11-14 02:59:17 +00:00
]
}),
computed: {
2019-11-15 19:00:40 +00:00
...mapState(['events', 'activeEvent', 'layout']),
2019-12-05 22:27:24 +00:00
...mapGetters(['getEventSlug', 'getActiveView']),
2019-11-14 03:14:47 +00:00
},
methods: {
2019-12-05 22:27:24 +00:00
...mapActions(['changeEvent', 'changeView']),
2019-11-15 19:00:40 +00:00
...mapMutations(['setLayout'])
2019-11-14 02:59:17 +00:00
}
};
</script>
2019-12-01 21:00:06 +00:00
<style lang="scss">
@import "../scss/navbar.scss";
</style>