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

{% block title %}{% trans "View a fragment" %}{% endblock %}

{% block content %}
                <div class="fullwidth">
                    <div class="column column-half">
                        <h2>{{ fragment.title }}</h2>
                        <div class="image-and-fragment">
                          {% thumbnail fragment.image.image "476" 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="476" height="476" class="placeholder" />
                          {% endthumbnail %}
                            <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">
                                <path d="{{ fragment.path }}" stroke="red" stroke-width=".002" fill="red" fill-opacity=".3" />
                            </svg>
                        </div>
                    </div>
                    <div class="column column-half">
                        <form action="#">
                            <table class="image-metadata">
                                <tr>
                                    <th>{% trans "Source picture" %}&nbsp;:</th>
                                    <td><a href="{% url 'annotate_picture' %}">{{ fragment.image.title }}</a></td>
                                </tr>
                                <tr>
                                    <th>{% trans "Fragment's description" %}&nbsp;:</th>
                                    <td>{{ fragment.description }}</td>
                                </tr>
                                <tr>
                                    <th>{% trans "Users keywords" %}</th>
                                    <td><textarea class="user-keywords">{{ fragment.users_keywords }}</textarea></td>
                                </tr>
                                <tr>
                                    <th> </th>
                                    <td><input class="user-submit" type="submit" value="{% trans 'Save keywords' %}" /></td>
                                </tr>
                                <tr>
                                    <th>{% trans "Last modification" %}&nbsp;:</th>
                                    <td>le 23 janvier 2013 par Utilisateur17</td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
                <div class="fullwidth">
                    <div class="column column-full">
                        <h2>{% trans "Fragments from this picture" %}</h2>
                        <ul class="fullwidth">
                          {% for frg in fragment_list %}
                            <li class="subcol subcol-eighth">
                                <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>
                                <p>{% trans "Annotated by" %} <strong>{{ frg.author }}</strong></p>
                            </li>
                          {% endfor %}
                        </ul>
                    </div>
                </div>
{% endblock %}

