Skip to content

Commit

Permalink
add navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Rauscher committed Oct 3, 2013
1 parent 44ad8d9 commit 4ce3d1c
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 9 deletions.
5 changes: 5 additions & 0 deletions accounting/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from vpanel2.connector import addUrlNamespace, addNavigation
import urls

addUrlNamespace('accounting/', 'accounting', urls.urlpatterns)
addNavigation("euro", "Buchhaltung", dropdown = [ {"url": "accounting:journals", "label": "Kontenrahmen"}, {"url": "accounting:reports", "label": "Reports"} ])
4 changes: 4 additions & 0 deletions crm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from vpanel2.connector import addUrlNamespace
import urls

addUrlNamespace('crm/', 'crm', urls.urlpatterns)
5 changes: 5 additions & 0 deletions crm_contacts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from vpanel2.connector import addUrlNamespace, addNavigation
import crm_contacts.urls

addUrlNamespace('crm_contacts/', 'crm_contacts', crm_contacts.urls.urlpatterns)
addNavigation('phone-alt', "Kontakte", dropdown = [ {"url": "crm_contacts:start", "label": "Alle"}, {"url": "crm_contacts:start", "label": "Mitglieder"} ])
3 changes: 3 additions & 0 deletions crm_document/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from vpanel2.connector import addNavigation

addNavigation("paperclip", "Dokumente", url = "dashboard")
5 changes: 5 additions & 0 deletions vpanel2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from connector import addNavigation

addNavigation("dashboard", "Dashboard", url = "dashboard")
addNavigation("user", "Benutzer", url = "dashboard")
addNavigation("tags", "Gruppen", url = "dashboard")
17 changes: 14 additions & 3 deletions vpanel2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@
# 'django.template.loaders.eggs.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"vpanel2.connector.NavigationContext",
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down Expand Up @@ -130,12 +141,12 @@
# 'django.contrib.admindocs',
# Needed for the TemplateLoader
'vpanel2',
'crm',
'accounting',
'crm_document',
'crm_contacts',
'crm_member',
'crm_document',
'crm_accounting',
'accounting',
'crm',
)

# A sample logging configuration. The only tangible logging
Expand Down
27 changes: 22 additions & 5 deletions vpanel2/templates/vpanel2/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,37 @@
<body>
<nav class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<a href="{% url "home" %}" class="navbar-brand">VPanel2</a>
<a href="{% url "dashboard" %}" class="navbar-brand"><span style="color: #F7931E; font-weight: bold;">V</span>Panel2</a>
<ul class="nav navbar-nav">
{% for nav in navigation %}
{% if nav.url != "" %}
<li><a href="{% url nav.url %}"><i class="glyphicon glyphicon-{{nav.icon}}" title="{{nav.label}}"></i> {{nav.label}}</a></li>
{% elif nav.dropdown|length > 0 %}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-{{nav.icon}}" title="{{nav.label}}"></i> {{nav.label}}</a>
<ul class="dropdown-menu">
{% for subNav in nav.dropdown %}
<li><a href="{% url subNav.url %}">{{subNav.label}}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
<div class="navbar-right">
{% if user.is_authenticated %}
Angemeldet als {{ user.username }}
<a href="{% url "userauth_password_change" %}" class="btn btn-default navbar-btn">Passwort ändern</a>
<a href="{% url "userauth_logout" %}" class="btn btn-default navbar-btn">Logout</a>
<p class="navbar-text">{{ user.username }}</p>
<a href="{% url "userauth_password_change" %}" class="btn btn-default navbar-btn"><i class="glyphicon glyphicon-wrench"></i></a>
<a href="{% url "userauth_logout" %}" class="btn btn-default navbar-btn"><i class="glyphicon glyphicon-log-out"></i></a>
{% else %}
<a href="{% url "userauth_login" %}" class="btn btn-default navbar-btn">Login</a>
<a href="{% url "userauth_login" %}" class="btn btn-default navbar-btn"><i class="glyphicon glyphicon-log-in"></i></a>
{% endif %}
</div>
</div>
</nav>

<div class="container">
{% block toolbar %}{% endblock %}
{% block content %}{% endblock %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion vpanel2/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

url(r'^$', login_required(TemplateView.as_view(template_name = "vpanel2/dashboard.html")), name="home"),
url(r'^$', login_required(TemplateView.as_view(template_name = "vpanel2/dashboard.html")), name="dashboard"),
url(r'^admin/', include(admin.site.urls)),

url(r'^login/', django.contrib.auth.views.login, {'template_name': "vpanel2/login.html"}, name="userauth_login"),
Expand Down

0 comments on commit 4ce3d1c

Please sign in to comment.