{% load static %}
{% if not archive_versions %}
<p class="versions-empty glass-card">There are no archived releases{% if sub_product %} for this module{% else %} for this product{% endif %}.</p>
{% elif distribution_installable %}
<div class="versions-table-wrap glass-card fade-in">
  <table class="versions-table">
    <thead>
      <tr>
        <th scope="col">Version</th>
        {% for fname, label, icon in archive_specs %}
        <th scope="col">{{ label }}</th>
        {% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for row in archive_rows_installable %}
      <tr>
        <th scope="row">
          <span class="versions-table-version">{{ row.version_obj.version }}</span>
          {% include "products/_release_channel_badge.html" with version=row.version_obj %}
        </th>
        {% for cell in row.cells %}
        <td>
          {% if cell.url %}
            {% if cell.icon %}
            <a href="{{ cell.url }}" class="versions-table-link"{% if cell.external %} target="_blank" rel="noopener noreferrer"{% endif %}>
              <img src="{% static cell.icon %}" alt="" width="22" height="22" class="versions-table-icon" aria-hidden="true" />
              <span class="sr-only">{{ cell.label }}</span>
            </a>
            {% else %}
            <a href="{{ cell.url }}" class="versions-table-text-link"{% if cell.external %} target="_blank" rel="noopener noreferrer"{% endif %}>Source</a>
            {% endif %}
          {% else %}
          <span class="versions-na">—</span>
          {% endif %}
        </td>
        {% endfor %}
      </tr>
      {% if row.version_obj.release_notes %}
      <tr class="versions-notes-row">
        <td colspan="{{ archive_specs|length|add:1 }}">
          <span class="versions-notes-label">Notes</span>
          <p class="versions-notes-body">{{ row.version_obj.release_notes }}</p>
        </td>
      </tr>
      {% endif %}
      {% endfor %}
    </tbody>
  </table>
</div>
{% else %}
<ul class="versions-package-list" role="list">
  {% for ver in archive_versions %}
  <li class="versions-package-card glass-card fade-in">
    <div class="versions-package-head">
      <div class="pkg-version-meta">
        <span class="download-version">{{ ver.version }}</span>
        {% include "products/_release_channel_badge.html" with version=ver %}
      </div>
      {% if ver.package_resource_url %}
      <a href="{{ ver.package_resource_url }}" class="btn-ghost btn--sm" target="_blank" rel="noopener noreferrer">{{ package_resource_button_text }}</a>
      {% endif %}
    </div>
    {% if ver.release_notes %}
    <p class="versions-notes-body">{{ ver.release_notes }}</p>
    {% endif %}
  </li>
  {% endfor %}
</ul>
{% endif %}
