{% extends "egonomy_base.html" %}
{% load static %}
{% load i18n %}
{% load thumbnail %}
{% load navigation %}

{% block title %}{% trans "All fragments" %}{% endblock %}

{% block content %}
                <div class="fullwidth">
                    <div class="fullwidth">
                     {% if search %}
                      {% ifequal nb_results 0 %}
                        <h2>{% trans "No results for" %} &laquo;&nbsp;{{ search }}&nbsp;&raquo;&nbsp;
                      {% else %}
                        <h2>{% trans "Search results for" %} &laquo;&nbsp;{{ search }}&nbsp;&raquo;&nbsp;:
                      {% endifequal %}
                        <span class="right"><a href="{% url 'all_fragments' %}" alt="{% trans "All fragments" %}">{% trans "All fragments" %}</a></span></h2>
                     {% elif user_fragments %}
                        <h2>{% trans "Fragments created by" %} : {{ username }}
                        <span class="right"><a href="{% url 'all_fragments' %}" alt="{% trans "All fragments" %}">{% trans "All fragments" %}</a></span></h2>
                     {% else %}
                        <h2>{% trans "All fragments" %}</h2> 
                     {% endif %}
						{% if nb_pages %}<p>{% build_pagination nb_pages cur_page_nb url_pagination "contents_page clickable" %}</p>{% endif %}
                        <ul class="fullwidth">
                          {% for frg in results %}
                            <li class="subcol subcol-eighth">
                              <a href="{% url 'view_fragment' fragment_pk=frg.pk %}">
                              <div class="center-image">
                                <div class="image-and-fragment little_square_fragment">
                                 {% with fragment=frg.object|default:frg %}{# frg.object in search case, frg otherwise #}
                                 {% with image=fragment.image.info.image_file %}
                                 {% include "partial/fragment_only.html" %}
	                             {% endwith %}
                                 {% endwith %}
                                </div>
                             </div>
                             <h3>{{ frg.highlighted.title|first|safe|default:frg.title }}</h3></a>
                             <p>{% trans "Annotated by" %} <strong><a href="{% url 'user_fragments' username=frg.author %}">{{ frg.author }}</a></strong></p>
                            </li>
                          {% endfor %}
                        </ul>
                        {% if nb_pages %}<p>{% build_pagination nb_pages cur_page_nb url_pagination "contents_page clickable" %}</p>{% endif %}
                    </div>
                </div>
{% endblock %}

