{% load static %}
{% load i18n %}
{% load thumbnail %}
<li class="item-masonry" data-keywords="{{ item.content_object.tag_list|join:',' }}">
    <div class="curtain"></div>
    <div class="visuel-project">
    {% ifequal item.content_type.model "fragment" %}
      {% with fragment=item.content_object %}
        <a href="{% url 'view_fragment' fragment_pk=fragment.pk %}">
        <div class="center-image">
            <div class="image-and-fragment square-fragment-177">
                {% with image=fragment.image.info.image_file %}
                {% include "partial/fragment_only.html" %}
                {% endwith %}
            </div>
        </div>
        </a>
        <div class="tools toggle">
            <div class="title-project">
	           <h3>{{ fragment.title }}</h3>
               <h4>{{ fragment.author }}</h4>
	        </div>
            <ul class="clearfix">
                <li><a class="tool twitter" href="#" title="{% trans 'Share on Twitter'%}"></a></li>
                <li><a class="tool facebook" href="#" title="{% trans 'Share on Facebook'%}"></a></li>
                <li>{% if user.is_authenticated %}
                    <a class="tool plus open-popin additemtocollection" data-type="fragment" data-id="{{ fragment.pk }}" href="#add-to-collection" title="{% trans 'Add to a collection' %}"></a>
                  {% else %}
                    <a class="tool plus" href="{% url 'login' %}?next={% url 'view_fragment' fragment_pk=fragment.pk %}" title="{% trans 'Add to a collection' %}"></a>
                  {% endif %}</li>
                <li><a class="tool cut" href="{% url 'create_fragment' image_id=fragment.image.id %}" title="{% trans 'Create a fragment'%}"></a></li>
                <li><a title="Supprimer" class="tool trash" href="#"></a></li>
            </ul>
        </div>
        <div class="content-project">
            <div class="project-title">
                {% if col.author == user %}<a class="tool edit toggle" href="#"></a>{% endif %}
                <h3>{{ fragment.title }}</h3>
                <h4>{{ fragment.author }}</h4>
            </div>
            <p>{{ item.description }}</p>
        </div>
      {% endwith %}
	{% else %}
	{% with img=item.content_object %}
	 {% with img.info.image_file as image %}
        <a href="{% url 'annotate_picture' image_id=img.id %}">
	    {% if image %}
          {% thumbnail image "177" format="PNG" crop="center" as im %}
            <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
          {% empty %}
            <img src="{% static 'egonomy/img/empty.gif' %}" width="177" height="117" class="placeholder" />
          {% endthumbnail %}
	    {% else %}
            <img src="{% static 'egonomy/img/empty.gif' %}" width="177" height="177" class="placeholder" />
	    {% endif %}
        </a>
	    <div class="tools toggle">
            <div class="title-project">
                <h3>{{ img.metadata.titre }}</h3>
                <h4>{{ img.metadata.auteur }}</h4>
            </div>
            <ul class="clearfix">
                <li><a class="tool twitter" href="#" title="{% trans 'Share on Twitter'%}"></a></li>
                <li><a class="tool facebook" href="#" title="{% trans 'Share on Facebook'%}"></a></li>
                <li>{% if user.is_authenticated %}
                    <a class="tool plus open-popin additemtocollection" data-type="image" data-id="{{ img.id }}" href="#add-to-collection" title="{% trans 'Add to a collection' %}"></a>
                  {% else %}
                    <a class="tool plus" href="{% url 'login' %}?next={% url 'annotate_picture' image_id=img.id %}" title="{% trans 'Add to a collection' %}"></a>
                  {% endif %}</li>
                <li><a class="tool cut" href="{% url 'create_fragment' image_id=img.id %}" title="{% trans 'Create a fragment'%}"></a></li>
                <li><a title="Supprimer" class="tool trash" href="#"></a></li>
            </ul>
        </div>
	    <div class="content-project">
	        <div class="project-title">
	            {% if col.author == user %}<a class="tool edit toggle" href="#"></a>{% endif %}
	            <h3>{{ img.metadata.titre }}</h3>
	            <h4>{{ img.metadata.auteur }}</h4>
	        </div>
	        <p>{{ item.description }}</p>
	    </div>
	  {% endwith %}
	{% endwith %}
	{% endifequal %}
    </div>
</li>