diff --git a/HISTORY.rst b/HISTORY.rst index ec0be8a9f8..eb5c986a0f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,6 +19,7 @@ Vagrant has been move into its own repository at: https://gitlab.com/mayan-edms/mayan-edms-vagrant - Add view to show list of events performed by an user. +- Allow filtering an event list by clicking on the user column. 2.7.3 (2017-09-11) ================== diff --git a/docs/releases/2.8.rst b/docs/releases/2.8.rst index 5b9b5c53b2..8d99819c33 100644 --- a/docs/releases/2.8.rst +++ b/docs/releases/2.8.rst @@ -26,6 +26,7 @@ What's new Vagrant has been move into its own repository at: https://gitlab.com/mayan-edms/mayan-edms-vagrant - Add view to show list of events performed by an user. +- Allow filtering an event list by clicking on the user column. Removals -------- diff --git a/mayan/apps/events/apps.py b/mayan/apps/events/apps.py index 6551a3a0ff..cebc9a5e33 100644 --- a/mayan/apps/events/apps.py +++ b/mayan/apps/events/apps.py @@ -18,15 +18,7 @@ from .links import ( link_user_events, link_user_notifications_list, ) from .licenses import * # NOQA -from .widgets import event_object_link, event_type_link - - -def event_actor(action): - return _('System') if action.actor == action.target else action.actor - - -def event_action_object(action): - return action.action_object if action.action_object != action.target and action.action_object else '' +from .widgets import event_object_link, event_type_link, event_user_link class EventsApp(MayanAppConfig): @@ -48,7 +40,7 @@ class EventsApp(MayanAppConfig): ) SourceColumn( source=Action, label=_('Actor'), - func=lambda context: event_actor(context['object']) + func=lambda context: event_user_link(context['object']) ) SourceColumn( source=Action, label=_('Event'), diff --git a/mayan/apps/events/widgets.py b/mayan/apps/events/widgets.py index c32c120239..0c69c9c6cd 100644 --- a/mayan/apps/events/widgets.py +++ b/mayan/apps/events/widgets.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.urls import reverse from django.utils.encoding import force_text from django.utils.safestring import mark_safe +from django.utils.translation import ugettext_lazy as _ from .classes import EventType @@ -34,3 +35,15 @@ def event_type_link(entry): 'label': EventType.get(name=entry.verb) } ) + + +def event_user_link(entry): + if entry.actor == entry.target: + return _('System') + else: + return mark_safe( + '%(label)s' % { + 'url': reverse('events:user_events', kwargs={'pk': entry.actor.pk}), + 'label': entry.actor + } + )