Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Move product delete confirmation modal to base template

Jakub Draganekbdf8939b7568
diff --git a/templates/dashboard/modal_confirm_delete.html b/templates/dashboard/modal_confirm_delete.html
new file mode 100644
index 0000000000..802d4c1bd1
--- /dev/null
+++ b/templates/dashboard/modal_confirm_delete.html
@@ -0,0 +1,27 @@
+{% load i18n %}
+
+<form action="{% block action_url %}{% endblock %}" method="post" novalidate>
+ {% csrf_token %}
+ <div class="modal-content">
+ <div class="row">
+ <div class="col s12">
+ <h5>
+ {% block title %}
+ {% trans "Are you sure?" context "Dashboard confirmation modal" %}
+ {% endblock %}
+ </h5>
+ </div>
+ </div>
+ {% block content %}{% endblock %}
+ </div>
+ <div class="modal-footer">
+ {% block footer %}
+ <button type="submit" class="modal-action btn-flat">
+ {% trans "Delete" context "Dashboard delete action" %}
+ </button>
+ <a href="#!" class="modal-action modal-close btn-flat">
+ {% trans "Cancel" context "Dashboard cancel action" %}
+ </a>
+ {% endblock footer %}
+ </div>
+</form>
diff --git a/templates/dashboard/product/modal_confirm_delete.html b/templates/dashboard/product/modal_confirm_delete.html
index 1779024e02..e1e96c8051 100644
--- a/templates/dashboard/product/modal_confirm_delete.html
+++ b/templates/dashboard/product/modal_confirm_delete.html
@@ -1,18 +1,13 @@
+{% extends "dashboard/modal_confirm_delete.html" %}
+
{% load i18n %}
{% load prices_i18n %}
{% load staticfiles %}
{% load product_first_image from product_images %}
-<form action="{% url "dashboard:product-delete" pk=product.pk %}" method="post" novalidate>
- {% csrf_token %}
- <div class="modal-content">
- <div class="row">
- <div class="col s12">
- <h5>
- {% trans "Are you sure?" context "Dashboard confirmation modal" %}
- </h5>
- </div>
- </div>
+{% block action_url %}{% url 'dashboard:product-delete' pk=product.pk %}{% endblock %}
+
+{% block content %}
<div class="row">
<div class="col s12 center-align">
<img src="{% product_first_image product size="255x255" method="crop" %}"
@@ -25,13 +20,4 @@
If you remove <strong>{{ product }}</strong> you will lose all data related to this product.
{% endblocktrans %}
</p>
- </div>
- <div class="modal-footer">
- <button type="submit" class="modal-action btn-flat">
- {% trans "Delete" context "Dashboard delete action" %}
- </button>
- <a href="#!" class="modal-action modal-close btn-flat">
- {% trans "Cancel" context "Dashboard cancel action" %}
- </a>
- </div>
-</form>
+{% endblock content %}