Add "Home" button for navigation
parent
872397d05e
commit
3201ffb2a9
|
@ -1,5 +1,6 @@
|
||||||
const logInButton = document.getElementById('login-button');
|
const logInButton = document.getElementById('login-button');
|
||||||
const logOutButton = document.getElementById('logout-button');
|
const logOutButton = document.getElementById('logout-button');
|
||||||
|
const homeButton = document.getElementById('home-button');
|
||||||
|
|
||||||
if(logInButton) {
|
if(logInButton) {
|
||||||
logInButton.addEventListener('click', () => {
|
logInButton.addEventListener('click', () => {
|
||||||
|
@ -11,4 +12,10 @@ if(logOutButton) {
|
||||||
logOutButton.addEventListener('click', () => {
|
logOutButton.addEventListener('click', () => {
|
||||||
window.location.href = "/auth/logout";
|
window.location.href = "/auth/logout";
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(homeButton) {
|
||||||
|
homeButton.addEventListener('click', () => {
|
||||||
|
window.location.href = '/';
|
||||||
|
});
|
||||||
}
|
}
|
|
@ -25,3 +25,6 @@ tr {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#actions-div {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
|
@ -26,5 +26,8 @@ a {
|
||||||
|
|
||||||
#actions-div {
|
#actions-div {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: auto;
|
}
|
||||||
|
|
||||||
|
#home-button {
|
||||||
|
margin-right: auto;
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ var router = express.Router();
|
||||||
|
|
||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/', function(req, res, next) {
|
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;
|
module.exports = router;
|
||||||
|
|
|
@ -8,6 +8,8 @@ html
|
||||||
body
|
body
|
||||||
div#mobile-view
|
div#mobile-view
|
||||||
div#actions-div
|
div#actions-div
|
||||||
|
if !hideHomeButton
|
||||||
|
button#home-button Home
|
||||||
block actions
|
block actions
|
||||||
if userLoggedIn
|
if userLoggedIn
|
||||||
button#logout-button Log out
|
button#logout-button Log out
|
||||||
|
|
Reference in New Issue