diff --git a/routes/index.js b/routes/index.js index 76ff419..100920a 100644 --- a/routes/index.js +++ b/routes/index.js @@ -44,7 +44,7 @@ module.exports = function(app){ logger.log('Serving request for url [GET]' + req.route.path) Post.getAll(function(err, allPosts){ if(!err && allPosts){ - res.render('index', {'allPosts' : allPosts}); + res.render('index', {'allPosts' : allPosts, 'activePage': 'home'}); }else{ util.log('Error fetching posts from database : ' + err); res.render('error'); @@ -148,7 +148,7 @@ module.exports = function(app){ app.get('/admin', getAllMeta, function(req, res){ util.log('Serving request for url [GET] ' + req.route.path); if(req.session.user){ - res.render('post', {'postsList' : req.postsList}); + res.render('post', {'postsList' : req.postsList, 'activePage': 'admin'}); }else{ res.redirect('/'); } @@ -255,11 +255,11 @@ module.exports = function(app){ app.get('/contact', function(req, res){ util.log('Serving request for url[GET] ' + req.route.path); - res.render('contact'); + res.render('contact', {'activePage': 'contact'}); }); app.get('/about', function(req, res){ util.log('Serving request for url[GET] ' + req.route.path); - res.render('about'); + res.render('about', {'activePage' : 'about'}); }); }; diff --git a/views/footer.jade b/views/footer.jade index 6df9edc..dc6c20f 100644 --- a/views/footer.jade +++ b/views/footer.jade @@ -1,3 +1,3 @@ div#footer.footer - p © nodeblox 2011 + p © nodeblox 2011-2013 script(data-main="/js/main", src="/js/require.js") diff --git a/views/signupErrorModal.jade b/views/signupErrorModal.jade index aacf180..31d7e12 100644 --- a/views/signupErrorModal.jade +++ b/views/signupErrorModal.jade @@ -1,6 +1,7 @@ div#signup-error-modal.modal.hide div.modal-header a.close(href='#', data-dismiss="modal") x + h3 Error div.modal-body div.alert.alert-error strong Oh snap ! diff --git a/views/topbar.jade b/views/topbar.jade index 4ee1f21..f01b5e9 100644 --- a/views/topbar.jade +++ b/views/topbar.jade @@ -4,22 +4,38 @@ div.navbar.navbar-fixed-top a.brand(href='/') nodeBlox div.nav-collapse ul.nav - li.active - a(href='/') Home - li - a(href='/about') About - li - a(href='/contact') Contact - -if(session.user) + -if(activePage == 'home') + li.active + a(href='/') Home + -else + li + a(href='/') Home + -if(activePage == 'about') + li.active + a(href='/about') About + -else li - a(href='/admin') Admin + a(href='/about') About + -if(activePage == 'contact') + li.active + a(href='/contact') Contact + -else + li + a(href='/contact') Contact + -if(session.user) + -if(activePage == 'admin') + li.active + a(href='/admin') Admin + -else + li + a(href='/admin') Admin -if(session.user) div#logoutsection.pull-right a#logout-btn.btn.btn-info.pull-right.top-bar-form-button(href='/logout') Logout p#loginprompt.pull-right.login-prompt #{session.user.username} small logged In -else - //a#signup-btn.btn.pull-right.top-bar-form-button(href='#signup-modal', data-toggle="modal") Sign Up + a#signup-btn.btn.pull-right.top-bar-form-button(href='#signup-modal', data-toggle="modal") Sign Up form.pull-right.form-horizontal.top-bar-form(method="post", id="loginForm") input.input-small.top-bar-form-textbox(id="username", type="text", name="User", placeholder="Username") input.input-small.top-bar-form-textbox(id="password", type="password", name="Password", placeholder="Password")