gitar

directory.djhtml

1
{% extends "website/base.djhtml" %}
2
{% load i18n %}
3
{% load humanize %}
4
{% load static %}
5
6
{% block title %}{{ repository_name }} | Gitar{% endblock title %}
7
8
{% block stylesheets %}
9
    {{ block.super }}
10
    <style>
11
    table {
12
        display: table;
13
    }
14
    td {
15
    padding-right: 1em;
16
    }
17
    </style>
18
{% endblock stylesheets %}
19
20
{% block description %}
21
{{repository_description}}
22
{% endblock description %}
23
24
{% block header %}
25
<header>
26
    <label for="nav-drawer-toggle"></label>
27
    <h1>{{ repository_name }}</h1>  
28
</header>
29
{% endblock header %}
30
31
{% block nav %}
32
<input id="nav-drawer-toggle" type="checkbox" />
33
<nav>
34
    <label for="nav-drawer-toggle">🡠</label>
35
    <h2>{{ repository_name }}</h2>
36
    <a class="nav-link" href="{% url 'gitar-index' %}">Gitar | Index</a>
37
    <a class="nav-link" href="{% url 'about-index' %}">{% translate "Front page" %}</a>
38
    {% if subdirectories %}
39
    <hr class="half">
40
    {% endif %}
41
    {% for subdirectory in subdirectories %}
42
        <a class="nav-link" href="{% url 'gitar-path-explorer' repository_name branch subdirectory.path %}">
43
            {{ subdirectory.name }}
44
        </a>
45
    {% endfor %}
46
    <hr class="half">
47
    {% for file in files %}
48
        <a class="nav-link" href="{% url 'gitar-path-explorer' repository_name branch file.path %}">
49
        {{ file.name }}
50
        </a>
51
    {% endfor %}
52
</nav>
53
{% endblock nav %}
54
55
{% block main %}
56
<aside>
57
    <!-- Add tertiary information such as branches and licensing here.  -->
58
    <h2>{{repository_name}}</h2>
59
    <p>{{ repository_description }}</p>
60
    <h3>{% trans "Branches" %}</h3>
61
    {% for bbranch in branches %}
62
    <a href="{% url 'gitar-repository' repository_name bbranch %}">
63
        {{ bbranch }}
64
    </a><br>
65
    {% endfor %}
66
    {% comment %}<h5 class="{{mdc}}-text">{% trans "Extra information" %}</h5>
67
    <div class="chip">
68
        {{repository_language}}
69
        <i class="material-icons {{mdac}}-text text-accent-3">code</i>
70
    </div><br />
71
    <div class="chip">
72
        {{repository_license}}
73
        <i class="material-icons {{mdac}}-text text-accent-3">copyright</i>
74
    </div>
75
    {% endcomment %}
76
</aside>
77
<section>
78
    <h2>{% translate "Content" %}</h2>
79
    <!--Tree contents-->
80
    <!-- Subdirectories -->
81
    {% if subdirectories %}
82
    <table>
83
        <thead>
84
            <tr>
85
                <th scope="col">{% translate "Subdirectories" %}</th>
86
            </tr>
87
        </thead>
88
        <tbody>
89
            {% for subdirectory in subdirectories %}
90
            <tr>
91
                <th>
92
                <a href="{% url 'gitar-path-explorer' repository_name branch subdirectory.path %}">
93
                    {{subdirectory.name}}
94
                </a>
95
                </th>
96
            </tr>
97
            {% endfor %}
98
        </tbody>
99
    </table>
100
    {% endif %}
101
    <!-- Files -->
102
    <table>
103
        <thead>
104
            <tr>
105
                <th scope="col">{% translate "File name" %}</th>
106
                <th scope="col">{% translate "Latest commit" %}</th>
107
                <th scope="col">{% translate "Latest update" %}</th>
108
            </tr>
109
        </thead>
110
        <tbody>
111
            {% for file in files %}
112
            <tr>
113
                <td><a href="{% url 'gitar-path-explorer' repository_name branch file.path %}">
114
                    {{ file.name }}</a></td>
115
                <td><a href="{% url 'gitar-commit' repository_name file.commit.hash %}">
116
                    {{ file.commit.msg|truncatewords_html:10 }}</a></td>
117
                <td style="text-align:right;">{% if file.older_than_one_month %}
118
                    {{ file.commit.committer_date|date }}
119
                    {% else %}
120
                    {{ file.commit.committer_date|naturaltime }}
121
                    {% endif %}
122
                    </td>
123
            </tr>
124
            {% endfor %}
125
        </tbody>
126
    </table>
127
    <!-- Commits -->
128
    <h2>{% translate "Commits" %}</h2>
129
    <table>
130
        <thead>
131
            <tr>
132
                <th scope="col">{% translate "Hash" %}</th>
133
                <th scope="col">{% translate "Author" %}</th>
134
                <th scope="col">{% translate "Description" %}</th>
135
                <th scope="col">{% translate "Date" %}</th>
136
            </tr>
137
        </thead>
138
        <tbody>
139
            {% for commit in commits %}
140
            <tr>
141
            <td><a href="{% url 'gitar-commit' repository_name commit.hash %}">
142
                <code>{{ commit.hash|truncatechars:15 }}</code>
143
            </a></td>
144
            <td>{{ commit.author|truncatewords:2 }}</td>
145
            <td>
146
                {{ commit.description|lower|capfirst|truncatewords:10|truncatechars:80 }}{% if commit.description|last != "." %}.{% endif %}
147
            </td>
148
            <td style="text-align:right;">{{ commit.date|date:"SHORT_DATETIME_FORMAT" }}</td>
149
            {% endfor %}
150
        </tbody>
151
    </table>
152
</section>
153
{% endblock main %}
154