Mercurial > public > bravenewsurf
changeset 4:2698ff124e87
Created a template tag for displaying a Bootstrap CSS toolbar.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 28 Oct 2011 21:20:18 -0500 |
parents | 71f2941161e9 |
children | 04991ccaf30c |
files | bns_website/core/templatetags/__init__.py bns_website/core/templatetags/core_tags.py bns_website/static/css/base.css bns_website/templates/core/navbar_tag.html bns_website/templates/home.html |
diffstat | 4 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bns_website/core/templatetags/core_tags.py Fri Oct 28 21:20:18 2011 -0500 @@ -0,0 +1,13 @@ +""" +Miscellaneous template tags. + +""" +from django import template + + +register = template.Library() + + +@register.inclusion_tag('core/navbar_tag.html') +def navbar(active_tab): + return {'active_tab': active_tab}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bns_website/static/css/base.css Fri Oct 28 21:20:18 2011 -0500 @@ -0,0 +1,1 @@ +body { padding-top: 40px }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bns_website/templates/core/navbar_tag.html Fri Oct 28 21:20:18 2011 -0500 @@ -0,0 +1,16 @@ +{% load url from future %} +<div class="topbar" > +<div class="topbar-inner"> +<div class="container"> +<a class="brand" href="{% url 'home' %}">Brave New Surf</a> +<ul class="nav"> +<li {% if active_tab == "home" %}class="active"{% endif %}><a href="{% url 'home' %}">Home</a></li> +<li {% if active_tab == "bands" %}class="active"{% endif %}><a href="#">The Bands</a></li> +<li {% if active_tab == "music" %}class="active"{% endif %}><a href="#">Listen</a></li> +<li {% if active_tab == "reviews" %}class="active"{% endif %}><a href="#">Reviews</a></li> +<li {% if active_tab == "videos" %}class="active"{% endif %}><a href="#">Videos</a></li> +<li {% if active_tab == "buy" %}class="active"{% endif %}><a href="#">Buy</a></li> +</ul> +</div> +</div> +</div>
--- a/bns_website/templates/home.html Fri Oct 28 20:32:29 2011 -0500 +++ b/bns_website/templates/home.html Fri Oct 28 21:20:18 2011 -0500 @@ -1,5 +1,7 @@ {% extends 'base.html' %} +{% load core_tags %} {% block title %}Home{% endblock %} {% block content %} +{% navbar 'home' %} <h1>Welcome to The Brave New Surf!</h1> {% endblock %}