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.3 KB · 66 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/commit.njk8   Purpose : Single commit — full diff with per-file collapsible hunks9   License : MIT © Simon-Pierre Boucher10  ─────────────────────────────────────────────11#}{% extends "layout.njk" %}12{% block content %}13{% include "partials/repo-header.njk" %}1415<article class="commit-detail">16  <header class="commit-detail-header">17    <h2 class="commit-detail-subject">{{ commit.subject }}</h2>18    {% if commit.body %}<pre class="commit-body">{{ commit.body }}</pre>{% endif %}19    <div class="commit-detail-meta">20      <span class="commit-avatar">{{ commit.authorEmail | identicon(24) }}</span>21      <strong>{{ commit.authorName }}</strong>22      <span class="muted">committed {{ commit.date | reltime }} ({{ commit.date | datefull }})</span>23      <button class="sha-chip copy-btn" type="button" data-copy="{{ commit.sha }}" title="Copy full SHA">{{ commit.shortSha }}</button>24      {% for parent in commit.parents %}25      <a class="muted" href="/{{ overview.name }}/commit/{{ parent }}">parent {{ parent | truncate(7, true, '') }}</a>26      {% endfor %}27    </div>28    <p class="commit-stats">29      Showing <strong>{{ commit.files.length }}</strong> changed file{{ 's' if commit.files.length != 1 }}30      with <span class="diff-add">+{{ commit.additions | num }}</span> and <span class="diff-del">−{{ commit.deletions | num }}</span>31    </p>32  </header>3334  {% for file in commit.files %}35  <details class="diff-file" open>36    <summary class="diff-file-header">37      <span class="diff-status diff-status-{{ file.status }}">{{ file.status }}</span>38      <code class="diff-path">{% if file.status == 'renamed' %}{{ file.oldPath }}{% endif %}{{ file.newPath or file.oldPath }}</code>39      <span class="diff-counts"><span class="diff-add">+{{ file.additions }}</span> <span class="diff-del">−{{ file.deletions }}</span></span>40    </summary>41    {% if file.binary %}42    <p class="diff-binary muted">Binary file not shown.</p>43    {% else %}44    <div class="diff-table-wrap">45      <table class="diff-table">46        <tbody>47        {% for hunk in file.hunks %}48          <tr class="diff-hunk-header"><td class="diff-gutter" colspan="2"></td><td><code>{{ hunk.header }}</code></td></tr>49          {% for line in hunk.lines %}50          <tr class="diff-line diff-line-{{ line.type }}">51            <td class="diff-gutter">{{ line.old if line.old }}</td>52            <td class="diff-gutter">{{ line.new if line.new }}</td>53            <td class="diff-code"><span class="diff-sign">{{ '+' if line.type == 'add' else ('−' if line.type == 'del' else ' ') }}</span><span class="diff-content">{{ line.html | safe }}</span></td>54          </tr>55          {% endfor %}56        {% endfor %}57        </tbody>58      </table>59    </div>60    {% if file.truncated %}<p class="muted">Diff truncated — file too large.</p>{% endif %}61    {% endif %}62  </details>63  {% endfor %}64</article>65{% endblock %}66