Skip to content

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

Fix drag and drop images

Krzysztof Białogłowicz5af4b52fe8b1
diff --git a/saleor/static/dashboard/js/dashboard.js b/saleor/static/dashboard/js/dashboard.js
index 4c3611aff5..32a529f3ee 100644
--- a/saleor/static/dashboard/js/dashboard.js
+++ b/saleor/static/dashboard/js/dashboard.js
@@ -146,7 +146,6 @@ Dropzone.options.productImageForm = {
init: function() {
let $dropzoneMessage = $('.dropzone-message');
let $gallery = $('.product-gallery');
-
this.on('success', function(e, response) {
$(e.previewElement).find('.product-gallery-item-desc').html(response.image);
$(e.previewElement).attr('data-id', response.id);
diff --git a/templates/dashboard/product/images.html b/templates/dashboard/product/images.html
index 8cab7ada09..63ab7f9686 100644
--- a/templates/dashboard/product/images.html
+++ b/templates/dashboard/product/images.html
@@ -40,8 +40,8 @@
<div class="dz-message"></div>
{% csrf_token %}
<div class="row">
- {% if images %}
- <ul class="product-gallery" id="product-gallery" data-post-url="{% url 'dashboard:product-images-reorder' product_pk=product.pk %}">
+ <ul class="product-gallery" id="product-gallery" data-post-url="{% url 'dashboard:product-images-reorder' product_pk=product.pk %}">
+ {% if images %}
{% for image in images %}
<li class="col s6 m3 product-gallery-item" data-id="{{ image.pk }}">
<div class="row">
@@ -76,12 +76,10 @@
</div>
</li>
{% endfor %}
- </ul>
- {% else %}
- <p class="no-images">
- {% trans "This product has no images yet." context "Empty image gallery message" %}
- </p>
- {% endif %}
+ {% else %}
+ <div class="sortable__drag-area"></div>
+ {% endif %}
+ </ul>
<div class="col s6 m3 product-gallery-item dropzone-message">
<div class="row">
<span class="product-gallery-item-title product-gallery-item-title--noclip card-title black-text">