gitar

Improve date outlining in tables

Author
Maarten Vangeneugden
Date
March 8, 2024, 9:13 p.m.
Hash
885ca386cd058b5d242abcc4df94d8142f9b85a5
Parent
f84b2a4232203dafe015518fcab7d1170d4e9119
Modified file
templates/gitar/directory.djhtml

templates/gitar/directory.djhtml

2 additions and 2 deletions.

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