Fixed active links in header

master
Keith Irwin 2017-05-22 22:32:51 -04:00
parent c1ca9b3f3b
commit f552d36710
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
8 changed files with 45 additions and 29 deletions

View File

@ -9,6 +9,7 @@ router.get('/', mw.ensureAdmin, (req,res)=>{
User.find({}).sort({lastLogin:-1})
.then( (found)=>{
res.render('admin', {
active: 'admin',
noFooter: '1',
users: found,
total: found.length

View File

@ -13,17 +13,18 @@ module.exports = router
// Index
.get('/', (req,res,next)=>{
res.render('index');
res.render('index', {active:'home'});
})
// Help
.get('/help', (req,res)=>{
res.render('help');
res.render('help', {active:'help'});
})
// Contact
.get('/contact', (req,res)=>{
res.render('contact',{
active: 'contact',
sitekey: env.recaptchaSitekey
});
})
@ -85,10 +86,10 @@ module.exports = router
// Terms of Service and Privacy Policy
.get('/terms', (req,res)=>{
res.render('terms');
res.render('terms', {active:'terms'});
})
.get('/privacy', (req,res)=>{
res.render('privacy');
res.render('privacy', {active:'privacy'});
})
// robots.txt
@ -100,6 +101,7 @@ module.exports = router
})
// favicon.ico
//TODO: Just serve it
.get('/favicon.ico', (req,res)=>{
res.redirect('/static/img/icon/by/16-32-48.ico');
})

View File

@ -24,6 +24,7 @@ router.get('/:slug?', (req,res,next)=>{
if (!mapuser){ next(); } //404
else {
res.render('map', {
active:(req.user.id===mapuser.id)?'map':'',
mapuser: mapuser,
mapApi: env.googleMapsAPI,
user: req.user,

View File

@ -25,7 +25,7 @@ router.route('/')
// Get settings form
.get( (req,res)=>{
res.render('settings');
res.render('settings', {active:'settings'});
} )
// Set new settings

View File

@ -71,10 +71,10 @@ const
/* Routes */ {
// Static files (keep this before setting default locals)
// Static files (keep this before default locals)
app.use('/static', express.static( __dirname+'/static', {dotfiles:'allow'} ));
// Set default locals available to all views (keep this after static files)
// Default locals available to all views (keep this after static files)
app.get( '*', (req,res,next)=>{
// Path for redirects

View File

@ -6,7 +6,9 @@ header {
top: 0; left: 0;
width: 100%;
z-index: 200;
} header a:hover, header a:focus {
}
header a:hover,
header a:focus {
color: #fbc93d;
}
@ -20,15 +22,18 @@ header .logo {
font-size: 22px;
line-height: 30px;
margin: 0;
} header .logo a {
}
header .logo a {
color:inherit;
font:inherit;
text-decoration:inherit;
cursor: pointer;
} header .logo img {
}
header .logo img {
margin-right: 10px;
vertical-align: middle;
} header .logo:hover {
}
header .logo:hover {
text-decoration: none;
background: rgba(255,255,255,0.1);
}
@ -36,25 +41,33 @@ header .logo {
/* Navigation */
header nav {
float: right;
} header nav ul {
}
header nav ul {
padding: 0;
margin: 0;
} header nav ul li {
}
header nav ul li {
display: inline-block;
float: left;
} header nav ul li a, header nav ul li span {
}
header nav ul li a,
header nav ul li span {
text-decoration:inherit;
display: inline-block;
padding: 15px 20px;
color: #fff;
transition: 100ms;
} header nav ul li a:hover,
header nav ul li a:focus,
header nav ul li a.active,
header .logo:hover {
}
header nav ul li a:hover,
header nav ul li a:focus {
text-decoration: none;
background: rgba(255,255,255,0.1);
}
header nav ul li a.active {
color: #fbc93d;
pointer-events: none;
cursor: default;
}
/* Hamburger */
header .hamburger {

View File

@ -18,8 +18,8 @@
<input name="subject" id='subject' type="text" maxlength="160" value="{{subject}}" placeholder="Subject">
<textarea name="message" id='message' rows="10" maxlength="5000" placeholder="Message" required>{{message}}</textarea>
<input name="name" id='name' type="text" maxlength="160" value="{{name}}" placeholder="Name">
<input name="email" id='email' type="email" maxlength="160" value="{{email}}" placeholder="Email" required>
<input name="name" id='name' type="text" maxlength="160" value="{{name}}" placeholder="Your name">
<input name="email" id='email' type="email" maxlength="160" value="{{email}}" placeholder="Your email" required>
<button class='g-recaptcha main btn' data-sitekey="{{sitekey}}" data-callback="onSubmit">Submit</button>
</form>

View File

@ -12,20 +12,19 @@
<!-- Navigation -->
<nav id='navigation'><ul>
<li><a href="/">About</a></li>
<li><a href="/contact">Contact</a></li>
{% if active!='home' %}<li><a href="/">About</a></li>{% endif %}
<li><a href="/contact"{% if active=='contact' %} class='active'{% endif %}>Contact</a></li>
{% if user %}
<li><a href="/map">Map</a></li>
<li><a href="/settings">Settings</a></li>
<li><a href="/map"{% if active=='map' %} class='active'{% endif %}>Map</a></li>
<li><a href="/settings"{% if active=='settings' %} class='active'{% endif %}>Settings</a></li>
{% endif %}
<li><a href="/help">Help</a></li>
<li><a href="/help"{% if active=='help' %} class='active'{% endif %}>Help</a></li>
{% if user %}
{% if user.isAdmin %}<li><a href="/admin">Admin</a></li>{% endif %}
{% if user.isAdmin %}<li><a href="/admin"{% if active=='admin' %} class='active'{% endif %}>Admin</a></li>{% endif %}
<li><a href="/logout">Logout</a></li>
{% else %}
<li><a href="/map/keith">Demo</a></li>
<li><a href="/login#login">Login</a></li>
<li><a href="/login#signup">Join</a></li>
<li><a href="/map/keith"{% if active=='demo' %} class='active'{% endif %}>Demo</a></li>
<li><a href="/login">Login / join</a></li>
{% endif %}
</ul></nav>