{% extends "aircox/widgets/page_item.html" %}
{% comment %}
List item for an episode.

Context variables:
- object: episode
- diffusion: episode's diffusion
- hide_schedule: if True, do not display start time
{% endcomment %}

{% load i18n easy_thumbnails_tags aircox %}

{% block title %}
{% if not object.is_published and object.program.is_published %}
<a href="{{ object.program.get_absolute_url }}">
    {{ object.program.title }}
    {% if diffusion %}
    &mdash;
    {{ diffusion.start|date:"d F" }}
    {% endif %}
</a>
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}

{% block subtitle %}
{{ block.super }}

{% if diffusion %}
    {% if not hide_schedule %}
    {% if object.category %}&mdash;{% endif %}
    <time datetime="{{ diffusion.start|date:"c" }}" title="{{ diffusion.start }}">
          {{ diffusion.start|date:"d M, H:i" }}
    </time>
    {% endif %}

    {% if diffusion.initial %}
    {% with diffusion.initial.date as date %}
    <span title="{% blocktranslate %}Rerun of {{ date }}{% endblocktranslate %}">
        {% translate "(rerun)" %}
    </span>
    {% endwith %}
    {% endif %}
{% endif %}
{% endblock %}


{% block actions %}
{% if object.sound_set.public.count %}
<button class="button" @click="player.playButtonClick($event)"
        data-sounds="{{ object.podcasts|json }}">
    <span class="icon is-small">
        <span class="fas fa-play"></span>
    </span>
</button>
{% endif %}
{% endblock %}
