<!--
SPDX-FileCopyrightText: 2017-present Tobias Kunze
SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms
-->

{% extends "agenda/base.html" %}

{% load i18n %}
{% load rich_text %}
{% load static %}
{% load thumbnail %}

{% block title %}{{ profile.user.get_display_name }} ::{% endblock title %}
{% block meta_title %}{{ profile.user.get_display_name }}{% endblock meta_title %}
{% block social_title %}{{ profile.user.get_display_name }}{% endblock social_title %}
{% block meta_image %}
    {% if profile.user.avatar_url and request.event.cfp.request_avatar %}
        <meta property="thumbnail" content="{{ profile.urls.social_image.full }}">
        <meta property="og:image" content="{{ profile.urls.social_image.full }}">
    {% endif %}
{% endblock meta_image %}
{% block alternate_link %}
    <link rel="alternate" type="application/json" title="{{ request.event.name }} API" href="{{ request.event.api_urls.speakers.full }}{{ profile.code }}" />
{% endblock alternate_link %}
{% block agenda_stylesheets %}
    <link rel="stylesheet" href="{% static "agenda/css/speaker.css" %}" />
{% endblock agenda_stylesheets %}

{% block agenda_content %}
    <article>
        <div class="d-flex mb-2">
            <h3 class="heading-with-buttons">
                {{ profile.user.get_display_name }}
                {% if request.event.current_schedule %}
                    <div class="buttons ml-auto flip">
                        <a class="btn btn-outline-primary" href="{{ profile.urls.talks_ical }}">
                            <i class="fa fa-calendar"></i> .ical
                        </a>
                    </div>
                {% endif %}
            </h3>
        </div>
        <div class="speaker-container">
            <section class="speaker-info">
                <div class="speaker-bio">{{ profile.biography|rich_text }}</div>
                {% if show_sidebar %}
                    <div class="speaker-avatar-container{% if short_answers %} outline-container{% endif %}">
                        {% if show_avatar %}
                            <div class="speaker-avatar">
                                <a href="{{ profile.user.avatar.url }}" data-lightbox>
                                    <img loading="lazy" width="100%" src="{{ profile.user.avatar|thumbnail:"default" }}" alt="{% translate "The speaker’s profile picture" %}">
                                </a>
                            </div>
                        {% endif %}
                        {% if short_answers or icon_answers %}
                            {% if show_avatar %}<hr />{% endif %}
                            <section class="answers">
                                {% if icon_answers %}
                                    <div class="inline-answer icon-group">
                                        {% for answer in icon_answers %}
                                            <span class="icon-link">
                                                {% include "common/answer_block.html" with answer=answer %}
                                            </span>
                                        {% endfor %}
                                    </div>
                                {% endif %}
                                {% for answer in short_answers %}
                                    <div class="inline-answer">
                                        {% include "common/answer_block.html" with answer=answer %}
                                    </div>
                                {% endfor %}
                            </section>
                        {% endif %}
                    </div>
                {% endif %}
            </section>
            {% if long_answers %}
                <hr />
                <section class="answers">
                    {% for answer in long_answers %}
                        <span class="question"><strong>{{ answer.question.question }}</strong></span>
                        <span class="answer">– {% include "common/question_answer.html" with answer=answer %}</span>
                    {% endfor %}
                </section>
            {% endif %}
            <hr />
            {% if talks %}
                <section class="speaker-talks">
                    <h4>
                        {% blocktranslate trimmed count count=talks.count %}
                            Session
                        {% plural %}
                            Sessions
                        {% endblocktranslate %}
                    </h4>
                    {% for session in talks %}
                        <a href="{{ session.submission.urls.public }}">

                            {% include "agenda/session_block.html" with show_date=True %}

                        </a>
                    {% endfor %}
                </section>
            {% endif %}
        </div>
    </article>
{% endblock agenda_content %}
