Browse Source

Merge branch 'feature/tooltips' of github.com:michaelkuty/django-jet into dev

# Conflicts:
#	jet/dashboard/templatetags/jet_dashboard_tags.py
Denis K 8 years ago
parent
commit
c5ebaf2694

+ 3 - 3
jet/dashboard/templates/jet.dashboard/modules/recent_actions.html

@@ -1,4 +1,4 @@
-{% load i18n %}
+{% load i18n jet_dashboard_tags %}
 
 <ul>
     {% if not module.children %}
@@ -31,9 +31,9 @@
                     {% endif %}
 
                     {% if entry.is_deletion or not entry.get_admin_url %}
-                        {{ entry.object_repr }}
+                        <span class="tooltip" title="{{ entry|format_change_message }}">{{ entry.object_repr }}</span>
                     {% else %}
-                        <a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
+                        <a title="{{ entry|format_change_message }}" class="tooltip" href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
                     {% endif %}
                 </div>
             </li>

+ 9 - 0
jet/dashboard/templatetags/jet_dashboard_tags.py

@@ -12,3 +12,12 @@ def get_dashboard(context, location):
     app_label = context['request'].resolver_match.kwargs.get('app_label')
 
     return dashboard_cls(context, app_label=app_label)
+
+
+@register.filter
+def format_change_message(log_entry):
+    # Django 1.10+
+    if hasattr(log_entry, 'get_change_message'):
+        return log_entry.get_change_message()
+    else:
+        return log_entry.change_message