{% extends "base.html" %}

{% block title %}commits - {{ repo }}{% endblock %}

{% block breadcrumbs %}
<ul>
  <li><a href="/">{{ crate::hostname() }}</a></li>
  <li><a href="/{{ repo }}">{{ repo }}</a></li>
  <li>commits</li>
</ul>
{% endblock %}

{% block content %}
<h1>commits</h1>

{% if commits.is_empty() %}
<p>No commits.</p>
{% else %}
<div class="commit-graph-layout">
  <div class="commit-graph-svg">{{ graph_svg|safe }}</div>
  <div class="commit-graph-rows">
    {% for commit in commits %}
    <a href="/{{ repo }}/commits/{{ commit.sha }}" class="commit-graph-row" style="border-left: 3px solid {{ commit.color }}">
      <span class="commit-message">{% for r in commit.refs %}<span class="commit-ref commit-ref-{{ r.kind }}">{{ r.name }}</span> {% endfor %}{{ commit.message }}</span>
      <span class="commit-sha">{{ commit.sha[..8] }}</span>
      <span class="commit-date">{{ commit.date }}</span>
    </a>
    {% endfor %}
  </div>
</div>
<nav class="pagination">
  {% if has_prev %}<a href="?page={{ page - 1 }}"><span class="pagination-sym">&lt;</span> <span>newer</span></a>{% else %}<span></span>{% endif %}
  {% if has_next %}<a href="?page={{ page + 1 }}"><span>older</span> <span class="pagination-sym">&gt;</span></a>{% else %}<span></span>{% endif %}
</nav>
{% endif %}
{% endblock %}
