{% extends 'base.html.twig' %}

{% block title %}
  {{ blob.name }} ({{ blob.shortHash }}) - {{ repository.name }}
{% endblock %}

{% block header %}
  {% include 'page-header.html.twig' with { repository: repository, baseRef: blob.hash, current: 'code' } %}
{% endblock %}

{% block search %}
  {% include 'search.html.twig' with { repository: repository, commitish: blob.hash } %}
{% endblock %}

{% block body %}
  {% include 'Blob/breadcrumb.html.twig' with { repository: repository, blob: blob } %}

  {% for commitGroup, commits in commitGroups %}
    <div class="row module-row">
      <div class="col-12">
        <div class="card">
          <div class="card-header">
            {{ commitGroup|date(commit_group_date_format) }}
          </div>
          <div class="card-body p-0">
            {% include 'Commit/list-items.html.twig' with { repository: repository, commits: commits } %}
          </div>
        </div>
      </div>
    </div>
  {% endfor %}

  <nav aria-label="{{ 'REPOSITORY_COMMITS_NAV_TITLE'|trans }}">
    <ul class="pagination justify-content-center">
      <li class="page-item{{ page == 1 ? ' disabled' }}">
        <a class="page-link" href="{{ path('blob_history', { repository: repository.name, commitish: commitish, page: previousPage }) }}" aria-label="{{ 'REPOSITORY_COMMITS_NAV_NEWER'|trans }}">
          <span aria-hidden="true">&laquo;</span>
          <span>{{ 'REPOSITORY_COMMITS_NAV_NEWER'|trans }}</span>
        </a>
      </li>
      <li class="page-item{{ commitGroups|length == 0 ? ' disabled' }}">
        <a class="page-link" href="{{ path('blob_history', { repository: repository.name, commitish: commitish, page: nextPage }) }}" aria-label="{{ 'REPOSITORY_COMMITS_NAV_OLDER'|trans }}">
          <span>{{ 'REPOSITORY_COMMITS_NAV_OLDER'|trans }}</span>
          <span aria-hidden="true">&raquo;</span>
        </a>
      </li>
    </ul>
  </nav>
{% endblock %}
