Skip to content

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

Improve product image form

Paweł Kowalewski2449332cb8d1
diff --git a/saleor/core/templates/materializecssform/field.html b/saleor/core/templates/materializecssform/field.html
index 9834651151..aab25945dd 100644
--- a/saleor/core/templates/materializecssform/field.html
+++ b/saleor/core/templates/materializecssform/field.html
@@ -135,7 +135,7 @@
{% elif field|is_versatile_image_ppoi_click_widget %}
<div class="col file-field input-field {{ classes.label }}">
{% if field.auto_id %}
- <label class="{{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label><br>
+ <label class="{{ classes.label }}" for="{{ field.auto_id }}">{{ field.label }}</label>
{% endif %}
<div class="btn">
<span>File</span>
diff --git a/saleor/dashboard/templates/dashboard/product/product_image_form.html b/saleor/dashboard/templates/dashboard/product/product_image_form.html
index cf60deaadc..0f4a77245a 100644
--- a/saleor/dashboard/templates/dashboard/product/product_image_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_image_form.html
@@ -40,9 +40,12 @@
<div class="row">
<div class="col l8">
{% csrf_token %}
- {{ form.image|materializecss }}
+ {% if product_image.pk %}
+ <p class="no-margin">{% trans "Pick the most relevant part of the image using the red circle." %}</p>
+ {% endif %}
<div class="row">
+ {{ form.image|materializecss }}
{{ form.alt|materializecss }}
<input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#images">
</div>
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index 64862031a8..91afd6f527 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -283,6 +283,10 @@ table {
}
}
+.no-margin {
+ margin: 0;
+}
+
@import "widget/breadcrumbs";
@import "widget/card";
@import "widget/data-table";
diff --git a/saleor/static/scss/widget/_form.scss b/saleor/static/scss/widget/_form.scss
index cdabdbd170..53522ef9d8 100644
--- a/saleor/static/scss/widget/_form.scss
+++ b/saleor/static/scss/widget/_form.scss
@@ -67,20 +67,22 @@
&#form-attributes {
[type=checkbox]:not(:checked), [type=checkbox]:checked {
- position: initial;
- visibility: visible;
+ position: initial;
+ visibility: visible;
}
}
- .versatileimagefield {
+ .sizedimage-mod {
margin-bottom: $gutter-width/2;
- .sizedimage-mod {
- margin-bottom: $gutter-width/2;
+ & ~ label {
+ display: none;
+ }
+ }
- label {
- margin-bottom: 5px;
- }
+ .file-field {
+ label {
+ display: none;
}
}
}