Skip to content

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

Fix dropzone

dominik-zeglen85863a8e2d1c
diff --git a/saleor/static/dashboard/js/components/image-gallery.js b/saleor/static/dashboard/js/components/image-gallery.js
index 0d67a6d594..6a0e51bbf7 100644
--- a/saleor/static/dashboard/js/components/image-gallery.js
+++ b/saleor/static/dashboard/js/components/image-gallery.js
@@ -2,14 +2,15 @@ import Dropzone from 'dropzone';
import Sortable from 'sortablejs';
export default $(document).ready((e) => {
- Dropzone.options.productImageForm = {
+ $('#product-image-form').dropzone({
paramName: 'image_0',
maxFilesize: 20,
previewsContainer: '.product-gallery',
thumbnailWidth: 400,
thumbnailHeight: 400,
previewTemplate: $('#template').html(),
- clickable: false,
+ method: 'POST',
+ clickable: '.dropzone-message',
init: function () {
this.on('success', function (e, response) {
$(e.previewElement).find('.product-gallery-item-desc').html(response.image);
@@ -27,7 +28,7 @@ export default $(document).ready((e) => {
$('.no-images').addClass('hide');
});
}
- };
+ });
let el = document.getElementById('product-gallery');
if (el) {
Sortable.create(el, {
diff --git a/templates/dashboard/product/product_image/list.html b/templates/dashboard/product/product_image/list.html
index 43b7f27048..9929a3ee6d 100644
--- a/templates/dashboard/product/product_image/list.html
+++ b/templates/dashboard/product/product_image/list.html
@@ -47,7 +47,7 @@
{% block content %}
<div id="images" class="tab-content">
- <form action="{% url 'dashboard:product-images-upload' product_pk=product.pk %}" class="dropzone" id="product-image-form" novalidate>
+ <form action="{% url 'dashboard:product-images-upload' product_pk=product.pk %}" class="" id="product-image-form" novalidate>
<div class="dz-message"></div>
{% csrf_token %}
<div class="row">