{% extends "jocondelab/front_base.html" %}
{% load i18n %}
{% load l10n %}

{% block js_import %}
    {{block.super}}
    <script type="text/javascript" src="{{STATIC_URL}}jocondelab/lib/jquery.magnific-popup.min.js"></script>
{% endblock %}

{% block js_declaration %}
    {{block.super}}
    <script type="text/javascript">
        var wikipedia_urls = {{wikipedia_urls|safe}},
            contribute_url = "{% url 'ajax_contribute' %}",
            notice_id = "{{object.id}}",
            csrf_token = "{{csrf_token}}";
    </script>
    <script type="text/javascript" src="{{STATIC_URL}}jocondelab/js/front-notice.js"></script>
{% endblock %}

{% block css_import %}
    {{block.super}}
    <link rel="stylesheet" href="{{STATIC_URL}}jocondelab/lib/magnific-popup.css" type="text/css" />
{% endblock %}

{% block css_declaration %}
    {{block.super}}
    <link rel="stylesheet" href="{{STATIC_URL}}jocondelab/css/front-notice.css" type="text/css" />
{% endblock %}

{% block title %}JocondeLab &raquo; {{title}}{% endblock %}

{% block breadcrumbs %}<a href="{% url 'front_notice' object.id %}">{{title|truncatechars:30}}</a>{% endblock %}

{% block main %}

            <ul class="notice-images">
                {% for img in images %}
                <li>
                    <a href="{{img}}" title="{{title}}">
                        <img src="{{img}}" />
                    </a>
                </li>
                {% endfor %}
            </ul>
            
            <table class="notice-datasheet">
            {% if object.titr %}
                <tr class="notice-title">
                    <th>{% trans 'Title:' %}</th>
                    <td>{{object.titr}}</td>
                </tr>
            {% endif %}
            {% if object.deno %}
                <tr {% if not object.titr %}class="notice-title"{% endif %}>
                    <th>{% trans 'Denomination:' %}</th>
                    <td>{{object.deno}}</td>
                </tr>
            {% endif %}
            {% for thesaurus, terms in terms_by_thesaurus.items %}
                <tr>
                     <th>{% trans thesaurus context 'Thesaurus label' %}{% trans ':' %}</th>
                     <td>
                         <ul class="notice-term-list">
                         {% for termtype, terms in terms.items %}
                            {% for term in terms %}
                            <li class="notice-term term-{{termtype}}"><a href="{% url 'front_search' %}?q={{term.locale_label|urlencode}}" data-dbpedia-uri="{{term.dbpedia_uri}}">{{term.locale_label}}</a></li>
                            {% endfor %}
                         {% endfor %}
                         </ul>
                     </td>
                </tr>
            {% endfor %}
            {% if object.desc %}
                <tr>
                    <th>{% trans 'Description:' %}</th>
                    <td>{{object.desc}}</td>
                </tr>
            {% endif %}
            {% if object.hist %}
                <tr>
                    <th>{% trans 'History:' %}</th>
                    <td>{{object.hist}}</td>
                </tr>
            {% endif %}
            {% if object.loca %}
                <tr>
                    <th>{% trans 'Conservation location:' %}</th>
                    <td>{{object.loca}}</td>
                </tr>
            {% endif %}
            {% if object.copy %}
                <tr class="datasheet-small">
                    <th>{% trans 'Datasheet rights:' %}</th>
                    <td>{{object.copy}}</td>
                </tr>
            {% endif %}
            {% if object.phot %}
                <tr class="datasheet-item datasheet-small">
                    <th>{% trans 'Images rights:' %}</th>
                    <td>{{object.phot}}</td>
                </tr>
            {% endif %}
            </table>
            
            <h2 style="float: left; padding: 20px 20px 0; font-size: 18px; font-weight : 800;">Contribuer</h2>
            
            <table class="notice-datasheet">
                <tr>
                    <th>{% trans 'REPR' context 'Thesaurus label' %}{% trans ':' %}</th>
                    <td>
                        <input class="notice-contribution-field" data-thesaurus="REPR" type="text" size="60" placeholder="{% trans 'What do you see in this work?' %}" />
                        <ul class="notice-term-list">
                        {% for term in contributions.REPR %}
                            <li class="notice-term term-translated"><a href="{% url 'front_search' %}?q={{term.label|urlencode}}" data-dbpedia-uri="{{term.dbpedia_uri}}">{{term.label}}</a></li>
                        {% endfor %}
                        </ul>
                    </td>
                </tr>
                <tr>
                    <th>{% trans 'SREP' context 'Thesaurus label' %}{% trans ':' %}</th>
                    <td>
                        <input class="notice-contribution-field" data-thesaurus="SREP" type="text" size="60" placeholder="{% trans 'Which other work is a source for this work?' %}" />
                        <ul class="notice-term-list">
                        {% for term in contributions.SREP %}
                            <li class="notice-term term-translated"><a href="{% url 'front_search' %}?q={{term.label|urlencode}}" data-dbpedia-uri="{{term.dbpedia_uri}}">{{term.label}}</a></li>
                        {% endfor %}</ul>
                    </td>
                </tr>
            </table>
{% endblock %}
