Skip to content

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

Fix nested forms in product form

Paweł Kowalewski2d6c4ff23ee9
diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.html
index 6c0d91dcd1..db8835e476 100644
--- a/saleor/dashboard/templates/dashboard/product/product_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_form.html
@@ -39,16 +39,6 @@
{% block menu_catalogue_class %} active{% endblock %}
{% block content %}
- <div class="row" hidden>
- <div class="col s12">
- <div class="card green">
-{# <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>#}
-{# <span class="glyphicon glyphicon-ok-sign"></span>#}
- <span class="card-content white-text">{% trans "Data saved" %}</span>
- </div>
- </div>
- </div>
-
{% if product.pk %}
<div class="row">
<div class="col s12">
@@ -305,28 +295,6 @@
<a href="#modal-product-image-delete-{{ image.pk }}" class="modal-trigger">
{% trans "Delete" %}
</a>
-
- <div class="modal" id="modal-product-image-delete-{{ image.pk }}">
- <form action="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=image.pk %}" method="post">
- {% csrf_token %}
- <input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#images">
-
- <div class="modal-content">
- <h5>{% trans "Are you sure?" %}</h5>
-
- <img class="responsive-img" src="{{ image.image.crop.400x250 }}" alt="">
-
- <p>
- {% blocktrans %}You are about to delete this image.{% endblocktrans %}
- </p>
- </div>
-
- <div class="modal-footer">
- <button type="submit" class="modal-action btn-flat blue-text">{% trans "Delete" %}</button>
- <a href="#!" class="modal-action modal-close btn-flat blue-text">{% trans "Cancel" %}</a>
- </div>
- </form>
- </div>
</div>
</li>
{% endfor %}
@@ -340,6 +308,30 @@
</li>
</ul>
</form>
+
+ {% for image in images %}
+ <div class="modal" id="modal-product-image-delete-{{ image.pk }}">
+ <form action="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=image.pk %}" method="post">
+ {% csrf_token %}
+ <input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#images">
+
+ <div class="modal-content">
+ <h5>{% trans "Are you sure?" %}</h5>
+
+ <img class="responsive-img" src="{{ image.image.crop.400x250 }}" alt="">
+
+ <p>
+ {% blocktrans %}You are about to delete this image.{% endblocktrans %}
+ </p>
+ </div>
+
+ <div class="modal-footer">
+ <button type="submit" class="modal-action btn-flat blue-text">{% trans "Delete" %}</button>
+ <a href="#!" class="modal-action modal-close btn-flat blue-text">{% trans "Cancel" %}</a>
+ </div>
+ </form>
+ </div>
+ {% endfor %}
</div>
</div>
{% else %}