ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'SIGMA.dashboard.CustomAppIndexDashboard'
"""
-from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
+from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
+from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
+from project.decorators import in_drh_or_admin
+from project.rh.historique import get_active_revisions
class CustomIndexDashboard(Dashboard):
"""
Custom index dashboard for SGRH.
"""
def init_with_context(self, context):
+ request = context['request']
# append an app list module for "Applications"
self.children.append(modules.Group(
)
),
modules.ModelList(
- title='Gestion des candidatures',
+ title='Recrutement',
models=(
'auf.django.emploi.models.OffreEmploi',
'project.recrutement.models.ProxyOffreEmploi',
'project.recrutement.models.CandidatEvaluation',
'project.recrutement.models.MesCandidatEvaluation',
'project.recrutement.models.Evaluateur',
+ 'project.recrutement.models.OffreEmploiEvaluateur',
'project.recrutement.models.CourrielTemplate',
)
),
'project.rh.models.Poste',
)
),
+ modules.ModelList(
+ title='Log',
+ models=(
+ 'project.rh.models.ChangementPersonnel',
+ )
+ ),
]
))
+
+ if in_drh_or_admin(request.user):
+ revisions = get_active_revisions()[:10]
+ children = []
+ for rev in revisions:
+ date = rev['short_date_created']
+ user = u"<span style='font-weight: bold;'>%s</span>" % rev['user']
+ if rev['type'] is None or rev['objet'] is None:
+ titre = u"""<span style='color:black;'>[%s] %s</span>
+ commentaire : %s """ % (date, user, rev['comment'])
+ children.append({
+ 'title': titre,
+ 'url': reverse('rhr_historique_des_modifications'),
+ 'external': False,
+ })
+ else:
+ type = u"<span style='font-decoration: underligne;'>%s</span>" % rev['type']
+ titre = u"""<span style='color:black;'>[%s] %s a modifié
+ un(e) %s :</span> %s""" % (date, user, type, rev['objet'], )
+ children.append({
+ 'title': titre,
+ 'url': rev['history_url'],
+ 'external': False,
+ })
+ self.children.append(modules.LinkList(
+ title='10 dernières modifications',
+ children=children,)
+ )
+
+
+
# append an app list module for "Configuration"
self.children.append(modules.AppList(
_('Configuration'),
'project.rh.models.TypeRevalorisation',
'project.rh.models.TypeRemuneration',
'project.rh.models.ValeurPoint',
+ 'project.rh.models.ChangementPersonnelNotifications',
),
exclude=('django.contrib.*',),
))
self.children.append(modules.AppList(
_(u'Inter-systèmes'),
models=(
- 'project.rh.models.ResponsableImplantation',
+ 'project.rh.models.ResponsableImplantationProxy',
),
))