Skip to content

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

Improve product form

Paweł Kowalewski193d6571815b
diff --git a/saleor/dashboard/templates/dashboard/includes/_back-link.html b/saleor/dashboard/templates/dashboard/includes/_back-link.html
new file mode 100644
index 0000000000..b048720d2d
--- /dev/null
+++ b/saleor/dashboard/templates/dashboard/includes/_back-link.html
@@ -0,0 +1 @@
+<a href="{{ url }}" class="header-button"><i class="mdi-navigation-arrow-back"></i></a>
diff --git a/saleor/dashboard/templates/dashboard/includes/_orders_table.html b/saleor/dashboard/templates/dashboard/includes/_orders_table.html
index 74e98583a7..00efb3b2fd 100644
--- a/saleor/dashboard/templates/dashboard/includes/_orders_table.html
+++ b/saleor/dashboard/templates/dashboard/includes/_orders_table.html
@@ -5,11 +5,11 @@
<table class="striped hoverable responsive">
<thead>
<tr>
- <th>{% trans "Number" %}</th>
- <th>{% trans "Placed on" %}</th>
- <th>{% trans "Customer" %}</th>
+ <th></th>
<th>{% trans "Order status" %}</th>
<th>{% trans "Payment status" %}</th>
+ <th>{% trans "Customer" %}</th>
+ <th>{% trans "Placed on" %}</th>
<th>{% trans "Total" %}</th>
</tr>
</thead>
@@ -19,10 +19,10 @@
<td>
<a href="{% url 'dashboard:order-details' pk=order.pk %}">#{{ order.id }}</a>
</td>
- <td>{{ order.created }}</td>
- <td>{{ order.user|default:_("Guest") }}</td>
<td>{% render_status order.status order.get_status_display %}</td>
<td>{% render_status order.get_last_payment_status order.get_last_payment_status_display %}</td>
+ <td>{{ order.created }}</td>
+ <td>{{ order.user|default:_("Guest") }}</td>
<td>{% gross order.get_total %}</td>
</tr>
{% endfor %}
diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.html
index a65e0aada9..6badceb800 100644
--- a/saleor/dashboard/templates/dashboard/product/product_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_form.html
@@ -11,18 +11,19 @@
{% block page_title %}{{ title }}{% endblock %}
{% block header_menu %}
- <a href="{% url "dashboard:products" %}" class="header-button"><i class="mdi-navigation-arrow-back"></i></a>
+ {% url "dashboard:products" as url %}
+ {% include "dashboard/includes/_back-link.html" with url=url %}
{% endblock %}
{% block header_extra %}
{% if product.pk %}
- <a class="dropdown-button" href="#" data-activates="product-delete">
+ <a class="dropdown-button" href="#" data-activates="product-delete" data-constrainwidth="false">
<i class="mdi-navigation-more-vert"></i>
</a>
<ul id="product-delete" class="dropdown-content">
<li>
<a href="{% url "dashboard:product-delete" pk=product.pk %}">
- {% trans "Remove" %}
+ {% trans "Remove product" %}
</a>
</li>
</ul>
@@ -31,13 +32,12 @@
{% block breadcrumbs %}
<ul class="breadcrumbs breadcrumbs--with-menu">
- <li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
- <li><i class="mdi-navigation-chevron-right"></i> {{ title }}</li>
+ <li class="hide-on-small-only"><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
+ <li title="{{ title }}">{{ title }}</li>
</ul>
{% endblock %}
{% block content %}
-<form method="post" id="product-form" enctype="multipart/form-data">
<div class="row" hidden>
<div class="col s12">
<div class="card green">
@@ -63,17 +63,18 @@
<div class="row" id="details">
<form method="post" id="form-product" enctype="multipart/form-data">
- <div class="col l8" >
+ {% csrf_token %}
+ {{ product_form.name|materializecss:"s12 m8" }}
+ {{ product_form.price|materializecss:"s12 m4" }}
+
+ <div class="col s12 l8" >
<div class="row">
- {% csrf_token %}
- {{ product_form.name|materializecss }}
{{ product_form.description|materializecss }}
</div>
</div>
- <div class="col l4">
+ <div class="col s12 l4">
<div class="row">
- {{ product_form.price|materializecss }}
{{ product_form.weight|materializecss }}
{{ product_form.categories|materializecss:"input-field s12" }}
{{ product_form.attributes|materializecss:"input-field s12" }}
@@ -109,11 +110,12 @@
<input type="checkbox" id="select-all" class="filled-in switch-actions">
<label for="select-all"></label>
</th>
+ <th>{% trans "SKU" %}</th>
+ {% for name, value in variants.0.get_attributes_display.items %}
+ <th>{{ name }}</th>
+ {% endfor %}
<th>{% trans "Name" %}</th>
- <th class="right-align">{% trans "SKU" %}</th>
<th class="right-align">{% trans "Price" %}</th>
- <th class="right-align">{% trans "Weight" %}</th>
- <th>{% trans "Attributes" %}</th>
</tr>
</thead>
@@ -126,15 +128,15 @@
</td>
<td><a class="light-blue-text text-lighten-1" title="{% trans "Edit variant" %}"
href="{% url 'dashboard:variant-update' product_pk=product.pk variant_pk=variant.pk %}">
- {{ variant.name }}</a></td>
- <td class="right-align">{{ variant.sku }}</td>
+ {{ variant.sku }}
+ </a></td>
+ {% for name, attribute in variant.get_attributes_display.items %}
+ <td>
+ {{ attribute }}
+ </td>
+ {% endfor %}
+ <td>{{ variant.name }}</td>
<td class="right-align">{% gross variant.get_price_per_item %}</td>
- <td class="right-align">{{ variant.get_weight }}</td>
- <td>
- {% for name, value in variant.get_attributes_display.items %}
- {{ name }}: {{ value }}{% if not forloop.last %},{% endif %}
- {% endfor %}
- </td>
</tr>
{% endfor %}
</tbody>
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index df95d3ca2a..5b2f29e449 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -47,6 +47,12 @@ $header-height: 60px;
line-height: $header-height/2;
}
}
+
+ .dropdown-content {
+ left: auto !important;
+ right: 0;
+ white-space: nowrap;
+ }
}
.side-nav {
@@ -173,7 +179,7 @@ table {
}
}
-#id_price {
+.input-with-suffix input {
float: left;
width: calc(100% - 40px);
}
diff --git a/saleor/static/scss/widget/_breadcrumbs.scss b/saleor/static/scss/widget/_breadcrumbs.scss
index 9fd7bba869..16a7e4a95f 100644
--- a/saleor/static/scss/widget/_breadcrumbs.scss
+++ b/saleor/static/scss/widget/_breadcrumbs.scss
@@ -1,5 +1,4 @@
@mixin breadcrumbs {
- color: map-get($materialize-red, lighten-3);
display: block;
float: left;
font-size: $h5-fontsize;
@@ -10,11 +9,10 @@
width: calc(100% - 38px - 1.5rem);
overflow: hidden;
text-overflow: ellipsis;
- white-space: nowrap;
}
li {
- display: inline-block;
+ display: inline;
float: none;
line-height: $header-height/2;
@@ -23,15 +21,23 @@
}
a {
+ color: map-get($materialize-red, lighten-4);
+ display: inline-block;
font-size: $h5-fontsize;
padding: 0;
- }
-
- i {
- display: inline-block;
- height: auto;
- line-height: 1;
- vertical-align: bottom;
+ transition: color .2s;
+
+ &:hover {
+ color: white;
+ }
+
+ &:after {
+ content: "\e8a9";
+ color: map-get($materialize-red, lighten-4);
+ display: inline-block;
+ font-family: "Material-Design-Icons", sans-serif;
+ vertical-align: bottom;
+ }
}
}
diff --git a/templates/prices/widget.html b/templates/prices/widget.html
index b17d188747..923e40bae7 100644
--- a/templates/prices/widget.html
+++ b/templates/prices/widget.html
@@ -1,2 +1,2 @@
-{{ widget }}
+<div class="input-with-suffix">{{ widget }}</div>
<div class="input-text-suffix">{{ currency }}</div>