11<template >
22 <div class =" page-header d-flex align-content-center" >
3- <div class =" logo" >
3+ <div class =" logo" @click = " goHome() " >
44 <font-awesome-icon icon =" home" class =" home-icon" />
5- <img class = " logo " src =" /static/images/logo.png" >
5+ <img src =" /static/images/logo.png" >
66 </div >
77 <div class =" boards-menu-toggle" >
88 <div class =" dropdown" >
99 <button class =" btn dropdown-toggle" type =" button" id =" boardsMenu" data-toggle =" dropdown" aria-haspopup =" true" aria-expanded =" false" >
1010 Boards
1111 </button >
1212 <div class =" dropdown-menu" aria-labelledby =" boardsMenu" >
13- <h6 class =" dropdown-header" >Personal Boards</h6 >
14- <button class =" dropdown-item" type =" button" >vuejs.spring-boot.mysql</button >
13+ <div v-show =" !hasBoards" class =" dropdown-item" >No boards</div >
14+ <div v-show =" hasBoards" >
15+ <h6 class =" dropdown-header" v-show =" personalBoards.length" >Personal Boards</h6 >
16+ <button v-for =" board in personalBoards" v-bind:key =" board.id" @click =" openBoard(board)"
17+ class =" dropdown-item" type =" button" >{{ board.name }}</button >
18+ <div v-for =" team in teamBoards" v-bind:key =" 't' + team.id" >
19+ <h6 class =" dropdown-header" >{{ team.name }}</h6 >
20+ <button v-for =" board in team.boards" v-bind:key =" board.id" @click =" openBoard(board)"
21+ class =" dropdown-item" type =" button" >{{ board.name }}</button >
22+ </div >
23+ </div >
1524 </div >
1625 </div >
1726 </div >
2433 <div class =" profile-menu-toggle" >
2534 <div class =" dropdown" >
2635 <button class =" btn dropdown-toggle" type =" button" id =" profileMenu" data-toggle =" dropdown" aria-haspopup =" true" aria-expanded =" false" >
27- James J. Ye
36+ {{ user.name }}
2837 </button >
2938 <div class =" dropdown-menu" aria-labelledby =" profileMenu" >
3039 <button class =" dropdown-item" type =" button" >Profile</button >
3746
3847<script >
3948import ' bootstrap/dist/js/bootstrap.min'
49+ import { mapGetters } from ' vuex'
4050
4151export default {
42- name: ' PageHeader'
52+ name: ' PageHeader' ,
53+ computed: {
54+ ... mapGetters ([
55+ ' user' ,
56+ ' hasBoards' ,
57+ ' personalBoards' ,
58+ ' teamBoards'
59+ ])
60+ },
61+ created () {
62+ this .$store .dispatch (' getMyData' )
63+ },
64+ methods: {
65+ goHome () {
66+ this .$router .push ({name: ' home' })
67+ },
68+ openBoard (board ) {
69+ this .$router .push ({name: ' board' , params: { boardId: board .id }})
70+ }
71+ }
4372}
4473 </script >
4574
@@ -53,17 +82,18 @@ export default {
5382 height : 25px ;
5483 width : 115px ;
5584 margin-top : 2px ;
85+ cursor : pointer ;
5686
5787 .home-icon {
58- font-size : 25 px ;
88+ font-size : 20 px ;
5989 vertical-align : middle ;
6090 }
6191
6292 img {
6393 margin-left : 5px ;
94+ margin-top : 6px ;
6495 width : 80px ;
65- height : 20px ;
66- vertical-align : bottom ;
96+ // vertical-align: bottom;
6797 }
6898 }
6999
@@ -96,6 +126,7 @@ export default {
96126 height : calc (1.8125rem + 5px );
97127 font-size : 1rem ;
98128 border : 1px solid #eee ;
129+ border-radius : 5px ;
99130 }
100131
101132 input :focus {
0 commit comments