{% load i18n static cms_tags sekizai_tags %}{% spaceless %}

{% addtoblock "js" %}<script src="{% static 'djng/js/django-angular.min.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'shop/js/carticon-caption.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% add_data "ng-requires" "django.shop.carticon_caption" %}

{% page_url 'shop-cart' as shop_cart_url %}
{% comment %}
{% page_attribute 'menu_title' 'shop-cart' as tooltip %}
until https://github.com/divio/django-cms/issues/5930 is fixed, we must hard code the `tooltip`
context variable, otherwise this HTML fragment fails silently if the cart page does not exist.
{% endcomment %}
{% trans "Cart" as tooltip %}

<a{% if shop_cart_url %} href="{{ shop_cart_url }}" title="{{ tooltip }}"{% endif %}>
{% block carticon %}
	<i class="fa fa-shopping-cart fa-fw fa-lg" uib-tooltip="{{ tooltip }}"></i>
	<shop-carticon-caption caption-data="{num_items: {{ cart.num_items|default:0 }} }"></shop-carticon-caption>
{% endblock %}
</a>

<script id="shop/carticon-caption.html" type="text/ng-template">
{% block carticon-caption %}
	<ng-pluralize count="caption.num_items" when="{'1': '{% trans "1 Item" context "cart icon" %}', 'other': '{% trans "{} Items" context "cart icon" %}'}"></ng-pluralize>
{% endblock %}
</script>

{% endspaceless %}
