Navbar active class added depending on which URL you visit

This commit is contained in:
Sahat Yalkabov
2013-11-18 01:13:52 -05:00
parent f291954f13
commit 8e637defc5
5 changed files with 7725 additions and 14 deletions

View File

@ -1,5 +1,8 @@
exports.index = function(req, res){ exports.index = function(req, res){
res.render('index', { user: req.user }); res.render('index', {
user: req.user,
title: 'Home'
});
}; };
exports.partials = function (req, res) { exports.partials = function (req, res) {

View File

@ -9,11 +9,16 @@ exports.account = function(req, res) {
}; };
exports.getLogin = function(req, res) { exports.getLogin = function(req, res) {
res.render('login', { user: req.user, message: req.session.messages }); res.render('login', {
title: 'Login',
user: req.user,
message: req.session.messages
});
}; };
exports.getSignup = function(req, res) { exports.getSignup = function(req, res) {
res.render('signup', { res.render('signup', {
title: 'Create Account',
user: req.user, user: req.user,
message: req.session.messages message: req.session.messages
}); });

7705
public/css/flat-ui.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
!!! 5 doctype 5
html(lang='en') html
head head
meta(charset='utf-8') meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge') meta(http-equiv='X-UA-Compatible', content='IE=edge')
@ -21,19 +21,17 @@ html(lang='en')
a.navbar-brand(href='/') Project name a.navbar-brand(href='/') Project name
.collapse.navbar-collapse .collapse.navbar-collapse
ul.nav.navbar-nav ul.nav.navbar-nav
li.active li(class=title=='Home'?'active':undefined)
a(href='/') Home a(href='/') Home
li li(class=title=='About'?'active':undefined)
a(href='#about') About a(href='#about') About
li li(class=title=='Contact'?'active':undefined)
a(href='#contact') Contact a(href='#contact') Contact
ul.nav.navbar-nav.navbar-right ul.nav.navbar-nav.navbar-right
li li(class=title=='Login'?'active':undefined)
a(href='/login') Login a(href='/login') Login
li li(class=title=='Create Account'?'active':undefined)
a(href='/signup') Create Account a(href='/signup') Create Account
.container .container
block content block content
script(src='/js/lib/jquery.js') script(src='/js/lib/jquery.js')

View File

@ -12,7 +12,7 @@ block content
.col-xs-6.col-sm-6.col-md-6 .col-xs-6.col-sm-6.col-md-6
a.btn.btn-lg.btn-primary.btn-block(href='#') Facebook a.btn.btn-lg.btn-primary.btn-block(href='#') Facebook
.col-xs-6.col-sm-6.col-md-6 .col-xs-6.col-sm-6.col-md-6
a.btn.btn-lg.btn-info.btn-block(href='#') Google a.btn.btn-lg.btn-danger.btn-block(href='#') Google
.login-or .login-or
hr.hr-or hr.hr-or
span.span-or or span.span-or or
@ -28,5 +28,5 @@ block content
label label
input(type='checkbox') input(type='checkbox')
| Remember me | Remember me
button.btn.btn.btn-primary(type='submit') button.btn.btn.btn-success(type='submit')
| Log In | Log In