Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve product list and form
Paweł Kowalewski9cd9acddc4fe
diff --git a/saleor/core/templates/materializecssform/field.html b/saleor/core/templates/materializecssform/field.htmlnew file mode 100644index 0000000000..fd2b4e5c58--- /dev/null+++ b/saleor/core/templates/materializecssform/field.html@@ -0,0 +1,164 @@+{% load materializecss %}+++ {% if field|is_checkbox %}+ <div class="col {{ classes.label }}">+ <div class="{{ classes.single_value }}">+ <div class="checkbox">+ {% if field.auto_id %}+ <label {% if field.field.required and form.required_css_class %}class="{{ form.required_css_class }}"{% endif %}>+ {{ field }} <span>{{ field.label }}</span>+ </label>+ {% endif %}+ {% for error in field.errors %}+ <span class="help-block {{ form.error_css_class }}">{{ error }}</span>+ {% endfor %}++ {% if field.help_text %}+ <p class="help-block">+ {{ field.help_text|safe }}+ </p>+ {% endif %}+ </div>+ </div>+ </div>+ {% elif field|is_radio %}+ <div class="col {{ classes.label }}">++ {% if field.auto_id %}+ <label class="control-label {{ classes.label }}{% if field.field.required %}{% endif %}">{{ field.label }}</label>+ {% endif %}+{# <div class="{{ classes.value }}">#}+ {% for choice in field %}+ <p>+ {{ choice.tag }}+ <label for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>+ </p>+ {% endfor %}++ {% for error in field.errors %}+ <span class="help-block">{{ error }}</span>+ {% endfor %}++ {% if field.help_text %}+ <p class="help-block">+ {{ field.help_text|safe }}+ </p>+ {% endif %}+{# </div>#}+ </div>+ {% elif field|is_date_input %}+ <div class="col {{ classes.label }}">++ <label for="{{ field.id_for_label }}">{{ field.label }}</label>+ <input type="date" id="{{ field.id }}" class="datepicker" value="{% if field.value %}{{ field.value }}{% endif %}">++ {% for error in field.errors %}+ <span class="help-block {{ form.error_css_class }}">{{ error }}</span>+ {% endfor %}++ {% if field.help_text %}+ <p class="help-block">+ {{ field.help_text|safe }}+ </p>+ {% endif %}+ </div>+ {% elif field|is_select %}+ <div class="col {{ classes.label }}">+ {% if field|is_checkbox_select_multiple %}+ {% if field.auto_id %}+ <label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}">{{ field.label }}</label>+ {% endif %}+ <div class="{{ classes.value }}">+ {% for choice in field %}+ <p>+ {{ choice.tag }}+ <label for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>+ </p>+ {% endfor %}++ {% for error in field.errors %}+ <span class="help-block {{ form.error_css_class }}">{{ error }}</span>+ {% endfor %}++ {% if field.help_text %}+ <p class="help-block">+ {{ field.help_text|safe }}+ </p>+ {% endif %}+ </div>++ {% else %}+ <label for="{{ field.id_for_label }}">{{ field.label }}</label>+ {{field}}+ {% for error in field.errors %}+ <span class="help-block {{ form.error_css_class }}">{{ error }}</span>+ {% endfor %}++ {% if field.help_text %}+ <p class="help-block">+ {{ field.help_text|safe }}+ </p>+ {% endif %}++ {% endif %}++ </div>++ {% elif field|is_textarea %}+ <div class="input-field col {{ classes.label }}">+ <textarea id="{{ field.auto_id }}" class="materialize-textarea" name="{{field.name}}">{% if field.value %}{{ field.value }}{% endif %}</textarea>+ {% if field.auto_id %}+ <label class="{{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>+ {% endif %}++ {% for error in field.errors %}+ <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>+ {% endfor %}++ {% if field.help_text %}+ <p>+ {{ field.help_text|safe }}+ </p>+ {% endif %}+ </div>++ {% elif field|is_file %}+ <div class="col {{ classes.label }}">+ <p>+ {% 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>+ {% endif %}+ {{ field }}+ </p>++ {% for error in field.errors %}+ <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>+ {% endfor %}++ {% if field.help_text %}+ <p>+ {{ field.help_text|safe }}+ </p>+ {% endif %}+ </div>+ {% else %}++ <div class="input-field col {{ classes.label }}">+ {{ field }}+ {% if field.auto_id %}+ <label class="{% if field.field.required %}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>+ {% endif %}++ {% for error in field.errors %}+ <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>+ {% endfor %}++ {% if field.help_text %}+ <p>+ {{ field.help_text|safe }}+ </p>+ {% endif %}+ </div>++ {% endif %}diff --git a/saleor/dashboard/templates/dashboard/product/list.html b/saleor/dashboard/templates/dashboard/product/list.htmlindex 6125800dfc..007d789e6b 100644--- a/saleor/dashboard/templates/dashboard/product/list.html+++ b/saleor/dashboard/templates/dashboard/product/list.html@@ -30,9 +30,9 @@<span class="product-list-name">{{ product.name }}</span></a><p class="product-list-name">{{ product.collection }}</p>- <p class="teal-text">{% gross product.price %}</p>+ <p class="secondary-content product-list-price">{% gross product.price %}</p><a href="{% url 'dashboard:product-delete' pk=product.pk %}"- class="secondary-content materialize-red-text text-lighten-1 product-list-delete"><i class="mdi-action-delete"></i></a>+ class="secondary-content materialize-red-text text-lighten-2 product-list-item-delete"><i class="mdi-action-delete"></i></a></li>{% endfor %}</ul>diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.htmlindex f760896c5a..b74a81db3d 100644--- a/saleor/dashboard/templates/dashboard/product/product_form.html+++ b/saleor/dashboard/templates/dashboard/product/product_form.html@@ -39,11 +39,9 @@{{ form|materializecss }}</div>- <div class="row right-align">- <div class="col s12">- {% if product.pk %}- <a href="{% url 'dashboard:product-delete' pk=product.pk %}" class="btn-flat btn-no-padding"><i class="mdi-action-delete"></i> {% trans "Delete" %}</a>- {% endif %}+ <div class="row">+ <div class="col s12 right-align">+ <a href="{% url 'dashboard:products' %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>{% if product.pk %}<button type="submit" class="btn"><i class="mdi-content-save"></i> {% trans "Update" %}</button>{% else %}@@ -131,6 +129,7 @@</div><div id="images">+ <div class="row"><div class="col l12"><ul class="row product-gallery" id="product-gallery" data-post-url="{{ images_reorder_url }}">{% for image in images %}@@ -161,6 +160,7 @@<i class="mdi-content-add"></i> {% trans "Add new image" %}</a></div>+ </div></div>{% endif %}</form>diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scssindex e01fcc4885..4108ffa556 100644--- a/saleor/static/scss/_app.scss+++ b/saleor/static/scss/_app.scss@@ -118,6 +118,14 @@ $icons-font-path: $roboto-font-path;}}}++ ul ul {+ li {+ a {+ padding-left: 30px;+ }+ }+ }}i {@@ -164,7 +172,17 @@ table {right: 0;}+#id_price {+ float: left;+ width: calc(100% - 40px);+}+.input-text-suffix {+ float: right;+ line-height: 45px;+ text-align: right;+ width: 40px;+}#modal-product-class {max-width: 300px;@@ -174,4 +192,5 @@ table {color: #999;}+@import "widget/product-gallery";@import "widget/product-list";diff --git a/saleor/static/scss/widget/_product-gallery.scss b/saleor/static/scss/widget/_product-gallery.scssindex 03264b60dc..0d29fc697a 100644--- a/saleor/static/scss/widget/_product-gallery.scss+++ b/saleor/static/scss/widget/_product-gallery.scss@@ -10,6 +10,12 @@@media (min-width: $medium-screen-up) {width: calc(25% - 1.5rem) !important;++ &:hover {+ .product-gallery-item-create, .product-gallery-item-remove {+ display: block;+ }+ }}&-text {@@ -35,6 +41,10 @@position: absolute;right: 0;width: 48px;++ @media (min-width: $medium-screen-up) {+ display: none;+ }}&-remove {diff --git a/saleor/static/scss/widget/_product-list.scss b/saleor/static/scss/widget/_product-list.scssindex c8e43f8933..4f8cec65dd 100644--- a/saleor/static/scss/widget/_product-list.scss+++ b/saleor/static/scss/widget/_product-list.scss@@ -1,6 +1,24 @@@mixin product-list {& &-item {padding-right: 40px;++ &-delete {+ background: white;+ font-size: 18px;++ @media (min-width: $medium-screen-up) {+ padding-left: 50px;+ display: none;+ }+ }++ @media (min-width: $medium-screen-up) {+ &:hover {+ .product-list-item-delete {+ display: block;+ }+ }+ }}&-name {@@ -16,10 +34,6 @@float: left;}}-- &-delete {- font-size: 18px;- }}.product-list {diff --git a/templates/prices/widget.html b/templates/prices/widget.htmlindex 89d6e5e43b..b17d188747 100644--- a/templates/prices/widget.html+++ b/templates/prices/widget.html@@ -1,4 +1,2 @@-<div class="input-group">- {{ widget }}- <div class="input-group-addon">{{ currency }}</div>-</div>+{{ widget }}+<div class="input-text-suffix">{{ currency }}</div>