Skip to content

Commit

Permalink
Navigation is now configurable in settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederik De Bleser committed Sep 25, 2008
1 parent b5918ad commit 5682b78
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
9 changes: 9 additions & 0 deletions settings.py
Expand Up @@ -44,6 +44,14 @@
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'util.context.primary_links_to_context',
)

ROOT_URLCONF = 'projecthub.urls'

TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, 'templates'),)
Expand All @@ -62,6 +70,7 @@
'apps.weblog',
'apps.forum',
'apps.accounts',
'util',
'dmigrations',
)

Expand Down
6 changes: 6 additions & 0 deletions settings_local_example.py
Expand Up @@ -9,3 +9,9 @@
DATABASE_HOST = ''
DATABASE_PORT = ''

PRIMARY_LINKS = (
('Home', '/'),
('Download', '/download/'),
('Documentation', '/documentation/'),
('Weblog', '/weblog/'),
('Forum', '/forum/'))
10 changes: 3 additions & 7 deletions templates/base.html
Expand Up @@ -22,13 +22,9 @@
{% endif %}
</div>
<ul id="nav">
<li class="first"><a rel="home" href="/">Home</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/documentation/">Documentation</a></li>
<li><a href="/repository/">Repository</a></li>
<li><a href="/weblog/">Weblog</a></li>
<li><a href="/forum/">Forum</a></li>
<li><a href="http://dev.gravital.net/">Code</a></li>
{% for title,url in PRIMARY_LINKS %}
<li{% if forloop.first %} class="first"{% endif %}><a href="{{ url }}">{{ title }}</a></li>
{% endfor %}
</ul>
</div> <!-- END #header -->
<div id="main">
Expand Down
5 changes: 5 additions & 0 deletions util/context.py
@@ -0,0 +1,5 @@
from django.conf import settings

def primary_links_to_context(request):
"""Load navigation in the template"""
return {'PRIMARY_LINKS':settings.PRIMARY_LINKS}

0 comments on commit 5682b78

Please sign in to comment.