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

{% block title %}{{ talk.submission.title }}{% endblock %}
{% block meta_title %}{{ talk.submission.title }}{% endblock %}
{% block social_title %}{{ talk.submission.title }}{% endblock %}
{% block meta_description %}{{ submission_description }}{% endblock %}
{% block social_description %}{{ submission_description }}{% endblock %}

{% block agenda_content %}

    <h3 class="talk-title">
        <div>
        »{{ talk.submission.title }}«
        <div class="buttons pull-right">
            <a class="btn btn-outline-primary" href="{{ talk.submission.urls.ical }}">
                <span class="fa fa-calendar"></span> .ical
            </a>
            {% if talk.submission.does_accept_feedback and not is_html_export %}
                <a href="{{ talk.submission.urls.feedback }}"
                        class="btn btn-primary">
                    <span class="fa fa-comments"></span>{{ phrases.agenda.feedback }}
                </a>
            {% endif %}
            {% if request.user in talk.submission.speakers.all %}
                <a href="{{ talk.submission.urls.user_base }}"
                        class="btn btn-secondary">
                    <span class="fa fa-pencil"></span>{{ phrases.base.edit }}
                </a>
            {% endif %}
        </div>
        </div>
        <small>
            {{ talk.start.date|date:"c" }}, {{ talk.start|date:"H:i" }}–{{ talk.end|date:"H:i" }}, {{ talk.room.name }}
            {% if talk.submission.do_not_record %}
                <span class="fa-stack">
                    <i class="fa fa-video-camera fa-stack-1x"></i>
                    <i class="fa fa-ban fa-stack-2x do-not-record" aria-hidden="true" title="{{ 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.submission.recording_url %}
                {{ talk.submission.rendered_recording_iframe|safe }}
            {% endif %}
            <div class="abstract">
                {{ talk.submission.abstract|rich_text }}
            </div>
            <div class="description">
                {{ talk.submission.description|rich_text }}
            </div>
            {% if talk.submission.active_resources.count %}
                <div class="resources">
                    {% trans "See also:" %}
                    {% if talk.submission.active_resources.count == 1 %}
                        <a href="{{ talk.submission.active_resources.first.resource.url }}">
                            <i class="fa fa-file"></i>
                            {{ talk.submission.active_resources.first.description }}
                        </a>
                    {% else %}
                        <ul>
                            {% for resource in talk.submission.active_resources %}
                                <li>
                                    <a href="{{ resource.resource.url }}">
                                        <i class="fa fa-file"></i>
                                        {{ resource.description }}
                                        ({{ resource.resource.size|filesizeformat }})
                                    </a>
                                </li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </div>
            {% endif %}
        </div>
        <div class="col-lg-4 col-md-6 col-xs-12">
            {% if speakers|length %}
            <div class="speakers">
                <div class="speaker-header">
                    {% if speakers.1 %}
                        {% trans "Speakers" %}
                    {% elif speakers.0 %}
                        {% 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_talks.count > 1 %}
                                {{ phrases.agenda.speaker_other_talks }}
                                <ul class="speaker-talks">
                                    {% for talk in speaker.other_talks %}
                                    <li class="speaker-talk">
                                        <a href='{{ talk.submission.urls.public }}'>{{ talk.submission.title }}</a>
                                    </li>
                                    {% endfor %}
                                </ul>
                            {% elif speaker.other_talks.count == 1 %}
                                <span class="speaker-talk">
                                    {{ phrases.agenda.speaker_other_talk }}
                                    "<a href='{{ speaker.other_talks.0.submission.urls.public }}'>{{ speaker.other_talks.0.submission.title }}</a>".
                                </span>
                            {% endif %}
                        </div>
                    </div>
                {% endfor %}
            </div>
            {% endif %}
        </div>
    </div>
{% endblock %}
