{% extends "agenda/base.html" %}
{% load compress %}
{% load i18n %}
{% load rich_text %}

{% block title %}{{ submission.title }} ::{% endblock %}
{% block meta_title %}{{ submission.title }}{% endblock %}
{% block social_title %}{{ submission.title }}{% endblock %}
{% block meta_description %}{{ submission_description }}{% endblock %}
{% block social_description %}{{ submission_description }}{% endblock %}
{% block meta_image %}{% if submission.image %}<meta property="thumbnail" content="{{ submission.urls.image.full }}">
    <meta property="og:image" content="{{ submission.urls.image.full }}">{% elif request.event.logo %}<meta property="thumbnail" content="{{ request.event.urls.logo.full }}">
    <meta property="og:image" content="{{ request.event.urls.logo.full }}">{% endif %}{% endblock %}
{% block alternate_link %}
    <link rel="alternate" type="application/json" title="{{ request.event.name }} API" href="{{ request.event.api_urls.talks.full }}{{ submission.code }}" />
{% endblock %}

{% block agenda_content %}
<article>
    <h3 class="talk-title">
        <div class="heading-with-buttons">
        {{ submission.title }}
        <div class="buttons" id="talk-buttons">
            {% if submission.state == 'confirmed' %}
            <a class="btn btn-outline-primary" href="{{ submission.urls.ical }}">
                <i class="fa fa-calendar"></i> .ical
            </a>
            {% endif %}
            {% if submission.does_accept_feedback and not is_html_export %}
                <a href="{{ submission.urls.feedback }}"
                        class="btn btn-success">
                    <i class="fa fa-comments"></i> {{ phrases.agenda.feedback }}
                </a>
            {% endif %}
            {% if request.user in submission.speakers.all %}
                <a href="{{ submission.urls.user_base }}"
                        class="btn btn-info">
                    <i class="fa fa-edit"></i> {{ phrases.base.edit }}
                </a>
            {% endif %}
        </div>
        </div>
        <small>
            {% if talk_slots|length == 1 %}
                {{ talk_slots.0.start.date|date:"c" }}, {{ talk_slots.0.start|date:"H:i" }}–{{ talk_slots.0.end|date:"H:i" }}, {{ talk_slots.0.room.name }}
            {% endif %}
            {% if submission.do_not_record %}
                <span class="fa-stack">
                  <i class="fa fa-video-camera fa-stack-1x"></i>
                  <i class="fa fa-ban do-not-record fa-stack-2x" aria-hidden="true" alt="{{ phrases.agenda.schedule_do_not_record }}"></i>
                </span>
                <em>{{ phrases.agenda.schedule.do_not_record }}</em>
            {% endif %}
        </small>
    </h3>
    <div class="talk row">
        <div class="talk-content col-lg-8 col-md-6 col-xs-12">
            {% if talk_slots|length > 1 %}
            <ul class="talk-slots">
                {% for talk in talk_slots %}
                <li class="talk-slot">
                    {{ talk.start.date|date:"c" }}, {{ talk.start|date:"H:i" }}–{{ talk.end|date:"H:i" }}, {{ talk.room.name }}
                </li>
                {% endfor %}
            </ul>
            {% endif %}
            {% if recording_iframe %}
                {{ recording_iframe|safe }}
            {% endif %}
            <section class="abstract">
                {{ submission.abstract|rich_text }}
            </section>
            {% if submission.abstract and submission.description %}
            <hr />
            {% endif %}
            <section class="description">
                {{ submission.description|rich_text }}
            </section>
            {% if answers %}
            <hr />
            <section class="answers">
            {% for answer in answers %}
                <span class="question"><strong>{{ answer.question.question }}</strong></span>
                <span class="answer">
                {% if answer.question.variant == 'file' %}
                    {% if answer.answer_file %}
                        <i class="fa fa-file-o"></i> <a href="{{ answer.answer_file.url }}">{{ answer.answer_file }}</a>
                    {% endif %}
                {% elif answer.question.variant == 'boolean' %}
                    – {{ answer.boolean_answer|yesno }}
                {% else %}
                    – {{ answer.answer }}
                {% endif %}
                </span>
            {% endfor %}
            {% endif %}
            </section>
            {% if submission.active_resources %}
                <section class="resources">
                    {% trans "See also:" %}
                    {% if submission.active_resources.count == 1 %}{% with resource=submission.active_resources.first %}
                        <a href="{{ resource.resource.url }}">
                            <i class="fa fa-file-o"></i>
                            {{ resource.description }}
                        </a>
                        {% endwith %}{% else %}
                        <ul>
                            {% for resource in submission.active_resources %}
                                <li>
                                    <a href="{{ resource.resource.url }}">
                                        <i class="fa fa-file-o"></i>
                                        {{ resource.description }}
                                        ({{ resource.resource.size|filesizeformat }})
                                    </a>
                                </li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </section>
            {% endif %}
        </div>
        <aside class="col-lg-4 col-md-6 col-xs-12">
            {% if submission.image %}
            <div class="image speakers">
                <a href="{{ submission.image.url }}">
                    <img src="{{ submission.image.url }}" alt="{% trans "This talk's header image" %}">
                </a>
            </div>
            {% endif %}
            {% if speakers|length %}
            <div class="speakers">
                <div class="speaker-header">
                    {% if speakers.1 %}
                        {% trans "Speakers" %}
                    {% else %}
                        {% trans "Speaker" %}
                    {% endif %}
                </div>
                {% for speaker in speakers %}
                    <div class="speaker">
                        <a href="{{ speaker.talk_profile.urls.public }}">
                            <div class="name">
                                {{ speaker.get_display_name }}
                            </div>
                        </a>
                        <div class="info">
                            {% if speaker.other_submissions.count > 1 %}
                                {{ phrases.agenda.speaker_other_talks }}
                                <ul class="speaker-talks">
                                    {% for submission in speaker.other_submissions %}
                                    <li class="speaker-talk">
                                        <a href='{{ submission.urls.public }}'>{{ submission.title }}</a>
                                    </li>
                                    {% endfor %}
                                </ul>
                            {% elif speaker.other_submissions.count == 1 %}
                                <span class="speaker-talk">
                                    {{ phrases.agenda.speaker_other_talk }}
                                    "<a href='{{ speaker.other_submissions.0.urls.public }}'>{{ speaker.other_submissions.0.title }}</a>".
                                </span>
                            {% endif %}
                        </div>
                    </div>
                {% endfor %}
            </div>
            {% endif %}
            {% if request.event.is_multilingual %}
            <div class="speakers">
                <strong>{% trans "Language" %}:</strong> {{ submission.get_content_locale_display }}
            </div>
            {% endif %}
        </aside>
    </div>
</article>
{% endblock %}
