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

{% block title %}{{ profile.user.get_display_name }} ::{% endblock %}
{% block meta_title %}{{ profile.user.get_display_name }}{% endblock %}
{% block social_title %}{{ profile.user.get_display_name }}{% endblock %}
{% block alternate_link %}
    <link rel="alternate" type="application/json" title="{{ request.event.name }} API" href="{{ request.event.api_urls.speakers.full }}{{ profile.code }}" />
{% endblock %}

{% block agenda_content %}
<article>
<div class="d-flex mb-2">
    <h3 class="heading-with-buttons">
        {{ profile.user.get_display_name }}
        <div class="buttons ml-auto">
            <a class="btn btn-outline-primary" href="{{ profile.urls.talks_ical }}">
                <i class="fa fa-calendar"></i> .ical
            </a>
        </div>
    </h3>
</div>
<div class="speaker-container">
    <section class="speaker-info">
        <div class="speaker-bio">
            {{ profile.biography|rich_text }}
        </div>
        <div class="speaker-avatar">
            {% if profile.user.get_gravatar %}
            <img width="100%" src="https://www.gravatar.com/avatar/{{ profile.user.gravatar_parameter }}" alt="{% trans "The speaker's profile picture" %}"/>
            {% elif profile.user.avatar %}
            <img width="100%" src="{{ profile.user.avatar.url }}" alt="{% trans "The speaker's profile picture" %}">
            {% endif %}
        </div>
    </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>
    <hr/>
    <section class="speaker-talks">
        <h4>{% trans "Talks" %}</h4>
        {% for talk in profile.talks %}
        <a href="{{ talk.urls.public }}"><div class="talk">
            <h5 class="talk-title">
                {{ talk.title }}
            </h5>
            <div class="talk-abstract">
                {{ talk.abstract|rich_text }}
            </div>
        </div></a>
        {% endfor %}
    </section>
</article>
{% endblock %}
