2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 19:29:02 +00:00
- dropdown items on title click
This commit is contained in:
Faris Ansari 2018-07-15 19:20:10 +05:30
parent d59fd52ffd
commit 26380ac3f6

View File

@ -1,10 +1,21 @@
<template> <template>
<div class="frappe-sidebar col-2 bg-light border-right"> <div class="frappe-sidebar col-2 bg-light border-right">
<div class="navbar border-bottom navbar-title" @click="onNavbarTitleClick"> <div class="navbar border-bottom navbar-title" @click="toggleDropdown">
<div class="navbar-text"> <div class="navbar-text">
{{ title }} {{ title }}
</div> </div>
<feather-icon class="mt-1" name="chevron-down" /> <feather-icon class="mt-1" name="chevron-down" />
<div :class="['dropdown-menu shadow w-100', showDropdown ? 'show' : '']">
<a
href="#"
class="dropdown-item"
v-for="option in sidebarConfig.titleDropdownItems"
:key="option.label"
@click.prevent="titleDropdownItemClick(option.handler)"
>
{{ option.label }}
</a>
</div>
</div> </div>
<div class="my-3" v-for="(sidebarGroup, index) in sidebarConfig.groups" :key="index"> <div class="my-3" v-for="(sidebarGroup, index) in sidebarConfig.groups" :key="index">
<h6 v-if="sidebarGroup.title" class="sidebar-heading nav-link text-muted text-uppercase m-0"> <h6 v-if="sidebarGroup.title" class="sidebar-heading nav-link text-muted text-uppercase m-0">
@ -27,7 +38,8 @@ export default {
props: ['sidebarConfig'], props: ['sidebarConfig'],
data() { data() {
return { return {
title: '' title: '',
showDropdown: false
} }
}, },
async created() { async created() {
@ -41,8 +53,11 @@ export default {
const route = item.route.slice(1); const route = item.route.slice(1);
return this.$route.path === route; return this.$route.path === route;
}, },
onNavbarTitleClick() { titleDropdownItemClick(handler) {
this.sidebarConfig.onTitleClick(this); handler(this);
},
toggleDropdown(e) {
this.showDropdown = !this.showDropdown;
} }
} }
} }