{% load static %}
{% load i18n %}
{% load thumbnail %}
{% load absurl %}
<li class="subcol-fourth geo-item" id="item{{ item.pk }}">
{% ifequal item.content_type.model "fragment" %}
    {% with fragment=item.content_object %}
	<a draggable="true"  data-title="{{ fragment.title }}" 
	   data-description="{% trans 'Fragment from' %} {{ fragment.image.metadata.titre|default:_('No title') }} {% trans 'Annotated by' %} {{ fragment.author }}" 
	   href="{% url 'view_fragment' fragment_pk=fragment.pk %}">
	  <div class="center-image">
	    <div class="image-and-fragment square-fragment-225">
	        {% with image=fragment.image.info.image_file %}
	        {% include "partial/fragment_only.html" %}
	        {% endwith %}
	    </div>
	  </div>
	</a>
	<div class="content">
	    <a href="{% url 'view_fragment' fragment_pk=fragment.pk %}"><h3>{{ fragment.title }}</h3></a>
	    <p>{{ item.description }}</p>
	</div>
	<div class="tools-2">
	    <ul class="clearfix">
            <li><a class="tool twitter" target="_blank" href="https://twitter.com/share?url={% absurl 'view_fragment' fragment_pk=fragment.pk %}" title="{% trans 'Share on Twitter'%}"></a></li>
            <li><a class="tool facebook" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u={% absurl 'view_fragment' fragment_pk=fragment.pk %}" 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>
            {% if user.is_authenticated %}{% ifequal col.author user %}
            <li><a class="tool trash" href="{% url 'remove_item' %}?collection_pk={{col.pk}}&item_pk={{item.pk}}" onclick="return confirm('{% trans "Do you really want to remove this item from this collection ? Warning : this action est irreversible." %}')" title="{% trans 'Remove from this collection' %}" ></a></li>
            {% endifequal %}{% endif %}
	    </ul>
	</div>
    {% endwith %}
{% else %}
  {% with img=item.content_object %}
	<a draggable="true" data-title="{{ img.metadata.titre|default:_('No title') }}" data-description="{% trans 'Author' %} : {{ img.metadata.auteur|default:_('Not documented') }}" 
	   href="{% url 'annotate_picture' image_id=img.id %}">
	<div class="center-image">
	{% with img.info.image_file as image %}
	{% if image %}
	 {% if image|is_portrait %}
	   {% thumbnail image "x225" 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="225" height="225" class="placeholder" />
	   {% endthumbnail %}
	 {% else %}
	   {% thumbnail image "225" 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=225" height="225" class="placeholder" />
	   {% endthumbnail %}
	 {% endif %}
	{% else %}
	     <img src="{% static 'egonomy/img/empty.gif' %}" width=225" height="225" class="placeholder" />
	{% endif %}
	{% endwith %}
	</div>
    </a>
	<div class="content">
	    <a href="{% url 'annotate_picture' image_id=img.id %}"><h3>{{ img.metadata.titre|default:_("No title") }}</h3></a>
	    <p>{{ item.description }}</p>
	</div>
	<div class="tools-2">
	    <ul class="clearfix">
            <li><a class="tool twitter" target="_blank" href="https://twitter.com/share?url={% absurl 'annotate_picture' image_id=img.id %}" title="{% trans 'Share on Twitter'%}"></a></li>
            <li><a class="tool facebook" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u={% absurl 'annotate_picture' image_id=img.id %}" 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>
            {% if user.is_authenticated %}{% ifequal col.author user %}
            <li><a class="tool trash" href="{% url 'remove_item' %}?collection_pk={{col.pk}}&item_pk={{item.pk}}" onclick="return confirm('{% trans "Do you really want to remove this item from this collection ? Warning : this action est irreversible." %}')" title="{% trans 'Remove from this collection' %}" ></a></li>
            {% endifequal %}{% endif %}
	    </ul>
	</div>
  {% endwith %}
{% endifequal %}
</li>