SPB Git

spb/spbgit Public MIT

SPB Git — the platform hosting itself

JavaScript 73.9% CSS 11.7% Nunjucks 11.6% Shell 2.7%
2.5 KB · 41 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/partials/file-table.njk8   Purpose : Tree file table — icon, name, last commit, relative date9   License : MIT © Simon-Pierre Boucher10  ─────────────────────────────────────────────11#}<table class="file-table">12  <thead class="sr-only"><tr><th>Name</th><th>Last commit</th><th>Updated</th></tr></thead>13  <tbody>14    {% if path %}15    <tr class="file-row">16      <td class="file-name" colspan="3">17        <a href="{{ ('/' + overview.name + '/tree/' + currentRef + '/' + parentPath) if parentPath else ('/' + overview.name) }}" rel="nofollow">…</a>18      </td>19    </tr>20    {% endif %}21    {% for entry in entries %}22    <tr class="file-row">23      <td class="file-name">24        {% if entry.type == 'tree' %}25        <svg class="file-icon icon-dir" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2A1.75 1.75 0 0 0 5 1z"/></svg>26        <a href="/{{ overview.name }}/tree/{{ currentRef }}/{{ entry.path }}">{{ entry.name }}</a>27        {% else %}28        <svg class="file-icon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914z"/></svg>29        <a href="/{{ overview.name }}/blob/{{ currentRef }}/{{ entry.path }}">{{ entry.name }}</a>30        {% endif %}31      </td>32      <td class="file-commit">33        {% set lc = lastCommits[entry.name] %}34        {% if lc %}<a href="/{{ overview.name }}/commit/{{ lc.sha }}" class="muted">{{ lc.subject | truncate(70) }}</a>{% endif %}35      </td>36      <td class="file-date muted">{% if lc %}{{ lc.date | reltime }}{% endif %}</td>37    </tr>38    {% endfor %}39  </tbody>40</table>41