Skip to content

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

Improve product management ux

Paweł Kowalewski5ef9dd18a200
diff --git a/saleor/core/templates/materializecssform/field.html b/saleor/core/templates/materializecssform/field.html
index fd2b4e5c58..edc1559f1e 100644
--- a/saleor/core/templates/materializecssform/field.html
+++ b/saleor/core/templates/materializecssform/field.html
@@ -11,7 +11,7 @@
</label>
{% endif %}
{% for error in field.errors %}
- <span class="help-block {{ form.error_css_class }}">{{ error }}</span>
+ <p class="help-block materialize-red-text">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
@@ -28,24 +28,22 @@
{% 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>#}
+ {% for choice in field %}
+ <p>
+ {{ choice.tag }}
+ <label for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>
+ </p>
+ {% endfor %}
+
+ {% 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_date_input %}
<div class="col {{ classes.label }}">
@@ -54,7 +52,7 @@
<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>
+ <p class="help-block materialize-red-text">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
@@ -78,7 +76,7 @@
{% endfor %}
{% for error in field.errors %}
- <span class="help-block {{ form.error_css_class }}">{{ error }}</span>
+ <p class="help-block materialize-red-text">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
@@ -92,7 +90,7 @@
<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>
+ <p class="help-block materialize-red-text">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
@@ -113,7 +111,7 @@
{% endif %}
{% for error in field.errors %}
- <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>
+ <p class="help-block materialize-red-text">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
@@ -133,7 +131,7 @@
</p>
{% for error in field.errors %}
- <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>
+ <p class="help-block materialize-red-text">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
@@ -145,13 +143,15 @@
{% 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 %}
+ <div class="price-wrapper">
+ {{ field }}
+ {% if field.auto_id %}
+ <label class="{% if field.field.required %}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>
+ {% endif %}
+ </div>
{% for error in field.errors %}
- <p class="help-block orange-text {{ form.error_css_class }}">{{ error }}</p>
+ <p class="help-block materialize-red-text">{{ error }}</p>
{% endfor %}
{% if field.help_text %}
diff --git a/saleor/dashboard/templates/dashboard/includes/_messages.html b/saleor/dashboard/templates/dashboard/includes/_messages.html
index 579c8f892f..a7660fa2b8 100644
--- a/saleor/dashboard/templates/dashboard/includes/_messages.html
+++ b/saleor/dashboard/templates/dashboard/includes/_messages.html
@@ -1,29 +1,23 @@
+{% load i18n %}
+
<div id="messages">
{% if messages %}
{% for message in messages %}
- <div class="alert alert-dismissable fade in alert-{{ message.tags }}">
- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
- {# Include an icon by default #}
- {% if 'success' in message.tags %}
- <span class="glyphicon glyphicon-ok-sign"></span>
- {% endif %}
- {% if 'info' in message.tags %}
- <span class="glyphicon glyphicon-info-sign"></span>
- {% endif %}
- {% if 'warning' in message.tags %}
- <span class="glyphicon glyphicon-warning-sign"></span>
- {% endif %}
- {% if 'danger' in message.tags %}
- <span class="glyphicon glyphicon-exclamation-sign"></span>
- {% endif %}
+ <div class="row">
+ <div class="col s12 center-align">
+ <div class="toast toast--static">
+ <span>
+ {% if 'safe' in message.tags %}
+ {{ message|safe }}
+ {% else %}
+ {{ message }}
+ {% endif %}
+ </span>
- {# Allow HTML to be embedded in messages #}
- {% if 'safe' in message.tags %}
- {{ message|safe }}
- {% else %}
- {{ message }}
- {% endif %}
+ <a class="btn-flat teal-text">{% trans "Dismiss" %}</a>
+ </div>
</div>
+ </div>
{% endfor %}
{% endif %}
</div>
diff --git a/saleor/dashboard/templates/dashboard/product/list.html b/saleor/dashboard/templates/dashboard/product/list.html
index 007d789e6b..42dbf3e078 100644
--- a/saleor/dashboard/templates/dashboard/product/list.html
+++ b/saleor/dashboard/templates/dashboard/product/list.html
@@ -6,6 +6,8 @@
{% block title %}{% trans "Products" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-products{% endblock %}
+
{% block page_title %}{% trans "Products" %}{% endblock %}
{% block header_extra %}
diff --git a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
index 7fda8d3d40..851d64d0d1 100644
--- a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
@@ -5,6 +5,8 @@
{% block title %}{% trans "Delete product" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-products{% endblock %}
+
{% block page_title %}{% trans "Are you sure you want to delete the following product?" %}{% endblock %}
{% block content %}
@@ -30,9 +32,6 @@
<div class="col m6 l4 offset-m3 offset-l4 right-align">
<a href="{% url 'dashboard:products' %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
<button type="submit" class="btn materialize-red"><i class="mdi-action-delete"></i> {% trans "Delete" %}</button>
-
-{# <button class="btn btn-danger" type="submit"><i class="glyphicon glyphicon-trash"></i> {% trans "Delete" %}</button>#}
-{# <a class="btn btn-default" href="{% url 'dashboard:products' pk=product.pk %}"><i class="glyphicon glyphicon-remove"></i> {% trans "Cancel" %}</a>#}
</div>
</div>
</form>
diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.html
index 533fcaf729..e2e39c23cb 100644
--- a/saleor/dashboard/templates/dashboard/product/product_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_form.html
@@ -6,6 +6,8 @@
{% block title %}{{ title }} - {% trans "Products" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-products{% endblock %}
+
{% block page_title %}{{ title }}{% endblock %}
{% block content %}
@@ -149,7 +151,7 @@
{% if image.alt %}
<span class="product-gallery-item-text">{{ image.alt }}</span>
{% endif %}
- <a class="product-gallery-item-create blue-text text-lighten-2"
+ <a class="product-gallery-item-create light-blue-text text-lighten-1"
href="{% url 'dashboard:product-image-update' product_pk=product.pk img_pk=image.pk %}">
<i class="mdi-content-create"></i>
</a>
diff --git a/saleor/dashboard/templates/dashboard/product/product_image_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/product_image_confirm_delete.html
index d47d27bc1b..089bc76da5 100644
--- a/saleor/dashboard/templates/dashboard/product/product_image_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/product_image_confirm_delete.html
@@ -3,20 +3,30 @@
{% block title %}{% trans "Delete image" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-products{% endblock %}
+
+{% block page_title %}{% trans "Are you sure you want to delete the following image?" %}{% endblock %}
+
{% block content %}
- <div class="row">
- <h3>{% trans "Are you sure you want to delete the following image?" %}</h3>
- </div>
- <form action="" method="post">
+ <form method="post">
{% csrf_token %}
<input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#images">
<div class="row">
- <div>{{ product_image.image.name }}</div>
- <div><img src="{{ product_image.image.crop.50x50}}" alt="{{ product_image.alt }}"></div>
+ <div class="col m6 l4 offset-m3 offset-l4">
+ <div class="card">
+ <div class="card-content">
+ <div class="card-title black-text">{{ product_image.alt }}</div>
+ <img src="{{ product_image.image.crop.350x350}}" alt="{{ product_image.alt }}" class="responsive-img">
+ </div>
+ </div>
+ </div>
</div>
+
<div class="row">
- <button class="btn waves-effect red" type="submit"><i class="glyphicon glyphicon-trash"></i> {% trans "Delete" %}</button>
- <a class="btn waves-effect" href="{{ request.META.HTTP_REFERER }}"><i class="glyphicon glyphicon-remove"></i> {% trans "Cancel" %}</a>
+ <div class="col m6 l4 offset-m3 offset-l4 right-align">
+ <a href="{% url 'dashboard:product-update' pk=product.pk %}#images" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
+ <button type="submit" class="btn materialize-red"><i class="mdi-action-delete"></i> {% trans "Delete" %}</button>
+ </div>
</div>
</form>
{% endblock %}
diff --git a/saleor/dashboard/templates/dashboard/product/product_image_form.html b/saleor/dashboard/templates/dashboard/product/product_image_form.html
index 0a41d9a0a1..ff6a8b433f 100644
--- a/saleor/dashboard/templates/dashboard/product/product_image_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_image_form.html
@@ -5,6 +5,8 @@
{% block title %}{{ title }} - {% trans "Images" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-products{% endblock %}
+
{% block page_title %}{{ title }}{% endblock %}
{% block content %}
diff --git a/saleor/static/js_src/dashboard.js b/saleor/static/js_src/dashboard.js
index 7952b326eb..c4eb4531ea 100644
--- a/saleor/static/js_src/dashboard.js
+++ b/saleor/static/js_src/dashboard.js
@@ -1,5 +1,6 @@
$('.button-collapse').sideNav();
-$('select:not(.browser-default)').material_select();
+$('select:not(.browser-default):not([multiple])').material_select();
+$('select[multiple]').addClass('browser-default');
$('.modal-trigger').leanModal();
$('ul.tabs').find('.tab').on('click', function(e) {
window.history.pushState(null, null, e.target.hash);
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index 35a1832d02..eef0773854 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -194,5 +194,7 @@ table {
color: #999;
}
+@import "widget/form";
@import "widget/product-gallery";
@import "widget/product-list";
+@import "widget/toast";
diff --git a/saleor/static/scss/widget/_form.scss b/saleor/static/scss/widget/_form.scss
new file mode 100644
index 0000000000..10d70b3a5c
--- /dev/null
+++ b/saleor/static/scss/widget/_form.scss
@@ -0,0 +1,22 @@
+@mixin form {
+ .select-wrapper {
+ &.invalid {
+ input {
+ @extend .invalid;
+ }
+ }
+ }
+
+ .price-wrapper {
+ overflow: hidden;
+ }
+
+ p.help-block {
+ margin: -7px 0 15px;
+ font-size: $label-font-size;
+ }
+}
+
+form {
+ @include form;
+}
diff --git a/saleor/static/scss/widget/_toast.scss b/saleor/static/scss/widget/_toast.scss
new file mode 100644
index 0000000000..5e50741d35
--- /dev/null
+++ b/saleor/static/scss/widget/_toast.scss
@@ -0,0 +1,10 @@
+@mixin toast {
+ &--static {
+ display: inline-block;
+ float: none;
+ }
+}
+
+.toast {
+ @include toast;
+}