{% load i18n static sekizai_tags sass_tags %}

{% addtoblock "js" %}<script src="{% static 'shop/js/utils.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'shop/js/catalog.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% add_data "ng-requires" "django.shop.catalog" %}

{% block catalog-list %}
	{% addtoblock "css" %}<link href="{% sass_src 'shop/css/catalog-list.scss' %}" rel="stylesheet" type="text/css" />{% endaddtoblock %}
	{% with product_figure=product_figure|default:"shop/catalog/product-figure.html" %}
<shop-catalog-list infinite-scroll="{% if pagination == 'paginator' %}false{% else %}true{% endif %}">
	<div ng-if="catalog.count===undefined" class="shop-catalog-list">
	{% for product in data.results %}
		<div class="shop-list-item">{% include product_figure %}</div>
	{% endfor %}
	</div>
	<div ng-cloak ng-if="catalog.count>=0" class="shop-catalog-list">
		<div class="shop-list-item" ng-repeat="product in catalog.products">
		{% include product_figure with ng=1 %}
		</div>
	</div>
</shop-catalog-list>
	{% endwith %}
{% endblock catalog-list %}

{% block pagination %}
	{% include "shop/catalog/pagination.html" %}
{% endblock %}
