From 7f43054e0ea715efa26a070607d491a35ac04134 Mon Sep 17 00:00:00 2001 From: PA Parent Date: Tue, 6 Dec 2011 09:00:20 -0500 Subject: [PATCH] =?utf8?q?[#2380]=20R=C3=A9organisation=20des=20mod=C3=A8les?= =?utf8?q?=20dans=20le=20dashboard=20de=20l'app=20RH=20comment=20le=20princi?= =?utf8?q?pal?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- project/dashboard.py | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ project/settings.py | 1 + 2 files changed, 76 insertions(+) diff --git a/project/dashboard.py b/project/dashboard.py index 7ee06b8..6f9bc0a 100644 --- a/project/dashboard.py +++ b/project/dashboard.py @@ -77,3 +77,78 @@ class CustomIndexDashboard(Dashboard): # append a recent actions module self.children.append(modules.RecentActions(_('Recent Actions'), 5)) + + +class CustomAppIndexDashboard(AppIndexDashboard): + """ + Custom app index dashboard for project. + """ + + # we disable title because its redundant with the model list module + title = '' + + def __init__(self, *args, **kwargs): + AppIndexDashboard.__init__(self, *args, **kwargs) + + def init_with_context(self, context): + """ + Use this method if you need to access the request context. + """ + if self.app_title != 'Rh': + # append a model list module and a recent actions module + self.children += [ + modules.ModelList(self.app_title,self.models), + modules.RecentActions( + _('Recent Actions'), + include_list=self.get_app_content_types(), + limit=5 + ) + ] + + return + + # append an app list module for "Application" + self.children.append(modules.AppList( + _('Application'), + models=( + 'project.rh.models.AyantDroit', + 'project.rh.models.Dossier', + 'project.rh.models.Employe', + 'project.rh.models.Poste', + ), + )) + + # append an app list module for "Configuration" + self.children.append(modules.AppList( + _('Configuration'), + models=( + 'project.rh.models.Classement', + 'project.rh.models.Devise', + 'project.rh.models.FamilleEmploi', + 'project.rh.models.OrganismeBstg', + 'project.rh.models.Responsable', + 'project.rh.models.Service', + 'project.rh.models.Statut', + 'project.rh.models.TauxChange', + 'project.rh.models.TypeContrat', + 'project.rh.models.TypePoste', + 'project.rh.models.TypeRevalorisation', + 'project.rh.models.TypeRemuneration', + 'project.rh.models.ValeurPoint', + ), + )) + + # append an app list module for "Inter-systèmes" + self.children.append(modules.AppList( + _(u'Inter-systèmes'), + models=( + 'project.rh.models.ResponsableImplantation', + ), + )) + + # append a recent actions module + self.children.append(modules.RecentActions( + _('Recent Actions'), + include_list=self.get_app_content_types(), + limit=5 + )) diff --git a/project/settings.py b/project/settings.py index e6b53bf..f302ef6 100644 --- a/project/settings.py +++ b/project/settings.py @@ -111,6 +111,7 @@ TEMPLATE_DIRS = ( ADMIN_TOOLS_INDEX_DASHBOARD = 'project.dashboard.CustomIndexDashboard' +ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'project.dashboard.CustomAppIndexDashboard' AJAX_LOOKUP_CHANNELS = { 'responsables' : ('dae.catalogues', 'Responsable'), -- 1.7.10.4