{% extends "./browse.html" %}

{% comment %}
Copyright (C) 2017-2018  The Software Heritage developers
See the AUTHORS file at the top-level directory of this distribution
License: GNU Affero General Public License version 3, or any later version
See top-level LICENSE file for more information
{% endcomment %}

{% load render_bundle from webpack_loader %}

{% block header %}
{{ block.super }}
{% render_bundle 'revision' %}
{% endblock %}

{% block swh-browse-content %}
{% if snapshot_context %}
  {% include "includes/top-navigation.html" %}
{% endif %}

{% if snapshot_context and snapshot_context.is_empty %}
  {% include "includes/empty-snapshot.html" %}
{% else %}
  <div class="table-responsive mb-3">
    <table class="table swh-table swh-table-striped">
      <thead>
        <tr>
          <th><i class="octicon octicon-git-commit fa-fw"></i>Revision</th>
          <th>Author</th>
          <th>Message</th>
          <th>Date</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for log in revision_log %}
          <tr class="swh-revision-log-entry">
            <td class="swh-revision-log-entry-id"><i class="octicon octicon-git-commit fa-fw"></i>{{ log.revision }}</td>
            <td class="swh-revision-log-entry-author">{{ log.author }}</td>
            <td class="swh-log-entry-message swh-table-cell-text-overflow" title="{{ log.message }}">{{ log.message }}</td>
            <td class="swh-revision-log-entry-date">{{ log.date }}</td>
            <td>{{ log.directory }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
{% endif %}
{% endblock %}

{% block swh-browse-after-content %}
{% if not snapshot_context or not snapshot_context.is_empty %}
  <ul class="pagination justify-content-center">
    {% if next_log_url %}
      <li class="page-item"><a class="page-link" href="{{ next_log_url }}">Newer</a></li>
    {% else %}
      <li class="page-item disabled"><a class="page-link">Newer</a></li>
    {% endif %}
    {% if prev_log_url %}
      <li class="page-item"><a class="page-link" href="{{ prev_log_url }}">Older</a></li>
    {% else %}
      <li class="page-item disabled"><a class="page-link">Older</a></li>
    {% endif %}
  </ul>
{% endif %}
{% endblock %}
