{% extends "txcollections/base.html" %}
{% load i18n %}
{% load txcommontags %}
{% load pagination_tags %}

{% block body_class %}{{ block.super }} collection_list{% endblock %}

{% block title %}{{ block.super }} | {% trans "Collection list" %}{% endblock %}

{% block extra_head %}
  <link rel="alternate" type="application/rss+xml" title="RSS" href="{% url collection_latest_feed %}" />
{% endblock %}

{% block breadcrumb %}{% homelink %} &raquo; {% trans "Collections" %}{% endblock %}

{% block content_title %}<h2 class="pagetitle">
  {% if tag %}{% blocktrans %}Collections with tag '{{ tag }}'{% endblocktrans %}
  {% else %}{% trans "Collections on Transifex" %}{% endif %}
  {% render_metacount collection_list _("collections") %}
</h2>{% endblock %}

{% block content_header_sec %}
  {% if request.user.is_authenticated and perms.txcollections.add_collection %}
  <div class="addcollection content_header_sec">
    <a class="i16 add buttonized" href="{% url collection_create %}">{% trans "Add a new collection" %}</a>
  </div>
  {% endif %}
{% endblock %}

{% block content_sec %}
  <a class="simlink" href="{% url collection_latest_feed %}" title="Collections feed"><img border="0" src="{{ MEDIA_URL }}images/icons/feed.png" /></a>
{% endblock %}

{% block content_main %}
  {% autopaginate collection_list 5 %}
  <div class="collection_list obj_biglist">
  <div class="pagination top">{% paginate %}</div>
  {% for collection in collection_list %}
    <div class="entry">
      <h3 class="name"><a href="{{ collection.get_absolute_url }}">{{ collection.name }}</a></h3>
      <p class="description">{{ collection.description }}</p>
      <p>
        <span class="i16 stats compact">
          {% blocktrans count collection.releases.all|length as counter %}1 release{% plural %}{{ counter }} releases{% endblocktrans %},
          {% blocktrans count collection.projects.all|length as counter %}1 project{% plural %}{{ counter }} projects{% endblocktrans %}
        </span>
      {% if collection.tags %}| <span class="i16 tag compact">{% trans "Tags:" %} {% for tag in collection.tagsobj.all|slice:"0:6" %}<a class="tag" href="{% url collection_tag_list tag=tag %}">{{ tag }}</a> {% endfor %}</span>{% endif %}
    </div>
  {% endfor %}
  <div class="pagination bottom">{% paginate %}</div>
  </div>
  {% if not collection_list %}
  <p>{% trans "No collections registered yet. :-(" %}</p>
  {% if request.user.is_authenticated and perms.txcollections.add_collection %}
  {% url collection_create as collection_create %}
  <p>{% blocktrans %}Why don't you <a href="{{ collection_create }}">add one</a>?{% endblocktrans %}</p>
  {% endif %}
  {% endif %}
  
{% endblock %}

{% block content_footer %}
{% if request.user.is_authenticated and perms.txcollections.add_collection %}
{% url collection_create as collection_create %}
  <div id="content_footer_center">
    <p><span class="i16 tip">{% blocktrans %}Couldn't find your collection? Go ahead and <a href="{{ collection_create }}">add it</a>!{% endblocktrans %}</span></p>
  </div>
{% endif %}
{% endblock %}
