Skip to content

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

Revert categories view changes, fix indentation

weronka8b98b617f42e
diff --git a/saleor/dashboard/category/views.py b/saleor/dashboard/category/views.py
index a6e53af56d..8b30c60dd4 100644
--- a/saleor/dashboard/category/views.py
+++ b/saleor/dashboard/category/views.py
@@ -14,16 +14,12 @@ from .forms import CategoryForm
def category_list(request, root_pk=None):
root = None
path = None
- products = []
categories = Category.tree.root_nodes()
if root_pk:
- qs = Category.objects.prefetch_related('products', 'products__main_image')
root = get_object_or_404(Category, pk=root_pk)
path = root.get_ancestors(include_self=True) if root else []
categories = root.get_children()
- products = sorted(root.products.all(), key=lambda product: product)
- ctx = {'categories': categories, 'path': path, 'root': root,
- 'products': products}
+ ctx = {'categories': categories, 'path': path, 'root': root}
return TemplateResponse(request, 'dashboard/category/list.html', ctx)
diff --git a/saleor/static/js/dashboard.js b/saleor/static/js/dashboard.js
index 2e296325c9..af41343671 100644
--- a/saleor/static/js/dashboard.js
+++ b/saleor/static/js/dashboard.js
@@ -173,8 +173,8 @@ $('.datepicker').pickadate({
selectMonths: true,
hiddenName: true,
onClose: function() {
- $(document.activeElement).blur();
- }
+ $(document.activeElement).blur();
+ }
})
function initSelects() {
$('select:not(.browser-default):not([multiple])').material_select()
diff --git a/templates/dashboard/category/list.html b/templates/dashboard/category/list.html
index 8d67f358c9..d3d206d452 100644
--- a/templates/dashboard/category/list.html
+++ b/templates/dashboard/category/list.html
@@ -1,9 +1,7 @@
{% extends "dashboard/base.html" %}
{% load i18n %}
-{% load prices_i18n %}
{% load mptt_tags %}
{% load materializecss %}
-{% load staticfiles %}
{% block title %}{% trans "Categories" %} - {{ block.super }}{% endblock %}
@@ -119,27 +117,4 @@
</ul>
</div>
</div>
- {% if products %}
- <div class="row">
- <div class="col s12">
- <h5>Products in this category: {{ products|length }}</h5>
- <ul class="collection list">
- {% for product in products %}
- <li class="collection-item avatar list-item">
- {% if product.images.exists %}
- <img src="{{ product.images.first.image.crop.100x100 }}" alt="" class="circle teal">
- {% else %}
- <img src="{% static 'images/product-image-placeholder-small.png' %}" alt="" class="circle teal">
- {% endif %}
- <a class="title" href="{% url 'dashboard:product-update' pk=product.pk %}">
- <span class="list-item-name">{{ product.name }}</span>
- </a>
- <p class="list-item-price">{% gross product.price %}</p>
- </li>
- {% endfor %}
- </ul>
- {% include "dashboard/includes/_pagination.html" with page_obj=products %}
- </div>
- </div>
- {% endif %}
{% endblock %}