{% extends "podcast_analyzer/app_base.html" %}
{% load i18n %}
{% block extratitle %}{% translate "Podcasts" %} - {% endblock %}

{% block breadcrumbs %}

  <li class="is-active"><a href="#" aria-current="page">{% if tag %}{% blocktranslate with tag_name=tag.name %}Podcasts tagged with {{ tag_name }}{% endblocktranslate %}{% else %}{% translate "Podcasts" %}{% endif %}</a></li>

{% endblock breadcrumbs %}

{% block extra_controls %}
  {% if not tag %}
    <div>
      <a href="{% url 'podcast_analyzer:podcast-create' %}">{% translate "Add podcast" %}</a>
    </div>
  {% endif %}
{% endblock extra_controls %}

{% block content %}
  <h1>{% translate "Podcasts" %}</h1>
  <ul>
    {% for podcast in page_obj %}
      <li>
        <article>
          {% if podcast.podcast_cached_cover_art %}
            <figure>
              <p>
                <a href="{{ podcast.get_absolute_url }}"><img src="{{ podcast.podcast_cached_cover_art.url }}" alt="Podcast cover art for {{ podcast.title }}"  width="200" height="200"/></a>
              </p>
            </figure>
          {% endif %}
          <div>
            <div>
              <p>
                <strong><a href="{{ podcast.get_absolute_url }}">{{ podcast.title }}</a></strong> <small>{% blocktranslate count counter=podcast.total_episodes %}1 episodes{% plural %}{{ counter }} episodes{% endblocktranslate %}</small>
                <br />
                <small>{% if podcast.seasons.count > 0 %}<strong>Seasons:</strong> {{ podcast.seasons.count }} | {% endif %}<strong>Total duration:</strong> {{ podcast.total_duration_timedelta }}</small>
              </p>
            </div>
          </div>
        </article>
      </li>
    {% empty %}
      <li>{% translate "There are no podcasts yet." %}</li>
    {% endfor %}
  </ul>

  {% include "podcast_analyzer/includes/pagination.html" %}

{% endblock content %}
