{% extends "base.html" %}

{% block title %}commits - {{ repo }}{% endblock %}
{% block og_title %}commits - {{ repo }}{% endblock %}
{% block og_description %}commit history for {{ repo }}{% endblock %}

{% block breadcrumbs %}
<ul>
  <li><a href="{{ site.base_url }}/">{{ site.site_name }}</a></li>
  <li><a href="{{ site.base_url }}/{{ 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="{{ site.base_url }}/{{ 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|short }}</span>
      <span class="commit-date">{{ commit.date }}</span>
    </a>
    {% endfor %}
  </div>
</div>
<nav class="pagination">
  {% if after.is_some() %}<a href="?"><span class="pagination-sym">&lt;</span> <span>newer</span></a>{% else %}<span></span>{% endif %}
  {% if let Some(cursor) = next_cursor %}<a href="?after={{ cursor }}"><span>older</span> <span class="pagination-sym">&gt;</span></a>{% else %}<span></span>{% endif %}
</nav>
{% endif %}
{% endblock %}
