index : gitrs
A lightweight web interface for browsing Git repositories, implemented in Rust
about summary refs log tree commit diff
gitrs / templates / repository / tree.html
-rw-r--r-- blob b7d3ec674dc2088b388b3d675a93c48e82a5ebad 2928 bytes (plain)
1
{% extends "base.html" %}
2
3
{% block title %}{{ repo.name }} — {{ repo.description }}{% endblock %}
4
5
{% block header %}
6
  {{ macros::header(Some(repo), branch_names, Some(current_ref)) }}
7
{% endblock %}
8
9
{% block tabs %}
10
  {{ macros::repo_tabs(repo, current_ref, query, "tree") }}
11
{% endblock %}
12
13
{% let parameters = query.id_or_head_param() %}
14
15
{% block breadcrumb %}
16
  <div class="tree-breadcrumb">
17
    <a href="/{{ repo.name }}/tree/{{ parameters }}">{{ repo.name }}</a>
18
    {% for crumb in breadcrumbs %}
19
    /
20
    <a href="/{{ repo.name }}/tree/{{ crumb.path }}{{ parameters }}">{{ crumb.name }}</a>
21
    {% endfor %}
22
  </div>
23
{% endblock %}
24
25
{% block content %}
26
  {% match kind %}
27
    {% when PathView::Tree(entries) %}
28
      <table class="tree-table">
29
        <thead>
30
          <tr>
31
            <th class="mode">Mode</th>
32
            <th>Name</th>
33
            <th>Size</th>
34
          </tr>
35
        </thead>
36
        <tbody>
37
          {% if let Some(up) = parent_path %}
38
            <tr class="tree-parent">
39
              <td></td>
40
              <td><a href="/{{ repo.name }}/tree/{{ up }}{{ parameters }}">..</a></td>
41
              <td></td>
42
            </tr>
43
          {% endif %}
44
          {% for entry in entries %}
45
            <tr>
46
              <td class="mode">{{ entry.mode_display() }}</td>
47
              <td>
48
                {% match entry.kind %}
49
                  {% when EntryKind::Tree %}
50
                    <a class="folder" href="/{{ repo.name }}/tree/{{ entry.path }}/{{ parameters }}">{{ entry.name }}</a>
51
                  {% when EntryKind::Commit %}
52
                    <span class="submodule">{{ entry.name }} @ {{ entry.id }}</span>
53
                  {% when _ %}
54
                    <a href="/{{ repo.name }}/tree/{{ entry.path }}{{ parameters }}">{{ entry.name }}</a>
55
                {% endmatch %}
56
              </td>
57
              <td class="size" data-sort="{{ entry.size.unwrap_or(0) }}">{{ entry.size_display() }}</td>
58
            </tr>
59
          {% endfor %}
60
        </tbody>
61
      </table>
62
    {% when PathView::Blob(blob) %}
63
      <div class="blob-meta">
64
        <span class="mode">{{ blob.mode_display() }}</span>
65
        <span class="blob-id">blob {{ blob.id }}</span>
66
        <span class="size">{{ blob.size }} bytes</span>
67
        (<a href="/{{ repo.name }}/raw/{{ filepath }}?h={{ current_ref.name }}">plain</a>)
68
      </div>
69
      {% if let Some(lines) = blob.lines %}
70
        <table class="blob-table">
71
          <tbody>
72
            {% for line in lines %}
73
              <tr>
74
                <td class="line-no">{{ loop.index }}</td>
75
                <td class="line-content"><pre>{{ line|safe }}</pre></td>
76
              </tr>
77
            {% endfor %}
78
          </tbody>
79
        </table>
80
      {% else %}
81
        <p>Binary file not shown. <a href="/{{ repo.name }}/raw/{{ filepath }}?h={{ current_ref.name }}">Download raw</a>.</p>
82
      {% endif %}
83
  {% endmatch %}
84
{% endblock %}