Ajout d'un menu, et correction des liens du breadcrumbs
authorPA Parent <paparent@paparent.me>
Tue, 13 Dec 2011 15:42:32 +0000 (10:42 -0500)
committerPA Parent <paparent@paparent.me>
Tue, 13 Dec 2011 15:42:32 +0000 (10:42 -0500)
project/menu.py [new file with mode: 0644]
project/rh/templates/rh/rapports/base.html
project/settings.py

diff --git a/project/menu.py b/project/menu.py
new file mode 100644 (file)
index 0000000..db73ace
--- /dev/null
@@ -0,0 +1,44 @@
+"""
+This file was generated with the custommenu management command, it contains
+the classes for the admin menu, you can customize this class as you want.
+
+To activate your custom menu add the following to your settings.py::
+    ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
+"""
+
+from django.core.urlresolvers import reverse
+from django.utils.translation import ugettext_lazy as _
+
+from admin_tools.menu import items, Menu
+
+
+class CustomMenu(Menu):
+    """
+    Custom Menu for project admin site.
+    """
+    def __init__(self, **kwargs):
+        Menu.__init__(self, **kwargs)
+        self.children += [
+            items.MenuItem(_('Dashboard'), reverse('admin:index')),
+            items.Bookmarks(),
+            items.AppList(
+                _('Applications'),
+                exclude=('django.contrib.*',)
+            ),
+            items.MenuItem('Rapports',
+                           children=[
+                               items.MenuItem('Rapport des postes', reverse('rhr_postes')),
+                               items.MenuItem('Rapport des contrats', reverse('rhr_contrats')),
+                           ]
+                          ),
+            items.AppList(
+                _('Administration'),
+                models=('django.contrib.*',)
+            )
+        ]
+
+    def init_with_context(self, context):
+        """
+        Use this method if you need to access the request context.
+        """
+        return super(CustomMenu, self).init_with_context(context)
index 3ad3388..cc42093 100644 (file)
@@ -10,8 +10,8 @@
 
 {% block breadcrumbs %}{% if not is_popup %}
 <div class="breadcrumbs">
-       <a href="../../../">{% trans "Home" %}</a> &rsaquo;
-       <a href="../../">Rh</a> &rsaquo;
+       <a href="../../">{% trans "Home" %}</a> &rsaquo;
+       <a href="../">Rh</a> &rsaquo;
        {% block nomrapport %}{% endblock %}
 </div>
 {% endif %}{% endblock %}
index f302ef6..ce54083 100644 (file)
@@ -112,6 +112,7 @@ TEMPLATE_DIRS = (
 
 ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard'
 ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard'
+ADMIN_TOOLS_MENU = 'project.menu.CustomMenu'
 
 AJAX_LOOKUP_CHANNELS = {
     'responsables' : ('dae.catalogues', 'Responsable'),