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

{% block title %}{% trans "Home" %}{% endblock %}

{% block content %}
                <div class="fullwidth">
                    <!-- Liste des dernières images annotées -->
                    <div class="column column-half">
                        <h2>{% trans "Last annotated pictures" %}
                            <span class="right"><a href="{% url 'all_pictures' %}" alt="{% trans "All pictures" %}">{% trans "All pictures" %}</a></span></h2>
                        <ul class="fullwidth">
                          {% for img in img_list %}
                            <li class="subcol subcol-half-fourth">
                                <a 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 "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>
                    </div>
                    <!-- Liste des derniers fragments modifiés -->
                    <div class="column column-half">
                        <h2>{% trans "Last created fragments" %}
                            <span class="right"><a href="{% url 'all_fragments' %}" alt="{% trans "All fragments" %}">{% trans "All fragments" %}</a></span></h2>
                        <ul class="fullwidth">
                          {% for fragment in fragment_list %}
                            <li class="subcol subcol-half-fourth">
                                <a href="{% url 'view_fragment' fragment_pk=fragment.pk %}">
                                <div class="center-image">
                                    <div class="image-and-fragment little_square_fragment">
                                    {% with image=fragment.image.info.image_file %}
                                    {% include "partial/fragment_only.html" %}
                                    {% endwith %}
                                    </div>
                                </div>
                                <h3>{{ fragment.title }}</h3></a>
                                <h4>{% trans "Fragment from" %} <a href="{% url 'annotate_picture' image_id=fragment.image.id %}">{{ fragment.image.metadata.titre|default:_("No title") }}</a></h4>
                                <p>{% trans "Annotated by" %} <strong><a href="{% url 'user_fragments' username=fragment.author %}">{{ fragment.author }}</a></strong></p>
                            </li>
                          {% endfor %}
                        </ul>
                    </div>
                </div>
{% endblock %}

