{% extends 'events/display/conference/base.html' %}

{% from 'events/display/common/_conferences.html' import render_attachments %}
{% from 'events/display/indico/_common.html' import render_location, render_speakers %}
{% from 'events/timetable/display/indico/_common.html' import render_references, render_description %}

{% block page_class %}conference-page item-summary{% endblock %}

{% block title -%}
    <span class="js-mathjax">{{ subcontrib.title }}</span>
{%- endblock %}

{% block subtitle -%}
    <a href="{{ url_for('contributions.display_contribution', subcontrib.contribution) }}">
        {{ subcontrib.contribution.title }}
    </a>
{%- endblock %}

{% block description %}
    <div class="generic-data">
        <i class="icon-time header-data"></i>
        <span class="time-info">
            {% if subcontrib.timetable_entry -%}
                {{ subcontrib.timetable_entry.start_dt|format_datetime(timezone=subcontrib.event.display_tzinfo) }}
            {%- else -%}
                {% trans %}Not scheduled{% endtrans %}
            {%- endif %}
        </span>
    </div>
{% endblock %}

{% block page_actions -%}
    <div class="toolbar">
        {% if subcontrib.can_edit(session.user) -%}
            <button class="i-button icon-edit"
                    data-title="{% trans title=subcontrib.title %}Edit subcontribution '{{ title }}'{% endtrans %}"
                    title="{% trans %}Edit subcontribution{% endtrans %}"
                    data-href="{{ url_for('.manage_edit_subcontrib', subcontrib, standalone=true) }}"
                    data-ajax-dialog
                    data-reload-after></button>
        {%- endif %}
    </div>
{%- endblock %}

{% block content -%}
    {% if subcontrib.description %}
        <section>
            <div class="header">
                <div class="header-row">
                    <h3>{% trans %}Description{% endtrans %}</h3>
                </div>
            </div>
            <div class="description js-mathjax">
                {{ render_description(subcontrib) }}
            </div>
        </section>
    {% endif %}
    {{ render_speakers(subcontrib) }}
    {{ render_attachments(subcontrib) }}

    {% if subcontrib.references -%}
        <section>
            <div class="header">
                <div class="header-row">
                    <h3>{% trans %}External references{% endtrans %}</h3>
                </div>
            </div>
            {{ render_references(subcontrib, 'reference-list-conference') }}
        </section>
    {%- endif %}

    <script>
        setupAttachmentTreeView();
    </script>
{%- endblock %}
