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

{% block title %}{% trans "All pictures" %}{% 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_pictures' %}" alt="{% trans "All pictures" %}">{% trans "All pictures" %}</a></span></h2>
		             {% else %}
		                <h2>{% trans "All pictures" %}</h2> 
		             {% endif %}
						{% if nb_pages > 1 %}<p>{% build_pagination nb_pages cur_page_nb url_pagination "contents_page clickable" %}</p>{% endif %}
                        <ul class="fullwidth">
                          {% for img in results %}
                            <li class="subcol subcol-eighth">
                                <a href="{% url 'annotate_picture' image_id=img.id %}">
                                <div class="center-image">
                                 {% with image=img.info.image_file %}
                                 {% if image %}
                                  {% if image|is_portrait %}
							 	    {% thumbnail image "x110" 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="110" height="110" class="placeholder" />
	                                {% endthumbnail %}
	                              {% else %}
                                    {% thumbnail image "110" 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=110" height="110" class="placeholder" />
                                    {% endthumbnail %}
	                              {% endif %}
	                             {% else %}
	                                  <img src="{% static 'egonomy/img/empty.gif' %}" width=110" height="110" class="placeholder" />
	                             {% endif %}
	                             {% endwith %}
                                </div>
                                <h3>{{ img.metadata.titre|default:_("No title") }}</h3></a>
                                <p>{% trans "Author" %}&nbsp;: <strong>{{ img.metadata.auteur|default:_("Not documented") }}</strong></p>
                            </li>
                          {% endfor %}
                        </ul>
                        {% if nb_pages > 1 %}<p>{% build_pagination nb_pages cur_page_nb url_pagination "contents_page clickable" %}</p>{% endif %}
                    </div>
                </div>
{% endblock %}

