repos
/ repos-rust master

repos-rust

mirror archived upstream

A minimal self-hosted git browser on Rust axum: bare repos rendered as a website with commits, diffs, syntax-highlighted blobs, atom feeds, and clone over HTTPS.

axumdockergitgit-browsergitoxidegixrustself-hosted

1.8 KB · 51 lines · HTML Raw History
 1{% extends "base.html" %}
 2{% block title %}{{ repo.name }} ยท {{ path or '/' }}{% endblock %}
 3
 4{% block breadcrumbs %}
 5<div class="breadcrumbs">
 6  <div class="container">
 7    <a href="/">repos</a>
 8    <span class="breadcrumbs__sep">/</span>
 9    <a href="/{{ repo.name }}">{{ repo.name }}</a>
10    <span class="breadcrumbs__sep">/</span>
11    <a href="/{{ repo.name }}/tree/{{ rev|urlencode }}">tree</a>
12    {% set cumulative = '' %}
13    {% for part in breadcrumb %}
14      {% set cumulative = cumulative ~ '/' ~ (part|urlencode) %}
15      <span class="breadcrumbs__sep">/</span>
16      <a href="/{{ repo.name }}/tree/{{ rev|urlencode }}{{ cumulative }}">{{ part }}</a>
17    {% endfor %}
18    <span class="breadcrumbs__ref">@ {{ rev }}</span>
19  </div>
20</div>
21{% endblock %}
22
23{% block main %}
24<table class="tree">
25  <tbody>
26    {% if breadcrumb %}
27    {% set parent_path = breadcrumb[:-1]|join('/')|urlencode_path %}
28    <tr>
29      <td class="tree__name"><a href="/{{ repo.name }}/tree/{{ rev|urlencode }}{% if parent_path %}/{{ parent_path }}{% endif %}">..</a></td>
30      <td class="tree__size"></td>
31    </tr>
32    {% endif %}
33    {% for e in entries %}
34    <tr>
35      <td class="tree__name tree__name--{{ e.kind }}">
36        {% set basepath = breadcrumb|join('/')|urlencode_path %}
37        {% if e.kind == 'tree' %}
38        <a href="/{{ repo.name }}/tree/{{ rev|urlencode }}/{% if basepath %}{{ basepath }}/{% endif %}{{ e.name|urlencode }}">{{ e.name }}/</a>
39        {% elif e.kind == 'blob' %}
40        <a href="/{{ repo.name }}/blob/{{ rev|urlencode }}/{% if basepath %}{{ basepath }}/{% endif %}{{ e.name|urlencode }}">{{ e.name }}</a>
41        {% else %}
42        <span>{{ e.name }}</span>
43        {% endif %}
44      </td>
45      <td class="tree__size">{% if e.size is not none %}{{ e.size|filesize }}{% endif %}</td>
46    </tr>
47    {% endfor %}
48  </tbody>
49</table>
50{% endblock %}