From 6678b56d9b9929b8e4a675d6bbd809b6845260e9 Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 17 Jun 2024 15:17:03 +0200 Subject: [PATCH] feat: unified details actions with tabs --- src/unfold/templates/admin/change_form.html | 16 ---------------- .../templates/unfold/helpers/tab_action.html | 2 +- .../templates/unfold/helpers/tab_list.html | 8 ++++++-- src/unfold/templatetags/unfold.py | 1 + 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/unfold/templates/admin/change_form.html b/src/unfold/templates/admin/change_form.html index a74d38130..7d946c534 100644 --- a/src/unfold/templates/admin/change_form.html +++ b/src/unfold/templates/admin/change_form.html @@ -62,22 +62,6 @@
{% csrf_token %} - {% if actions_detail %} -
- {% block actions %} - {% for action in actions_detail %} - - {{ action.title }} - - {% endfor %} - {% endblock %} -
- {% endif %} - {% block form_top %}{% endblock %}
diff --git a/src/unfold/templates/unfold/helpers/tab_action.html b/src/unfold/templates/unfold/helpers/tab_action.html index a22b59a89..9e8a39ed0 100644 --- a/src/unfold/templates/unfold/helpers/tab_action.html +++ b/src/unfold/templates/unfold/helpers/tab_action.html @@ -1,5 +1,5 @@
  • - + {{ title }}
  • diff --git a/src/unfold/templates/unfold/helpers/tab_list.html b/src/unfold/templates/unfold/helpers/tab_list.html index 89b1dc1bc..b18041846 100644 --- a/src/unfold/templates/unfold/helpers/tab_list.html +++ b/src/unfold/templates/unfold/helpers/tab_list.html @@ -1,5 +1,5 @@ {% if not is_popup %} - {% if tab_list or actions_list or actions_items or nav_global %} + {% if tab_list or actions_list or actions_detail or actions_items or nav_global %}
    {% if tab_list %}
      @@ -15,12 +15,16 @@
    {% endif %} - {% if actions_list or actions_items or nav_global %} + {% if actions_list or actions_detail or actions_items or nav_global %}
      {% for action in actions_list %} {% include "unfold/helpers/tab_action.html" with title=action.title link=action.path %} {% endfor %} + {% for action in actions_detail %} + {% include "unfold/helpers/tab_action.html" with title=action.title link=action.path %} + {% endfor %} + {% if actions_items %} {{ actions_items }} {% endif %} diff --git a/src/unfold/templatetags/unfold.py b/src/unfold/templatetags/unfold.py index 079690ecd..2aaab69e6 100644 --- a/src/unfold/templatetags/unfold.py +++ b/src/unfold/templatetags/unfold.py @@ -26,6 +26,7 @@ def tab_list(context, opts) -> str: context={ "tab_list": tabs, "nav_global": context.get("nav_global"), + "actions_detail": context.get("actions_detail"), "actions_list": context.get("actions_list"), "actions_items": context.get("actions_items"), "is_popup": context.get("is_popup"),