From ac53084695c435ec9dca6020e3f0d973fd43d69b Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Thu, 23 Apr 2020 18:43:34 +0200 Subject: [PATCH] Improve handling of detailed history button --- logs/templatetags/logs_extra.py | 3 ++- machines/templates/machines/aff_machines.html | 4 ++-- templates/buttons/history.html | 4 ++-- users/templates/users/profil.html | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/logs/templatetags/logs_extra.py b/logs/templatetags/logs_extra.py index c436c1fa..2e58cb67 100644 --- a/logs/templatetags/logs_extra.py +++ b/logs/templatetags/logs_extra.py @@ -42,7 +42,7 @@ def is_facture(baseinvoice): @register.inclusion_tag("buttons/history.html") -def history_button(instance, text=False, html_class=True): +def history_button(instance, text=False, detailed=False, html_class=True): """Creates the correct history button for an instance. Args: @@ -57,5 +57,6 @@ def history_button(instance, text=False, html_class=True): "name": instance._meta.model_name, "id": instance.id, "text": text, + "detailed": detailed, "class": html_class, } diff --git a/machines/templates/machines/aff_machines.html b/machines/templates/machines/aff_machines.html index 77b65546..857d2a3a 100644 --- a/machines/templates/machines/aff_machines.html +++ b/machines/templates/machines/aff_machines.html @@ -67,7 +67,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% trans "Create an interface" as tr_create_an_interface %} {% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc=tr_create_an_interface %} {% acl_end %} - {% history_button machine %} + {% history_button machine detailed=True %} {% can_delete machine %} {% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %} {% acl_end %} @@ -161,7 +161,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% acl_end %} - {% history_button interface %} + {% history_button interface detailed=True %} {% can_delete interface %} {% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %} {% acl_end %} diff --git a/templates/buttons/history.html b/templates/buttons/history.html index f8eed813..04b0178f 100644 --- a/templates/buttons/history.html +++ b/templates/buttons/history.html @@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load i18n %} -{% if name == "user" %} - +{% if detailed %} + {% if text %}{% trans "History" %}{% endif %} {% else %} diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 4fec3c18..4fa780a7 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -176,7 +176,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% trans "Edit the groups" %} {% acl_end %} - {% history_button users text=True %} + {% history_button users text=True detailed=True %}