Skip to content

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

Improve product forms

Paweł Kowalewski040c170d89a0
diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.py
index 016646965a..4e4ae2359b 100644
--- a/saleor/dashboard/product/views.py
+++ b/saleor/dashboard/product/views.py
@@ -97,10 +97,8 @@ def stock_edit(request, product_pk, stock_pk=None):
product = get_object_or_404(Product, pk=product_pk)
if stock_pk:
stock = get_object_or_404(Stock, pk=stock_pk)
- title = stock.variant.name
else:
stock = Stock()
- title = _('Add stock')
form = StockForm(request.POST or None, instance=stock, product=product)
if product.variants.exists():
if form.is_valid():
@@ -115,7 +113,7 @@ def stock_edit(request, product_pk, stock_pk=None):
else:
messages.error(request, _(
'You have to add at least one variant before you can add stock'))
- ctx = {'product': product, 'stock': stock, 'form': form, 'title': title}
+ ctx = {'product': product, 'stock': stock, 'form': form}
return TemplateResponse(request, 'dashboard/product/stock_form.html', ctx)
@@ -138,10 +136,8 @@ def product_image_edit(request, product_pk, img_pk=None):
product = get_object_or_404(Product, pk=product_pk)
if img_pk:
product_image = get_object_or_404(product.images, pk=img_pk)
- title = product_image.image.name
else:
product_image = ProductImage(product=product)
- title = _('Add image')
form = ProductImageForm(request.POST or None, request.FILES or None,
instance=product_image)
if form.is_valid():
@@ -157,7 +153,7 @@ def product_image_edit(request, product_pk, img_pk=None):
if form.errors:
messages.error(request, _('Your submitted data was not valid - '
'please correct the errors below'))
- ctx = {'product': product, 'product_image': product_image, 'title': title,
+ ctx = {'product': product, 'product_image': product_image,
'form': form}
return TemplateResponse(
request, 'dashboard/product/product_image_form.html', ctx)
@@ -187,10 +183,8 @@ def variant_edit(request, product_pk, variant_pk=None):
if variant_pk:
variant = get_object_or_404(product.variants.select_subclasses(),
pk=variant_pk)
- title = variant.name
else:
variant = variant_cls(product=product)
- title = _('Add variant')
form_cls = get_variant_form(product)
form = form_cls(request.POST or None, instance=variant,
@@ -213,7 +207,7 @@ def variant_edit(request, product_pk, variant_pk=None):
if any([f.errors for f in forms]):
messages.error(request, _('Your submitted data was not valid - '
'please correct the errors below'))
- ctx = {'product': product, 'variant': variant, 'title': title,
+ ctx = {'product': product, 'variant': variant,
'form': form, 'attributes_form': attributes_form}
return TemplateResponse(request, 'dashboard/product/variant_form.html', ctx)
diff --git a/saleor/dashboard/templates/dashboard/base.html b/saleor/dashboard/templates/dashboard/base.html
index 8db1c6d163..dfb5839866 100644
--- a/saleor/dashboard/templates/dashboard/base.html
+++ b/saleor/dashboard/templates/dashboard/base.html
@@ -56,7 +56,7 @@
<li>
<ul class="collapsible collapsible-accordion" data-collapsible="accordion">
<li>
- <a class="waves-effect waves-teal collapsible-header{% block menu_store_class %}{% endblock %}">{% trans "Store" %}</a>
+ <a class="waves-effect waves-teal collapsible-header{% block menu_catalogue_class %}{% endblock %}">{% trans "Catalogue" %}</a>
<div class="collapsible-body">
<ul>
<li class="subnav-products"><a href="{% url 'dashboard:products' %}">{% trans "Products" %}</a></li>
@@ -69,12 +69,12 @@
<li class="divider"></li>
<li>
- <a class="waves-effect waves-teal collapsible-header{% block menu_orders_class %}{% endblock %}">{% trans "Orders" %}</a>
+ <a class="waves-effect waves-teal collapsible-header{% block menu_sales_class %}{% endblock %}">{% trans "Sales" %}</a>
<div class="collapsible-body">
<ul>
- <li class="subnav-order-list"><a href="{% url 'dashboard:orders' %}">{% trans "List" %}</a></li>
- <li class="subnav-attributes"><a href="{% url 'dashboard:payments' %}">{% trans "Payments" %}</a></li>
+ <li class="subnav-order-list"><a href="{% url 'dashboard:orders' %}">{% trans "Orders" %}</a></li>
<li class="subnav-categories"><a href="{% url 'dashboard:customers' %}">{% trans "Customers" %}</a></li>
+ <li class="subnav-attributes"><a href="{% url 'dashboard:payments' %}">{% trans "Payments" %}</a></li>
</ul>
</div>
</li>
diff --git a/saleor/dashboard/templates/dashboard/includes/_back-link.html b/saleor/dashboard/templates/dashboard/includes/_back-link.html
index 1e9e6b4608..c5417180ff 100644
--- a/saleor/dashboard/templates/dashboard/includes/_back-link.html
+++ b/saleor/dashboard/templates/dashboard/includes/_back-link.html
@@ -1 +1 @@
-<a href="{{ url }}{{ hash }}" class="header-button"><i class="mdi-navigation-arrow-back"></i></a>
+<a href="{{ url }}{% if hash %}{{ hash }}{% endif %}" class="header-button"><i class="mdi-navigation-arrow-back"></i></a>
diff --git a/saleor/dashboard/templates/dashboard/product/list.html b/saleor/dashboard/templates/dashboard/product/list.html
index ae87f6657d..ad5350c3d4 100644
--- a/saleor/dashboard/templates/dashboard/product/list.html
+++ b/saleor/dashboard/templates/dashboard/product/list.html
@@ -23,7 +23,7 @@
</ul>
{% endblock %}
-{% block menu_store_class %} active{% endblock %}
+{% block menu_catalogue_class %} active{% endblock %}
{% block content %}
<div class="row">
@@ -39,9 +39,7 @@
<a class="title" href="{% url 'dashboard:product-update' pk=product.pk %}">
<span class="product-list-name">{{ product.name }}</span>
</a>
- <p class="secondary-content product-list-price">{% gross product.price %}</p>
- <a href="{% url 'dashboard:product-delete' pk=product.pk %}" title="{% trans "Delete product" %}"
- class="secondary-content materialize-red-text text-lighten-2 product-list-item-delete"><i class="mdi-action-delete"></i></a>
+ <p class="product-list-price">{% gross product.price %}</p>
</li>
{% endfor %}
</ul>
diff --git a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
index 8c8a0b3502..e023501a78 100644
--- a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
@@ -3,34 +3,46 @@
{% load prices_i18n %}
{% load staticfiles %}
-{% block title %}{% trans "Delete product" %} - {{ block.super }}{% endblock %}
+{% block title %}{% trans "Delete" %} {{ product }} - {{ block.super }}{% endblock %}
-{% block body_class %}body-products{% endblock %}
+{% block body_class %}body-store body-products{% endblock %}
-{% block page_title %}{% trans "Are you sure you want to delete the following product?" %}{% endblock %}
+{% block header_menu %}
+ {% url "dashboard:product-update" pk=product.pk as url %}
+ {% include "dashboard/includes/_back-link.html" with url=url %}
+{% endblock %}
+
+{% block breadcrumbs %}
+ <ul class="breadcrumbs breadcrumbs--with-menu">
+ <li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
+ <li><a href="{% url "dashboard:product-update" pk=product.pk %}">{{ product }}</a></li>
+ <li>
+ <span class="hide-on-med-and-down">{% trans "Delete product" %}</span>
+ <span class="hide-on-large-only">{% trans "Delete" %} {{ product }}</span>
+ </li>
+ </ul>
+{% endblock %}
+
+{% block menu_catalogue_class %} active{% endblock %}
{% block content %}
<form action="" method="post">
{% csrf_token %}
<div class="row">
- <div class="col m6 l4 offset-m3 offset-l4">
+ <div class="col m6 l4">
<div class="card">
<div class="card-content">
- <div class="card-title black-text">{{ object }}</div>
{% if object.images.exists %}
- <img src="{{ product.images.first.image.crop.350x350 }}" alt="" class="responsive-img">
+ <img src="{{ product.images.first.image.crop.600x600 }}" alt="" class="responsive-img">
{% else %}
<img src="{% static 'placeholders/product-image-placeholder.png' %}" alt="" class="responsive-img">
{% endif %}
</div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col m6 l4 offset-m3 offset-l4 right-align">
- <a href="{% url 'dashboard:product-update' pk=object.pk %}" 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 class="card-action">
+ <button type="submit" class="card-link red-text">{% trans "Delete" %}</button>
+ </div>
+ </div>
</div>
</div>
</form>
diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.html
index d18fb63ddb..d93b196d1a 100644
--- a/saleor/dashboard/templates/dashboard/product/product_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_form.html
@@ -8,8 +8,6 @@
{% block body_class %}body-store body-products{% endblock %}
-{% block page_title %}{{ title }}{% endblock %}
-
{% block header_menu %}
{% url "dashboard:products" as url %}
{% include "dashboard/includes/_back-link.html" with url=url %}
@@ -37,7 +35,7 @@
</ul>
{% endblock %}
-{% block menu_store_class %} active{% endblock %}
+{% block menu_catalogue_class %} active{% endblock %}
{% block content %}
<div class="row" hidden>
@@ -124,7 +122,7 @@
{% trans "Add" %}
</a>
{% else %}
- <span class="deep-purple-text">{% trans "You need to add some attributes to product to be able to add more variants." %}</span>
+ <span>{% trans "You need to add some attributes to product to be able to add more variants." %}</span>
{% endif %}
<button type="submit" class="btn-data-table btn-show-when-checked red-text" hidden>{% trans "Delete" %}</button>
@@ -217,7 +215,7 @@
<tbody>
<tr>
<td>
- <span class="deep-purple-text">{% trans "You have literally no stock." %}</span>
+ <span>{% trans "You have literally no stock." %}</span>
</td>
</tr>
</tbody>
@@ -235,7 +233,9 @@
<li class="col s6 m3 card product-gallery-item" data-id="{{ image.pk }}">
<div class="card-content">
<img class="responsive-img" src="{{ image.image.crop.300x300 }}" alt="">
- <span class="product-gallery-item-text">{{ image.alt|default:image.image.name }}</span>
+ <span class="product-gallery-item-text" title="{{ image.alt|default:image.image.name }}">
+ {{ image.alt|default:image.image.name }}
+ </span>
<a class="product-gallery-item-create light-blue-text text-lighten-1" title="{% trans "Edit image" %}"
href="{% url 'dashboard:product-image-update' product_pk=product.pk img_pk=image.pk %}">
<i class="mdi-content-create"></i>
@@ -257,7 +257,7 @@
<div class="fixed-action-btn">
<a class="btn-fab btn-fab-hidden btn-floating btn-large waves-effect waves-light teal" id="images-btn"
- href="{% url 'dashboard:product-image-add' product_pk=product.pk %}" title="{% trans "Add product" %}">
+ href="{% url 'dashboard:product-image-add' product_pk=product.pk %}" title="{% trans "Add image" %}">
<i class="mdi-content-add"></i>
</a>
</div>
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 c8d7f879b9..eb924ffbf3 100644
--- a/saleor/dashboard/templates/dashboard/product/product_image_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/product_image_confirm_delete.html
@@ -3,6 +3,13 @@
{% block title %}{% trans "Delete image" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-store body-products{% endblock %}
+
+{% block header_menu %}
+ {% url "dashboard:product-update" pk=product.pk as url %}
+ {% include "dashboard/includes/_back-link.html" with url=url hash="#images" %}
+{% endblock %}
+
{% block breadcrumbs %}
<ul class="breadcrumbs breadcrumbs--with-menu">
<li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
diff --git a/saleor/dashboard/templates/dashboard/product/product_image_form.html b/saleor/dashboard/templates/dashboard/product/product_image_form.html
index f505812029..9f0b654784 100644
--- a/saleor/dashboard/templates/dashboard/product/product_image_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_image_form.html
@@ -3,20 +3,42 @@
{% load materializecss %}
{% load static %}
-{% block title %}{{ title }} - {% trans "Images" %} - {{ block.super }}{% endblock %}
+{% block title %}
+ {% if product_image.pk %}
+ {{ product_image.image.name }}
+ {% else %}
+ {% trans "Add image" %}
+ {% endif %} - {{ block.super }}
+{% endblock %}
+
+{% block body_class %}body-store body-products{% endblock %}
+
+{% block header_menu %}
+ {% url "dashboard:product-update" pk=product.pk as url %}
+ {% include "dashboard/includes/_back-link.html" with url=url hash="#images" %}
+{% endblock %}
{% block breadcrumbs %}
<ul class="breadcrumbs">
<li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
- <li><a href="{% url "dashboard:product-update" pk=product.pk %}">{{ product }}</a></li>
- <li>{{ title }}</li>
+ <li><a href="{% url "dashboard:product-update" pk=product.pk %}#images">{{ product }}</a></li>
+ {% if product_image.pk %}
+ <li>{{ product_image.image }}</li>
+ {% else %}
+ <li>
+ <span class="hide-on-med-and-down">{% trans "Add image" %}</span>
+ <span class="hide-on-large-only">{% blocktrans %}Add image for {{ product }}{% endblocktrans %}</span>
+ </li>
+ {% endif %}
</ul>
{% endblock %}
+{% block menu_catalogue_class %} active{% endblock %}
+
{% block content %}
- <form method="post" id="product-form" enctype="multipart/form-data">
+ <form method="post" enctype="multipart/form-data">
<div class="row">
- <div class="col l8 offset-l2">
+ <div class="col l8">
<div class="row">
{% csrf_token %}
{{ form|materializecss }}
@@ -26,12 +48,11 @@
</div>
<div class="row">
- <div class="col l8 offset-l2 right-align">
- <a href="{% url 'dashboard:product-update' pk=product.pk %}#images" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
+ <div class="col l8 right-align">
{% if product_image.pk %}
- <button type="submit" class="btn"><i class="mdi-content-save"></i> {% trans "Update" %}</button>
+ <button type="submit" class="btn">{% trans "Update" %}</button>
{% else %}
- <button type="submit" class="btn"><i class="mdi-content-create"></i> {% trans "Create" %}</button>
+ <button type="submit" class="btn">{% trans "Create" %}</button>
{% endif %}
</div>
</div>
diff --git a/saleor/dashboard/templates/dashboard/product/product_variant_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/product_variant_confirm_delete.html
index cb7069bd4f..70fa54b223 100644
--- a/saleor/dashboard/templates/dashboard/product/product_variant_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/product_variant_confirm_delete.html
@@ -3,37 +3,46 @@
{% block title %}{% trans "Delete variant" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-store body-products{% endblock %}
+
+{% block header_menu %}
+ {% url "dashboard:product-update" pk=product.pk as url %}
+ {% include "dashboard/includes/_back-link.html" with url=url hash="#variants" %}
+{% endblock %}
+
{% block breadcrumbs %}
<ul class="breadcrumbs breadcrumbs--with-menu">
<li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
- <li><a href="{% url "dashboard:product-update" pk=product.pk %}"><i class="mdi-navigation-chevron-right"></i>{{ product }}</a></li>
- <li><i class="mdi-navigation-chevron-right"></i> {% trans "Delete variant" %}</li>
+ <li><a href="{% url "dashboard:product-update" pk=product.pk %}#variants">{{ product }}</a></li>
+ <li>
+ <span class="hide-on-med-and-down">{% trans "Delete variant" %}</span>
+ <span class="hide-on-large-only">{% blocktrans %}Delete variant for {{ product }}{% endblocktrans %}</span>
+ </li>
</ul>
{% endblock %}
+{% block menu_catalogue_class %} active{% endblock %}
+
{% block content %}
<form method="post">
{% csrf_token %}
<input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#variants">
<div class="row">
- {% if is_only_variant %}
- <div class="card-panel materialize-red">
- <span class="white-text">{% trans 'This is the only variant. Deleting it will make the product unavailable for your customers.' %}</span>
- </div>
- {% endif %}
- <p>{% trans 'Are you sure you want to delete the following variant?' %}</p>
- <ul class="collection">
- <li class="collection-item">
- {{ variant }}
+ <div class="col m6 l4">
+ <div class="card">
+ <div class="card-content">
+ {% if is_only_variant %}
+ <p class="red-text">{% trans 'This is the only variant. Deleting it will make the product unavailable for your customers.' %}</p>
+ {% endif %}
+
+ <h5>{{ variant }}{% if variant.name %} {{ variant.name }}{% endif %} </h5>
+ </div>
+
+ <div class="card-action">
+ <button type="submit" class="card-link red-text">{% trans "Delete" %}</button>
+ </div>
</li>
</ul>
</div>
-
- <div class="row">
- <div class="col m6 l4 offset-m3 offset-l4 right-align">
- <a href="{% url 'dashboard:product-update' pk=product.pk %}#variants" 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/stock_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/stock_confirm_delete.html
index dec10c8bd5..d163585ec1 100644
--- a/saleor/dashboard/templates/dashboard/product/stock_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/stock_confirm_delete.html
@@ -3,37 +3,43 @@
{% block title %}{% trans "Delete stock" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-store body-products{% endblock %}
+
+{% block header_menu %}
+ {% url "dashboard:product-update" pk=product.pk as url %}
+ {% include "dashboard/includes/_back-link.html" with url=url hash="#stock" %}
+{% endblock %}
+
{% block breadcrumbs %}
<ul class="breadcrumbs breadcrumbs--with-menu">
<li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
- <li><a href="{% url "dashboard:product-update" pk=product.pk %}"><i class="mdi-navigation-chevron-right"></i>{{ product }}</a></li>
- <li><i class="mdi-navigation-chevron-right"></i> {% trans "Delete stock" %}</li>
+ <li><a href="{% url "dashboard:product-update" pk=product.pk %}#stock">{{ product }}</a></li>
+ <li>
+ <span class="hide-on-med-and-down">{% trans "Delete stock" %}</span>
+ <span class="hide-on-large-only">{% blocktrans %}Delete stock for {{ product }}{% endblocktrans %}</span>
+ </li>
</ul>
{% endblock %}
+{% block menu_catalogue_class %} active{% endblock %}
+
{% block content %}
<form method="post">
{% csrf_token %}
<input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#stock">
<div class="row">
- <div class="col l12">
- <p>{% trans "Are you sure you want to delete the following stock item?" %}</p>
- <ul class="collection">
- <li class="collection-item">
- {% if stock.variant %}
- SKU: {{ stock.variant.sku }}, quantity: {{ stock.quantity }}, location: {{ stock.location }}
- {% else %}
- SKU: {{ stock.product.sku }}, quantity: {{ stock.quantity }}, location: {{ stock.location }}
- {% endif %}
- </li>
- </ul>
- </div>
- </div>
+ <div class="col m6 l4">
+ <div class="card">
+ <div class="card-content">
+ <h5>
+ {{ stock.variant.sku }} ({{ stock.variant.name }}) &ndash; {{ stock.location }}
+ </h5>
+ </div>
- <div class="row">
- <div class="col m6 l4 offset-m3 offset-l4 right-align">
- <a href="{% url 'dashboard:product-update' pk=product.pk %}#stock" 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 class="card-action">
+ <button type="submit" class="card-link red-text">{% trans "Delete" %}</button>
+ </div>
+ </div>
</div>
</div>
</form>
diff --git a/saleor/dashboard/templates/dashboard/product/stock_form.html b/saleor/dashboard/templates/dashboard/product/stock_form.html
index 520b69cc49..15376e7cd1 100644
--- a/saleor/dashboard/templates/dashboard/product/stock_form.html
+++ b/saleor/dashboard/templates/dashboard/product/stock_form.html
@@ -3,12 +3,16 @@
{% load materializecss %}
{% load static %}
-{% block title %}{{ title }} - {% trans "Stock" %} - {{ block.super }}{% endblock %}
+{% block title %}
+ {% if stock.pk %}
+ {% trans "Stock" %} {{ stock }}
+ {% else %}
+ {% trans "Add stock" %}
+ {% endif %} - {{ block.super }}
+{% endblock %}
{% block body_class %}body-store body-products{% endblock %}
-{% block page_title %}{{ title }}{% endblock %}
-
{% block header_menu %}
{% url "dashboard:product-update" pk=product.pk as url %}
{% include "dashboard/includes/_back-link.html" with url=url hash="#stock" %}
@@ -18,23 +22,35 @@
<ul class="breadcrumbs breadcrumbs--with-menu">
<li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
<li><a href="{% url "dashboard:product-update" pk=product.pk %}#stock">{{ product }}</a></li>
- <li>{{ title }}</li>
+ {% if stock.pk %}
+ <li>{% trans "Stock" %} {{ stock.variant }}</li>
+ {% else %}
+ <li>
+ <span class="hide-on-med-and-down">{% trans "Add stock" %}</span>
+ <span class="hide-on-large-only">{% blocktrans %}Add stock for {{ product }}{% endblocktrans %}</span>
+ </li>
+ {% endif %}
</ul>
{% endblock %}
+{% block menu_catalogue_class %} active{% endblock %}
+
{% block content %}
<form method="post" id="form-stock" enctype="multipart/form-data">
<div class="row">
{% csrf_token %}
- {{ form.variant|materializecss:"s12 m8 l6 offset-l2" }}
+ {{ form.variant|materializecss:"s12 m8 l6" }}
{{ form.quantity|materializecss:"s12 m4 l2" }}
- {{ form.location|materializecss:"s12 m6 l4 offset-l2" }}
+ </div>
+
+ <div class="row">
+ {{ form.location|materializecss:"s12 m6 l4" }}
{{ form.cost_price|materializecss:"s12 m6 l4" }}
<input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#stock">
</div>
<div class="row">
- <div class="col l8 offset-l2 right-align">
+ <div class="col s12 l8 right-align">
{% if stock.pk %}
<button type="submit" class="btn">{% trans "Update" %}</button>
{% else %}
diff --git a/saleor/dashboard/templates/dashboard/product/variant_form.html b/saleor/dashboard/templates/dashboard/product/variant_form.html
index eb280440a7..533a1c3784 100644
--- a/saleor/dashboard/templates/dashboard/product/variant_form.html
+++ b/saleor/dashboard/templates/dashboard/product/variant_form.html
@@ -3,12 +3,15 @@
{% load materializecss %}
{% load static %}
-{% block title %}{{ title }} - {% trans "Variants" %} - {{ block.super }}{% endblock %}
+{% block title %}
+ {% if variant.pk %}
+ {{ variant.sku }}{% if variant.name %} ({{ variant.name }}){% endif %}
+ {% else %}
+ {% trans "Add variant" %}
+ {% endif %} - {{ block.super }}{% endblock %}
{% block body_class %}body-store body-products{% endblock %}
-{% block page_title %}{{ title }}{% endblock %}
-
{% block header_menu %}
{% url "dashboard:product-update" pk=product.pk as url %}
{% include "dashboard/includes/_back-link.html" with url=url hash="#variants" %}
@@ -18,24 +21,35 @@
<ul class="breadcrumbs breadcrumbs--with-menu">
<li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
<li><a href="{% url "dashboard:product-update" pk=product.pk %}#variants">{{ product }}</a></li>
- <li>{{ title }}</li>
+ {% if variant.pk %}
+ <li>{% trans "Variant" %} {{ variant.sku }}{% if variant.name %} ({{ variant.name }}){% endif %}</li>
+ {% else %}
+ <li>
+ <span class="hide-on-med-and-down">{% trans "Add variant" %}</span>
+ <span class="hide-on-large-only">{% blocktrans %}Add variant for {{ product }}{% endblocktrans %}</span>
+ </li>
+ {% endif %}
</ul>
{% endblock %}
+{% block menu_catalogue_class %} active{% endblock %}
+
{% block content %}
<form method="post" id="form-variant" enctype="multipart/form-data">
+ {% csrf_token %}
+ <input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#variants">
<div class="row">
- {% if attributes_form.fields %}
- <div class="col s12 m6 l4">
+ <div class="col s12 m6 l4">
+ {% if attributes_form.fields %}
<div class="row">
- {% csrf_token %}
{% for attribute_field in attributes_form %}
{{ attribute_field|materializecss }}
{% endfor %}
- <input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#variants">
</div>
- </div>
- {% endif %}
+ {% else %}
+ <p>{% trans "This product has no attributes." %}</p>
+ {% endif %}
+ </div>
<div class="col s12 m6 l4">
<div class="row">
@@ -49,7 +63,7 @@
</div>
<div class="row">
- <div class="col s12{% if attributes_form.fields %} l8{% else %} m4{% endif %} right-align">
+ <div class="col s12 l8 right-align">
{% if variant.pk %}
<button type="submit" class="btn">{% trans "Update" %}</button>
{% else %}
diff --git a/saleor/static/js_src/dashboard.js b/saleor/static/js_src/dashboard.js
index 814b6ac088..ba82c2326e 100644
--- a/saleor/static/js_src/dashboard.js
+++ b/saleor/static/js_src/dashboard.js
@@ -8,7 +8,9 @@ $('ul.tabs').find('.tab').on('click', function(e) {
$('.btn-fab').addClass('btn-fab-hidden');
$(tabSelector+'-btn').removeClass('btn-fab-hidden');
});
-$('.tabs').find('a.active').parent().click();
+$(document).ready(function() {
+ $('.tabs').find('a.active').parent().click();
+});
var el = document.getElementById('product-gallery');
if (el) {
var sortable = Sortable.create(el, {
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index bad871834b..27d7480764 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -243,6 +243,10 @@ table {
font-weight: bold;
padding: 0;
text-transform: uppercase;
+
+ &:hover, &:focus {
+ background: none;
+ }
}
.fixed-action-btn {
@@ -250,7 +254,7 @@ table {
}
.btn-fab {
- transition: transform $transition-duration;
+ transition: transform $transition-duration, box-shadow $transition-duration;
i {
&:before {
@@ -260,7 +264,7 @@ table {
}
.btn-fab.btn-fab-hidden {
- transform: scale(0, 0);
+ transform: scaleX(0) scaleY(0);
i {
&:before {
@@ -269,12 +273,32 @@ table {
}
}
+.card {
+ img {
+ display: block;
+
+ @media (max-width: $small-screen) {
+ width: 100%;
+ }
+ }
+
+ .card-action {
+ button {
+ @extend a;
+ background: none;
+ border: none;
+ padding: 0;
+ }
+ }
+}
+
@import "widget/breadcrumbs";
@import "widget/category-list";
@import "widget/data-table";
@import "widget/form";
@import "widget/product-gallery";
@import "widget/product-list";
+@import "widget/ppoi";
@import "widget/select2";
@import "widget/tabs";
@import "widget/toast";
diff --git a/saleor/static/scss/widget/_breadcrumbs.scss b/saleor/static/scss/widget/_breadcrumbs.scss
index 685a85bdff..3e7f0881c5 100644
--- a/saleor/static/scss/widget/_breadcrumbs.scss
+++ b/saleor/static/scss/widget/_breadcrumbs.scss
@@ -16,7 +16,7 @@
float: none;
line-height: $header-height/2;
- @media (min-width: $small-screen-up) {
+ @media (min-width: $medium-screen-up) {
display: inline;
}
diff --git a/saleor/static/scss/widget/_ppoi.scss b/saleor/static/scss/widget/_ppoi.scss
new file mode 100644
index 0000000000..977ac91764
--- /dev/null
+++ b/saleor/static/scss/widget/_ppoi.scss
@@ -0,0 +1,14 @@
+@mixin ppoi {
+ div.ppoi-point {
+ background-color: map_get($materialize-red, lighten-3);
+ background-color: rgba(map_get($materialize-red, lighten-3), .5);
+ border-radius: 50%;
+ box-shadow: 0 0 5px 0 rgba(0,0,0,.5);
+ height: 50px;
+ width: 50px;
+ }
+}
+
+.point-stage {
+ @include ppoi;
+}
diff --git a/saleor/static/scss/widget/_product-list.scss b/saleor/static/scss/widget/_product-list.scss
index 2cfb24f917..73f95524f5 100644
--- a/saleor/static/scss/widget/_product-list.scss
+++ b/saleor/static/scss/widget/_product-list.scss
@@ -1,6 +1,21 @@
@mixin product-list {
- & &-item {
- padding-right: 40px;
+ border: none;
+ overflow: visible;
+
+ & &-item.avatar {
+ border: none;
+ padding-left: 59px;
+ padding-right: 0;
+ padding-bottom: 3px;
+ min-height: 0;
+
+ @media (max-width: $small-screen) {
+ margin-right: -$gutter-width/2;
+ }
+
+ .circle {
+ left: 0;
+ }
&-delete {
background: white;
@@ -29,10 +44,8 @@
}
&-price {
- @media (max-width: $small-screen) {
- position: static !important;
- float: left;
- }
+ border-bottom: 1px solid $collection-border-color;
+ padding-bottom: 12px;
}
}