{% load i18n %}
{# we suppose here that "frg" has been defined #}
{% with fragment=frg.object|default:frg %}{# frg.object in search case, frg otherwise #}
<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=frg.pk %}{% if search %}?search={{ search }}&index_search={{ offset_search|add:forloop.counter0 }}&nb_results={{ nb_results }}{% endif %}">
<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=frg.pk %}"><h3>{{ frg.highlighted.title|first|safe|default:frg.title }}</h3></a>
    <p>{% trans "Fragment from" %} <a href="{% url 'annotate_picture' image_id=fragment.image.id %}">{{ fragment.image.metadata.titre|default:_("No title") }}</a>
    <br/>{% trans "Annotated by" %} <a href="{% url 'user_fragments' username=frg.author %}"><strong>{{ frg.author }}</strong></a></p>
</div>
<div class="tools-2">
    <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>
      {% if user.is_authenticated %}
        <li><a class="tool plus open-popin additemtocollection" data-type="fragment" data-id="{{ frg.pk }}" href="#add-to-collection" title="{% trans 'Add to a collection'%}"></a></li>
      {% else %}
        <li><a class="tool plus" href="{% url 'login' %}" title="{% trans 'Log in to add to a collection' %}"></a></li>
      {% endif %}
        <li><a class="tool cut" href="{% url 'create_fragment' image_id=fragment.image.id %}" title="{% trans 'Create a fragment'%}"></a></li>
      {% if user_fragments and username = user.username %}
        <li><a class="tool trash" href="{% url 'delete_fragment' %}?fragment_pk={{ frg.pk }}&next={% url 'user_fragments' user.username %}%3Fpage%3D{{ cur_page_nb }}" onclick="return confirm('{% trans "Do you really want to delete this fragment ? Warning : this action est irreversible." %}')" title="{% trans "Delete this fragment" %}"></a></li>
      {% endif %}
    </ul>
</div>
{% endwith %}