From dc1d97478e000298bb1144a9c9e7a047e51429a8 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Mon, 9 Mar 2026 19:24:09 +0300 Subject: [PATCH] refactor(admin/templates): remove unused template and inline storefront link logic Removed `submit_line_with_storefront_link.html` as it is no longer needed. Moved storefront link rendering logic directly into `change_form_with_storefront_link.html` for better maintainability and reduced template complexity. --- .../change_form_with_storefront_link.html | 28 ++++++- .../submit_line_with_storefront_link.html | 79 ------------------- 2 files changed, 27 insertions(+), 80 deletions(-) delete mode 100644 engine/core/templates/admin/core/submit_line_with_storefront_link.html diff --git a/engine/core/templates/admin/core/change_form_with_storefront_link.html b/engine/core/templates/admin/core/change_form_with_storefront_link.html index 71995314..83cb0272 100644 --- a/engine/core/templates/admin/core/change_form_with_storefront_link.html +++ b/engine/core/templates/admin/core/change_form_with_storefront_link.html @@ -1,5 +1,31 @@ {% extends "admin/change_form.html" %} +{% load i18n %} {% block submit_buttons_bottom %} - {% include "admin/core/submit_line_with_storefront_link.html" %} + {{ block.super }} + + {% if storefront_url %} + + + {% endif %} {% endblock %} diff --git a/engine/core/templates/admin/core/submit_line_with_storefront_link.html b/engine/core/templates/admin/core/submit_line_with_storefront_link.html deleted file mode 100644 index b9918324..00000000 --- a/engine/core/templates/admin/core/submit_line_with_storefront_link.html +++ /dev/null @@ -1,79 +0,0 @@ -{% load i18n admin_urls unfold %} - -
-
-
- {% block submit-row %} - {% if show_save %} - {% component "unfold/components/button.html" with submit=1 form=opts.model_name|add:"_form" name="_save" class="w-full lg:w-auto" %} - {% trans "Save" %} - {% endcomponent %} - {% endif %} - - {% for action in actions_submit_line %} - {% component "unfold/components/button.html" with submit=1 form=opts.model_name|add:"_form" name=action.attrs.name|default:action.action_name variant="default" class="w-full lg:w-auto" attrs=action.attrs %} - {% if action.icon %} - - {{ action.icon }} - - {% endif %} - - {{ action.description }} - {% endcomponent %} - {% endfor %} - - {% if show_save_and_continue %} - {% component "unfold/components/button.html" with submit=1 form=opts.model_name|add:"_form" name="_continue" variant="default" class="w-full lg:w-auto" %} - {% if can_change %} - {% trans "Save and continue editing" %} - {% else %} - {% trans "Save and view" %} - {% endif %} - {% endcomponent %} - {% endif %} - - {% if show_save_and_add_another %} - {% component "unfold/components/button.html" with submit=1 form=opts.model_name|add:"_form" name="_addanother" variant="default" class="w-full lg:w-auto" %} - {% trans "Save and add another" %} - {% endcomponent %} - {% endif %} - - {% if show_save_as_new %} - {% component "unfold/components/button.html" with submit=1 form=opts.model_name|add:"_form" name="_saveasnew" variant="default" class="w-full lg:w-auto" %} - {% trans "Save as new" %} - {% endcomponent %} - {% endif %} - - {% if original and storefront_url %} - - open_in_new - {% trans "See on site" %} - - {% endif %} - -
- {% if show_close or adminform.model_admin.change_form_show_cancel_button %} - {% url opts|admin_urlname:'changelist' as changelist_url %} - {% add_preserved_filters changelist_url as link %} - - {% component "unfold/components/button.html" with href=link variant="default" class="w-full lg:w-auto"%} - {% trans "Close" %} - {% endcomponent %} - {% endif %} - - {% if show_delete_link and original %} - {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %} - {% add_preserved_filters delete_url as link %} - - {% component "unfold/components/button.html" with href=delete_url variant="danger" class="mr-auto w-full lg:w-auto" %} - {% trans "Delete" %} {{ opts.verbose_name }} - {% endcomponent %} - {% endif %} -
- {% endblock %} -
-
-