Add "Home" button for navigation
This commit is contained in:
		
							parent
							
								
									872397d05e
								
							
						
					
					
						commit
						3201ffb2a9
					
				
					 5 changed files with 17 additions and 2 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| const logInButton = document.getElementById('login-button'); | ||||
| const logOutButton = document.getElementById('logout-button'); | ||||
| const homeButton = document.getElementById('home-button'); | ||||
| 
 | ||||
| if(logInButton) { | ||||
|     logInButton.addEventListener('click', () => { | ||||
|  | @ -12,3 +13,9 @@ if(logOutButton) { | |||
|         window.location.href = "/auth/logout"; | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| if(homeButton) { | ||||
|     homeButton.addEventListener('click', () => { | ||||
|         window.location.href = '/'; | ||||
|     }); | ||||
| } | ||||
|  | @ -25,3 +25,6 @@ tr { | |||
|     flex-direction: row; | ||||
| } | ||||
| 
 | ||||
| #actions-div { | ||||
|     margin-left: auto; | ||||
| } | ||||
|  | @ -26,5 +26,8 @@ a { | |||
| 
 | ||||
| #actions-div { | ||||
|   display: flex; | ||||
|   margin-left: auto; | ||||
| } | ||||
| 
 | ||||
| #home-button { | ||||
|   margin-right: auto; | ||||
| } | ||||
|  | @ -3,7 +3,7 @@ var router = express.Router(); | |||
| 
 | ||||
| /* GET home page. */ | ||||
| router.get('/', function(req, res, next) { | ||||
|   res.render('index', { title: 'View Scores', userLoggedIn: !!req.user }); | ||||
|   res.render('index', { title: 'View Scores', userLoggedIn: !!req.user, hideHomeButton: true }); | ||||
| }); | ||||
| 
 | ||||
| module.exports = router; | ||||
|  |  | |||
|  | @ -8,6 +8,8 @@ html | |||
|   body | ||||
|     div#mobile-view | ||||
|       div#actions-div | ||||
|         if !hideHomeButton | ||||
|           button#home-button Home | ||||
|         block actions  | ||||
|         if userLoggedIn | ||||
|           button#logout-button Log out | ||||
|  |  | |||
		Reference in a new issue