{% extends "mapit/base.html" %}
{% load i18n %}

{% block title %}{{ area.name }}{% endblock title %}

{% block content %}

    {% url "mapit_index" as index_url %}
    <header class="area_info">
        <h2>{{ area.name }} <em class="area_id">ID {{ area.id }}</em></h2>
        <ul>
            <li>{%trans "Type" %}: <a href="{% url "mapit_index" %}areas/{{ area.type.code }}.html">{{ area.type.description }}</a> <small>({{ area.type.code }})</small></li>
            <li>{%trans "Exists in generations" %}: {{ area.generation_low.id }}&ndash;{{ area.generation_high.id }}</li>
            <li>{% trans "Country" %}: {{ area.list_countries|join:", "|default:"-" }}</li>
            {% if area.parent_area %}
            {% with area.parent_area.id|slugify as area_id %}
            <li>{% blocktrans with name=area.parent_area.name url=index_url|add:"area/"|add:area_id|add:".html" %}A child of <a href="{{ url }}">{{ name }}</a>.{% endblocktrans %}</li>
            {% endwith %}
            {% endif %}
            {% if postcodes_available %}
            {% if area.polygons.count or area.postcodes.count %}
            <li><a href="{% url "mapit_index" %}area/{{ area.id }}/example_postcode.html">{% trans "Example postcode" %}</a></li>
            {% endif %}
            {% endif %}
            {% if area.children.count %}
            <li><a href="{% url "mapit_index" %}area/{{ area.id }}/children.html">{% trans "Children" %}</a></li>
            {% endif %}
            {% with area.id|slugify as area_id %}
            <li>{% blocktrans with json_url=index_url|add:"area/"|add:area_id %}Get <a href="{{ json_url }}">this data as JSON</a>{% endblocktrans %}</li>
            {% endwith %}
        </ul>

        {% block area_info_extra %}{% endblock %}
    </header>

{% if area.polygons.count %}
{% include "mapit/map/init.html" %}
{% with area.id|slugify as area_id %}
{% include "mapit/map/json.html" with geojson_url="area/"|add:area_id %}
{% endwith %}
{% endif %}

    <section class="details">
        <ul>
            <li>
{% if area.polygons.count %}
                <h3>{% trans "Geometry" %}:</h3>
                <ul>
                    <li><a href="{% url "mapit_index" %}area/{{ area.id }}/geometry">{% trans "Geometry" %} (<small>JSON</small>)</a></li>
                    <li><a href="{% url "mapit_index" %}area/{{ area.id }}.wkt">WKT</a></li>
                    <li><a href="{% url "mapit_index" %}area/{{ area.id }}.geojson">GeoJSON</a></li>
                    <li><a href="{% url "mapit_index" %}area/{{ area.id }}.kml">KML</a></li>
                </ul>
{% endif %}
            </li>
            <li>
{% if area.polygons.count %}
                <h3>{% trans "Areas" %}:</h3>
                <ul>
                    <li><a rel="nofollow" href="{% url "mapit_index" %}area/{{ area.id }}/touches.html{{ geotype.touches.0 }}">{% trans "Touching this area" %}{{ geotype.touches.1 }}</a></li>
                    <li><a rel="nofollow" href="{% url "mapit_index" %}area/{{ area.id }}/overlaps.html{{ geotype.overlaps.0 }}">{% trans "Overlapping this area" %}{{ geotype.overlaps.1 }}</a></li>
                    <li><a rel="nofollow" href="{% url "mapit_index" %}area/{{ area.id }}/covered.html">{% trans "Covering this area" %}</a></li>
                    <li><a rel="nofollow" href="{% url "mapit_index" %}area/{{ area.id }}/covers.html{{ geotype.covers.0 }}">{% trans "Covered by this area" %}{{ geotype.covers.1 }}</a></li>
                    <li><a rel="nofollow" href="{% url "mapit_index" %}area/{{ area.id }}/coverlaps.html{{ geotype.coverlaps.0 }}">{% trans "Covered by or overlapping this area" %}{{ geotype.coverlaps.1 }}</a></li>
                    <li><a rel="nofollow" href="{% url "mapit_index" %}area/{{ area.id }}/intersects.html{{ geotype.intersects.0 }}">{% trans "Intersects this area" %}{{ geotype.intersects.1 }}</a></li>
                </ul>
{% endif %}
            </li>
            <li>
                <h3>{% trans "Codes" %}:</h3>
                <ul>
{% for code_type, code, code_link in codes %}
<li>{{ code_type }}:
{% if code_link %}
<a href="{{ code_link }}">{{ code }}</a>
{% else %}
{{ code }}
{% endif %}
</li>
{% empty %}
<li>{% trans "No codes found" %}.</li>
{% endfor %}
                </ul>
            </li>
            <li>
                <h3>{% trans "Alternative Names" %}</h3>
                <ul>
{% for language, name in alternative_names %}
<li>{{ name }} in <span class="language-name">{{ language }}</span></li>
{% empty %}
<li>{% trans "No alternative names found" %}.</li>
{% endfor %}

                </ul>
    </section>

{% endblock %}
