changeset 102:91a229ee9a84

Bootstrap: made the navbar a template tag. Navbar now active on contact and mailing list pages.
author Brian Neal <bgneal@gmail.com>
date Wed, 16 Oct 2013 21:20:03 -0500
parents 0a8942306b04
children 90ba44881a69
files core/__init__.py core/models.py core/templatetags/__init__.py core/templatetags/core_tags.py madeira/settings/base.py madeira/templates/band/contact.html madeira/templates/base.html madeira/templates/core/navbar_tag.html madeira/templates/email_list/subscribe_form.html madeira/templates/email_list/subscribe_request.html madeira/templates/email_list/subscribed.html madeira/templates/email_list/unsubscribe_request.html madeira/templates/email_list/unsubscribed.html
diffstat 11 files changed, 82 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/models.py	Wed Oct 16 21:20:03 2013 -0500
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/templatetags/core_tags.py	Wed Oct 16 21:20:03 2013 -0500
@@ -0,0 +1,10 @@
+"""Core tags, common to many application templates."""
+from django import template
+
+
+register = template.Library()
+
+
+@register.inclusion_tag('core/navbar_tag.html')
+def navbar(active_tab):
+    return {'active_tab': active_tab}
--- a/madeira/settings/base.py	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/settings/base.py	Wed Oct 16 21:20:03 2013 -0500
@@ -102,6 +102,7 @@
     'localflavor',
     'articles',
     'band',
+    'core',
     'email_list',
     'gigs',
     'mp3',
--- a/madeira/templates/band/contact.html	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/templates/band/contact.html	Wed Oct 16 21:20:03 2013 -0500
@@ -1,5 +1,7 @@
 {% extends 'base.html' %}
+{% load core_tags %}
 {% block title %}The Madeira | Contact{% endblock %}
+{% block navblock %}{% navbar 'contact' %}{% endblock %}
 {% block content %}
 <h1>Madeira Contact Info</h1>
 <p>For general band inquiries, send email to: <a href="mailto:themadeira@themadeira.net">themadeira@themadeira.net</a>.</p>
--- a/madeira/templates/base.html	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/templates/base.html	Wed Oct 16 21:20:03 2013 -0500
@@ -15,62 +15,7 @@
 <link rel="shortcut icon" href="{{ STATIC_URL }}images/favicon.ico" />
 </head>
 <body>
-
-<div class="navbar navbar-inverse navbar-fixed-top">
-   <div class="container">
-      <div class="navbar-header">
-         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
-            <span class="icon-bar"></span>
-            <span class="icon-bar"></span>
-            <span class="icon-bar"></span>
-         </button>
-         <a class="navbar-brand" href="{% url 'home' %}">The Madeira</a>
-      </div>
-      <div class="navbar-collapse collapse">
-         <ul class="nav navbar-nav">
-            <li class="dropdown">
-               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Updates <b class="caret"></b></a>
-               <ul class="dropdown-menu">
-                  <li><a href="{% url 'news-index' %}">News</a></li>
-                  <li><a href="{% url 'articles-index' %}">Press</a></li>
-               </ul>
-            </li>
-            <li class="dropdown">
-               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Shows <b class="caret"></b></a>
-               <ul class="dropdown-menu">
-                  <li><a href="{% url 'gigs-index' %}">Shows</a></li>
-                  <li><a href="{% url 'gigs-flyers' %}">Flyers</a></li>
-               </ul>
-            </li>
-            <li><a href="{% url 'band-bio' %}">Bio</a></li>
-            <li class="dropdown">
-               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Media <b class="caret"></b></a>
-               <ul class="dropdown-menu">
-                  <li><a href="{% url 'band-photo_index' %}">Photos</a></li>
-                  <li><a href="{% url 'mp3-index' %}">Songs</a></li>
-                  <li><a href="{% url 'videos-index' %}">Videos</a></li>
-               </ul>
-            </li>
-            <li><a href="{% url 'band-buy' %}">Buy</a></li>
-            <li class="dropdown">
-               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contact <b class="caret"></b></a>
-               <ul class="dropdown-menu">
-                  <li><a href="{% url 'band-contact' %}">Email</a></li>
-                  <li><a href="{% url 'email_list-main' %}">Mailing List</a></li>
-               </ul>
-            </li>
-            <li class="dropdown">
-               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social <b class="caret"></b></a>
-               <ul class="dropdown-menu">
-                  <li><a href="http://facebook.com/themadeira">Facebook</a></li>
-                  <li><a href="http://www.youtube.com/user/TheMadeiraSurf">YouTube</a></li>
-               </ul>
-            </li>
-         </ul>
-      </div>
-   </div>
-</div>
-
+{% block navblock %}{% endblock %}
 <header>
    <div class="container">
       <img src="{{ STATIC_URL }}images/header-logo.jpg" class="img-responsive" alt="Madeira Logo" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/madeira/templates/core/navbar_tag.html	Wed Oct 16 21:20:03 2013 -0500
@@ -0,0 +1,55 @@
+<div class="navbar navbar-inverse navbar-fixed-top">
+   <div class="container">
+      <div class="navbar-header">
+         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+         </button>
+         <a class="navbar-brand" href="{% url 'home' %}">The Madeira</a>
+      </div>
+      <div class="navbar-collapse collapse">
+         <ul class="nav navbar-nav">
+            <li{% if active_tab == "home" %} class="active"{% endif %}><a href="{% url 'home' %}">Home</a></li>
+            <li class="dropdown">
+               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Updates <b class="caret"></b></a>
+               <ul class="dropdown-menu">
+                  <li{% if active_tab == "news" %} class="active"{% endif %}><a href="{% url 'news-index' %}">News</a></li>
+                  <li{% if active_tab == "press" %} class="active"{% endif %}><a href="{% url 'articles-index' %}">Press</a></li>
+               </ul>
+            </li>
+            <li class="dropdown">
+               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Shows <b class="caret"></b></a>
+               <ul class="dropdown-menu">
+                  <li{% if active_tab == "gigs" %} class="active"{% endif %}><a href="{% url 'gigs-index' %}">Shows</a></li>
+                  <li{% if active_tab == "flyers" %} class="active"{% endif %}><a href="{% url 'gigs-flyers' %}">Flyers</a></li>
+               </ul>
+            </li>
+            <li><a href="{% url 'band-bio' %}">Bio</a></li>
+            <li class="dropdown">
+               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Media <b class="caret"></b></a>
+               <ul class="dropdown-menu">
+                  <li{% if active_tab == "photos" %} class="active"{% endif %}><a href="{% url 'band-photo_index' %}">Photos</a></li>
+                  <li{% if active_tab == "songs" %} class="active"{% endif %}><a href="{% url 'mp3-index' %}">Songs</a></li>
+                  <li{% if active_tab == "videos" %} class="active"{% endif %}><a href="{% url 'videos-index' %}">Videos</a></li>
+               </ul>
+            </li>
+            <li{% if active_tab == "buy" %} class="active"{% endif %}><a href="{% url 'band-buy' %}">Buy</a></li>
+            <li class="dropdown{% if active_tab == "contact" or active_tab == "mail" %} active{% endif %}">
+               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Contact <b class="caret"></b></a>
+               <ul class="dropdown-menu">
+                  <li{% if active_tab == "contact" %} class="active"{% endif %}><a href="{% url 'band-contact' %}">Email</a></li>
+                  <li{% if active_tab == "mail" %} class="active"{% endif %}><a href="{% url 'email_list-main' %}">Mailing List</a></li>
+               </ul>
+            </li>
+            <li class="dropdown">
+               <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social <b class="caret"></b></a>
+               <ul class="dropdown-menu">
+                  <li><a href="http://facebook.com/themadeira">Facebook</a></li>
+                  <li><a href="http://www.youtube.com/user/TheMadeiraSurf">YouTube</a></li>
+               </ul>
+            </li>
+         </ul>
+      </div>
+   </div>
+</div>
--- a/madeira/templates/email_list/subscribe_form.html	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/templates/email_list/subscribe_form.html	Wed Oct 16 21:20:03 2013 -0500
@@ -1,5 +1,7 @@
 {% extends 'base.html' %}
+{% load core_tags %}
 {% block title %}The Madeira | Mailing List{% endblock %}
+{% block navblock %}{% navbar 'mail' %}{% endblock %}
 {% block content %}
 <h1>Madeira Mailing List</h1>
 <p>Get on the Madeira mailing list to receive updates about upcoming shows, releases, and website updates.
--- a/madeira/templates/email_list/subscribe_request.html	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/templates/email_list/subscribe_request.html	Wed Oct 16 21:20:03 2013 -0500
@@ -1,5 +1,7 @@
 {% extends 'base.html' %}
+{% load core_tags %}
 {% block title %}The Madeira | Mailing List Subscription Confirmation{% endblock %}
+{% block navblock %}{% navbar 'mail' %}{% endblock %}
 {% block content %}
 <h1>Madeira Mailing List Subscription Confirmation</h1>
 <p>
--- a/madeira/templates/email_list/subscribed.html	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/templates/email_list/subscribed.html	Wed Oct 16 21:20:03 2013 -0500
@@ -1,5 +1,7 @@
 {% extends 'base.html' %}
+{% load core_tags %}
 {% block title %}The Madeira | Mailing List Subscription Confirmation{% endblock %}
+{% block navblock %}{% navbar 'mail' %}{% endblock %}
 {% block content %}
 <h1>Madeira Mailing List Subscription Confirmation</h1>
 <p>Congratulations! You have been successfully added to our email list.</p>
--- a/madeira/templates/email_list/unsubscribe_request.html	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/templates/email_list/unsubscribe_request.html	Wed Oct 16 21:20:03 2013 -0500
@@ -1,5 +1,7 @@
 {% extends 'base.html' %}
+{% load core_tags %}
 {% block title %}The Madeira | Mailing List Unsubscribe Confirmation{% endblock %}
+{% block navblock %}{% navbar 'mail' %}{% endblock %}
 {% block content %}
 <h1>Madeira Mailing List Unsubscribe Confirmation</h1>
 <p>
--- a/madeira/templates/email_list/unsubscribed.html	Wed Oct 16 20:32:58 2013 -0500
+++ b/madeira/templates/email_list/unsubscribed.html	Wed Oct 16 21:20:03 2013 -0500
@@ -1,5 +1,7 @@
 {% extends 'base.html' %}
+{% load core_tags %}
 {% block title %}The Madeira | Mailing List Subscription Removal{% endblock %}
+{% block navblock %}{% navbar 'mail' %}{% endblock %}
 {% block content %}
 <h1>Madeira Mailing List Subscription Removal</h1>
 <p>You have been successfully removed from our email list.</p>