improved nav

This commit is contained in:
Arne Schauf 2013-09-28 12:06:26 +02:00
parent 2c6b84f59b
commit 0d628f35e0
4 changed files with 18 additions and 8 deletions

2
.gitignore vendored
View File

@ -4,4 +4,4 @@
local_settings.py
.idea/
.cache/
*.sqlite

View File

@ -1,6 +1,6 @@
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from main.views import HomeView
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name="base.html")),
url(r'^$', HomeView.as_view(), name="home"),
)

View File

@ -1 +1,11 @@
# Create your views here.
# -*- coding: utf-8 -*-
from django.views.generic import TemplateView
class HomeView(TemplateView):
template_name = "base.html"
def get_context_data(self, *args, **kwargs):
context = super(HomeView, self).get_context_data(*args, **kwargs)
context['nav_home'] = True
return context

View File

@ -22,13 +22,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">nsupdate.info</a>
<a class="navbar-brand" href="{% url 'home' %}">nsupdate.info</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li{% if nav_home %} class="active"{% endif %}><a href="{% url 'home' %}">Home</a></li>
<li{% if nav_about %} class="active"{% endif %}><a href="#about">About</a></li>
<li{% if nav_contact %} class="active"{% endif %}><a href="#contact">Contact</a></li>
</ul>
</div>
</div>