From d1d43b32d7226192f5dfdd20fa1c4319ba5892f4 Mon Sep 17 00:00:00 2001 From: Vince Yuan Date: Wed, 24 Apr 2013 22:43:39 +0800 Subject: [PATCH 1/4] enabling signup --- views/topbar.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/topbar.jade b/views/topbar.jade index 4ee1f21..01b1baf 100644 --- a/views/topbar.jade +++ b/views/topbar.jade @@ -19,7 +19,7 @@ div.navbar.navbar-fixed-top 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") From 828b859c3710ab1406e67ab0147f464e14c672af Mon Sep 17 00:00:00 2001 From: Vince Yuan Date: Wed, 24 Apr 2013 22:49:56 +0800 Subject: [PATCH 2/4] enabling active page on top bar for About and Contact. --- routes/index.js | 6 +++--- views/topbar.jade | 24 ++++++++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/routes/index.js b/routes/index.js index 76ff419..b482fd7 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'); @@ -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/topbar.jade b/views/topbar.jade index 01b1baf..02c1f84 100644 --- a/views/topbar.jade +++ b/views/topbar.jade @@ -4,12 +4,24 @@ 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(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='/about') About + -if(activePage == 'contact') + li.active + a(href='/contact') Contact + -else + li + a(href='/contact') Contact -if(session.user) li a(href='/admin') Admin From 13276cf18608b1bccedeef3308ba9a137e6b4341 Mon Sep 17 00:00:00 2001 From: Vince Yuan Date: Wed, 24 Apr 2013 22:52:22 +0800 Subject: [PATCH 3/4] adding title to signupErrorModal to make X button look better. Adding 2013 to footer. --- views/footer.jade | 2 +- views/signupErrorModal.jade | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 ! From 180e67b1d53f56877b680bc9ea643bf6bd64d0f4 Mon Sep 17 00:00:00 2001 From: Vince Yuan Date: Fri, 26 Apr 2013 19:27:14 +0800 Subject: [PATCH 4/4] fixed admin page --- routes/index.js | 2 +- views/topbar.jade | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/routes/index.js b/routes/index.js index b482fd7..100920a 100644 --- a/routes/index.js +++ b/routes/index.js @@ -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('/'); } diff --git a/views/topbar.jade b/views/topbar.jade index 02c1f84..f01b5e9 100644 --- a/views/topbar.jade +++ b/views/topbar.jade @@ -23,8 +23,12 @@ div.navbar.navbar-fixed-top li a(href='/contact') Contact -if(session.user) - li - a(href='/admin') Admin + -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