{% extends 'core/page.html' %}
{% load i18n %}
{% load static %}
{% load core_tags %}
{% load metadata_tags %}

{% block heading %}

    <h1 class="overflow-hidden">
        {% if schema.title %}
        {{ schema.title }} ({{ schema }})
        {% else %}
        {{ schema }}
        {% endif %}
    </h1>

{% endblock %}

{% block page %}

    {% if schema.long_description %}

    <h2>Description</h2>
    <p>{{ schema.long_description | markdown }}</p>

    {% elif schema.description %}

    <h2>Description</h2>
    <p>{{ schema.description | markdown }}</p>

    {% endif %}

    {% if schema.attribution %}
    <h2>Attribution</h2>

    {{ schema.attribution | markdown }}
    {% endif %}

    <h2>{% trans 'Tables' %}</h2>

    {% for table in tables %}
    <div class="card mb-3">
        <div class="card-header">
            <a href="{% url 'metadata:table' schema.name table.name %}">
                <i class="bi bi-table"></i> &nbsp;
                {% if table.title %}
                {{ table.title }} ({{ table }})
                {% else %}
                {{ table.name }}
                {% endif %}
            </a>
        </div>
        <div class="card-body">
            {% if table.description %}
            {{ table.description | markdown }}
            {% else %}
            {% trans 'No description has been provided for this table.' %}
            {% endif %}
        </div>
        {% if table.doi %}
        <div class="card-footer text-muted">
            <small>
            DOI: {% doi_link table.doi %}
            </small>
        </div>
        {% endif %}
    </div>
    {% endfor %}

{% endblock %}

{% block sidebar %}

    {% access_panel schema _('schema') %}

    {% if schema.doi %}
    {% doi_panel schema.doi _('schema') %}
    {% endif %}

    {% if schema.license %}
    {% license_panel schema.license %}
    {% endif %}

{% endblock %}
