Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix new image upload widget display
dominik-zeglenece1082e939b
diff --git a/saleor/dashboard/product/widgets.py b/saleor/dashboard/product/widgets.pyindex 280869e6ae..27b261cecd 100644--- a/saleor/dashboard/product/widgets.py+++ b/saleor/dashboard/product/widgets.py@@ -5,18 +5,6 @@ from versatileimagefield.widgets import (ClearableFileInputWithImagePreview,class ImagePreviewFileInput(ClearableFileInputWithImagePreview):template_name = 'dashboard/product/product_image/versatile_image.html'- template_with_initial_and_imagepreview = """- <div class="sizedimage-mod preview">- <div class="image-wrap outer">- <div class="point-stage" id="%(point_stage_id)s"- data-image_preview_id="%(image_preview_id)s">- <div class="ppoi-point" id="%(ppoi_id)s"></div>- </div>- <div class="image-wrap inner">- %(image_preview)s- </div>- </div>- </div>"""def get_context(self, name, value, attrs):context = super(ImagePreviewFileInput, self).get_context(diff --git a/saleor/dashboard/templatetags/utils.py b/saleor/dashboard/templatetags/utils.pyindex 3580d868f5..474081b1b7 100644--- a/saleor/dashboard/templatetags/utils.py+++ b/saleor/dashboard/templatetags/utils.py@@ -27,6 +27,7 @@ def construct_get_query(context, **params):@register.filterdef is_versatile_image_ppoi_click_widget(field):+ print(type(field.field.widget), isinstance(field.field.widget, VersatileImagePPOIClickWidget))return isinstance(field.field.widget, VersatileImagePPOIClickWidget)diff --git a/templates/dashboard/product/product_image/versatile_image.html b/templates/dashboard/product/product_image/versatile_image.htmlindex 28c585fac0..ee40e27309 100644--- a/templates/dashboard/product/product_image/versatile_image.html+++ b/templates/dashboard/product/product_image/versatile_image.html@@ -5,15 +5,6 @@<label class="versatileimagefield-label">{{ widget.initial_text }}</label><a href="{{ widget.value.url }}">{{ widget.value.display_value }}</a></div>- {% if not widget.required %}- <div class="sizedimage-mod clear">- <input type="checkbox" name="{{ widget.checkbox_name }}"- id="{{ widget.checkbox_id }}"/>- <label class="versatileimagefield-label" for="{{ widget.checkbox_id }}">- {{ widget.clear_checkbox_label }}:- </label>- </div>- {% endif %}{% endif %}<div class="sizedimage-mod preview"><label class="versatileimagefield-label">@@ -34,8 +25,3 @@{% endif %}</div></div>-{#<div class="sizedimage-mod new-upload">#}-{# <label class="versatileimagefield-label">{{ widget.input_text }}</label>#}-{# <input type="{{ widget.type }}"#}-{# name="{{ widget.name }}"{% include "versatileimagefield/forms/widgets/attrs.html" %} />#}-{#</div>#}diff --git a/templates/materializecssform/field.html b/templates/materializecssform/field.htmlindex 52ad32572b..1814e5bb4a 100644--- a/templates/materializecssform/field.html+++ b/templates/materializecssform/field.html@@ -184,39 +184,39 @@{{ field }}</p></div>-{#{% elif field|is_versatile_image_ppoi_click_widget %}#}-{# <div class="input col file-field input-field {{ classes.label }}">#}-{# {% if field.auto_id %}#}-{# <label class="{{ classes.label }}" for="{{ field.auto_id }}">#}-{# {{ field.label }}#}-{# {% if not field.field.required %}#}-{# {% trans "(optional)" context "Dashboard form labels" %}#}-{# {% endif %}#}-{# </label>#}-{# {% endif %}#}-{# <div class="btn">#}-{# <span>#}-{# {% trans "File" %}#}-{# </span>#}-{# <input class="file-chooser" id="{{ field.auto_id }}_0"#}-{# name="{{ field.name }}_0" type="file">#}-{# <input class="ppoi-input" id="{{ field.auto_id }}_1"#}-{# name="{{ field.name }}_1" type="hidden">#}-{# </div>#}-{# <div class="file-path-wrapper">#}-{# <input class="file-path" type="text">#}-{# </div>#}-{# {% for error in field.errors %}#}-{# <p class="help-block materialize-red-text">#}-{# {{ error }}#}-{# </p>#}-{# {% endfor %}#}-{# {% if field.help_text %}#}-{# <p class="help-block">#}-{# {{ field.help_text|safe }}#}-{# </p>#}-{# {% endif %}#}-{# </div>#}+{% elif field|is_versatile_image_ppoi_click_widget %}+ <div class="input col file-field input-field {{ classes.label }}">+ {% if field.auto_id %}+ <label class="{{ classes.label }}" for="{{ field.auto_id }}">+ {{ field.label }}+ {% if not field.field.required %}+ {% trans "(optional)" context "Dashboard form labels" %}+ {% endif %}+ </label>+ {% endif %}+ <div class="btn">+ <span>+ {% trans "File" %}+ </span>+ <input class="file-chooser" id="{{ field.auto_id }}_0"+ name="{{ field.name }}_0" type="file">+ <input class="ppoi-input" id="{{ field.auto_id }}_1"+ name="{{ field.name }}_1" type="hidden">+ </div>+ <div class="file-path-wrapper">+ <input class="file-path" type="text">+ </div>+ {% for error in field.errors %}+ <p class="help-block materialize-red-text">+ {{ error }}+ </p>+ {% endfor %}+ {% if field.help_text %}+ <p class="help-block">+ {{ field.help_text|safe }}+ </p>+ {% endif %}+ </div>{% elif field|is_image_preview_widget %}<div class="col">{{ field }}