{% extends "base.html" %}

{% block title %}{{ branch }} — {{ repo }}{% endblock %}

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

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

{% if commits.is_empty() %}
<p>No commits.</p>
{% else %}
<div class="commit-log">
  {% for commit in commits %}
  <a href="/{{ repo }}/commits/{{ commit.sha }}" class="commit-row">
    <span class="commit-sha">{{ commit.sha[..8] }}</span>
    <span class="commit-message">{{ commit.message }}</span>
    <span class="commit-meta"><span>{{ commit.author }}</span><span>{{ commit.date }}</span></span>
  </a>
  {% endfor %}
</div>
<nav class="pagination">
  {% if has_prev %}<a href="?page={{ page - 1 }}">← newer</a>{% endif %}
  {% if has_next %}<a href="?page={{ page + 1 }}">older →</a>{% endif %}
</nav>
{% endif %}
{% endblock %}
