Add "Home" button for navigation

main
sudoer777 2021-11-26 12:46:16 -07:00
parent 872397d05e
commit 3201ffb2a9
5 changed files with 17 additions and 2 deletions

View File

@ -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', () => {
@ -11,4 +12,10 @@ if(logOutButton) {
logOutButton.addEventListener('click', () => {
window.location.href = "/auth/logout";
});
}
if(homeButton) {
homeButton.addEventListener('click', () => {
window.location.href = '/';
});
}

View File

@ -25,3 +25,6 @@ tr {
flex-direction: row;
}
#actions-div {
margin-left: auto;
}

View File

@ -26,5 +26,8 @@ a {
#actions-div {
display: flex;
margin-left: auto;
}
#home-button {
margin-right: auto;
}

View File

@ -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;

View File

@ -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