SPB Git

spb/spbgit Public MIT

SPB Git — the platform hosting itself

JavaScript 73.9% CSS 11.7% Nunjucks 11.6% Shell 2.7%
3.1 KB · 67 lines jinja
Raw Blame History
1{#2  ─────────────────────────────────────────────3   SPB Git — Personal Git Platform4  ─────────────────────────────────────────────5   Author  : Simon-Pierre Boucher6   Contact : contact@spboucher.ai7   File    : src/web/views/commits.njk8   Purpose : Paginated commit history9   License : MIT © Simon-Pierre Boucher10  ─────────────────────────────────────────────11#}{% extends "layout.njk" %}12{% block content %}13{% include "partials/repo-header.njk" %}1415<div class="repo-toolbar">16  <div class="ref-select-wrap">17    <label class="sr-only" for="ref-select">Branch</label>18    <select id="ref-select" class="ref-select" data-repo="{{ overview.name }}" data-kind="commits">19      {% for branch in branches %}20      <option value="{{ branch.name }}" {{ 'selected' if branch.name == currentRef }}>{{ branch.name }}{{ ' (default)' if branch.isDefault }}</option>21      {% endfor %}22      {% for tag in tags %}23      <option value="{{ tag.name }}" {{ 'selected' if tag.name == currentRef }}>tag: {{ tag.name }}</option>24      {% endfor %}25    </select>26  </div>27  {% if filterPath %}28  <p class="muted">History of <code>{{ filterPath }}</code> · <a href="/{{ overview.name }}/commits/{{ currentRef }}">clear filter</a></p>29  {% endif %}30</div>3132<ol class="commit-list">33  {% for commit in commits %}34  <li class="commit-row">35    <span class="commit-avatar" title="{{ commit.authorName }}">{{ commit.authorEmail | identicon(28) }}</span>36    <div class="commit-main">37      <div class="commit-subject">38        <a href="/{{ overview.name }}/commit/{{ commit.sha }}">{{ commit.subject }}</a>39        {% if commit.body %}40        <details class="commit-body-toggle"><summary aria-label="Show commit body">…</summary><pre class="commit-body">{{ commit.body }}</pre></details>41        {% endif %}42      </div>43      <div class="commit-meta muted">44        {{ commit.authorName }} committed {{ commit.date | reltime }}45        <span title="{{ commit.date }}">({{ commit.date | datefull }})</span>46        · {{ commit.filesChanged | num }} file{{ 's' if commit.filesChanged != 1 }} changed47        {% if commit.additions %}<span class="diff-add">+{{ commit.additions | num }}</span>{% endif %}48        {% if commit.deletions %}<span class="diff-del">−{{ commit.deletions | num }}</span>{% endif %}49      </div>50    </div>51    <button class="sha-chip copy-btn" type="button" data-copy="{{ commit.sha }}" title="Copy full SHA">{{ commit.shortSha }}</button>52  </li>53  {% else %}54  <li class="muted">No commits yet.</li>55  {% endfor %}56</ol>5758<nav class="pagination" aria-label="Commit pages">59  {% if page > 1 %}60  <a class="btn" href="?page={{ page - 1 }}{% if filterPath %}&path={{ filterPath | urlencode }}{% endif %}">← Newer</a>61  {% endif %}62  {% if hasNext %}63  <a class="btn" href="?page={{ page + 1 }}{% if filterPath %}&path={{ filterPath | urlencode }}{% endif %}">Older →</a>64  {% endif %}65</nav>66{% endblock %}67