{% 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" %}</h2>
                        <ul class="fullwidth">
                          {% for img in img_list %}
                            <li class="subcol subcol-half-fourth">
                                <a href="{% url 'annotate_picture' %}">
                                <div class="center-image">
                                 {% if img.image %}
                                  {% if img.image|is_portrait %}
							 	    {% thumbnail img.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 img.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 %}
                                </div>
                                <h3>{{ img.title }}</h3></a>
                                <p>{% trans "Annotated by" %} <strong>{{ img.author }}</strong></p>
                            </li>
                          {% endfor %}
                        </ul>
                    </div>
                    
                    <!-- Liste des derniers fragments modifiés -->
                    <div class="column column-half">
                        <h2>{% trans "Last created fragments" %}</h2>
                        <ul class="fullwidth">
                          {% for frg in fragment_list %}
                            <li class="subcol subcol-half-fourth">
                                <a href="{% url 'view_fragment' %}">
                                <div class="center-image">
                                    <div class="image-and-fragment">
                                     {% if frg.image.image %}
		                              {% if frg.image.image|is_portrait %}
		                               {% thumbnail frg.image.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 frg.image.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 %}
                                        <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">
                                            <path d="{{ frg.path }}" stroke="red" stroke-width=".02" fill="red" fill-opacity=".3" />
                                        </svg>
                                    </div>
                                </div>
                                <h3>{{ frg.title }}</h3></a>
                                <h4>{% trans "Fragment from" %} <a href="{% url 'annotate_picture' %}">{{ frg.image.title }}</a></h4>
                                <p>{% trans "Annotated by" %} <strong>{{ frg.author }}</strong></p>
                            </li>
                          {% endfor %}
                        </ul>
                    </div>
                </div>
{% endblock %}

