commit.djhtml
1 |
|
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 |
<link rel="stylesheet" type="text/css" href="/static/website/syntax.css" /> |
11 |
<link rel="stylesheet" type="text/css" href="/static/gitar/css/file.css" /> |
12 |
<style> |
13 |
table.highlight { |
14 |
border-collapse: collapse; |
15 |
} |
16 |
table.highlight tr { |
17 |
line-height: 1em; |
18 |
} |
19 |
|
20 |
tr.deletion { |
21 |
background-color: rgba(255, 0, 0, .1); |
22 |
} |
23 |
tr.addition { |
24 |
background-color: rgba(0, 255, 0, .1); |
25 |
} |
26 |
details summary { |
27 |
/* Okay this makes the button stretch but whatever, it's better |
28 |
than trying to fight the tables */ |
29 |
display: block; |
30 |
} |
31 |
|
32 |
section { |
33 |
overflow-x: scroll; |
34 |
} |
35 |
|
36 |
.symbol { |
37 |
text-align: right; |
38 |
/*font-weight: bolder;*/ |
39 |
/* These vendor prefixes are still necessary, yeah...*/ |
40 |
} |
41 |
.line-number { |
42 |
text-align: right; |
43 |
width: 3em; |
44 |
-moz-user-select: none; |
45 |
-webkit-user-select: none; |
46 |
-ms-user-select: none; |
47 |
user-select: none; |
48 |
} |
49 |
.line-number a { |
50 |
color: grey; |
51 |
} |
52 |
|
53 |
details span.opened { |
54 |
display: none; |
55 |
} |
56 |
details[open] span.opened { |
57 |
display: inline; |
58 |
} |
59 |
details[open] span.closed { |
60 |
display: none; |
61 |
} |
62 |
</style> |
63 |
{% endblock stylesheets %} |
64 |
|
65 |
{% block description %} |
66 |
{{ repository_name }} {{ commit.hash|truncatechars:10 }}: {{ commit.msg }} |
67 |
{% endblock description %} |
68 |
|
69 |
{% block header %} |
70 |
<header> |
71 |
<label for="nav-drawer-toggle">≡</label> |
72 |
<h1>{{ repository_name }}</h1> |
73 |
</header> |
74 |
{% endblock header %} |
75 |
|
76 |
{% block nav %} |
77 |
<input id="nav-drawer-toggle" type="checkbox" /> |
78 |
<nav> |
79 |
<label for="nav-drawer-toggle">🡠</label> |
80 |
<h2>{{ repository_name }}</h2> |
81 |
<a class="nav-link" href="{% url 'gitar-index' %}">Gitar | Index</a> |
82 |
<a class="nav-link" href="{% url 'gitar-repository' repository_name %}">{{ repository_name }} | Index</a> |
83 |
<a class="nav-link" href="{% url 'about-index' %}">{% translate "Front page" %}</a> |
84 |
<hr class="half"> |
85 |
{% for mod_file in modified_files %} |
86 |
<a class="nav-link" href="#{{ mod_file.path }}">{{ mod_file.path }}</a> |
87 |
{% endfor %} |
88 |
</nav> |
89 |
{% endblock nav %} |
90 |
|
91 |
{% block main %} |
92 |
|
93 |
<section class="emphasis"> |
94 |
<h2>{{ first_line }}</h2> |
95 |
<p>{{ other_lines|safe }}</p> |
96 |
<dl> |
97 |
<dt>{% translate "Author" %}</dt> |
98 |
<dd>{{ commit.author.name }}</dd> |
99 |
|
100 |
<dt>{% translate "Date" %}</dt> |
101 |
<dd>{{ commit.committer_date|date:"DATETIME_FORMAT" }}</dd> |
102 |
|
103 |
<dt>{% translate "Hash" %}</dt> |
104 |
<dd><samp>{{ commit.hash }}</samp></dd> |
105 |
|
106 |
{% if commit.parents|length_is:"1" %} |
107 |
<dt>{% translate "Parent" %}</dt> |
108 |
{% else %} |
109 |
<dt>{% translate "Parents" %}</dt> |
110 |
{% endif %} |
111 |
{% for parent in commit.parents %} |
112 |
<dd><samp><a href="{% url "gitar-commit" repository_name parent %}"> |
113 |
{{ parent }} |
114 |
</a></samp</dd> |
115 |
{% endfor %} |
116 |
|
117 |
{% if modified_files|length_is:"1" %} |
118 |
<dt>{% translate "Modified file" %}</dt> |
119 |
{% else %} |
120 |
<dt>{% translate "Modified files" %}</dt> |
121 |
{% endif %} |
122 |
{% for mod_file in modified_files %} |
123 |
<dd><a href="#{{ mod_file.path }}">{{ mod_file.path }}</a></dd> |
124 |
{% endfor %} |
125 |
{#<dt>{% translate "Child" %}</dt>#} |
126 |
{# <dd>{{ commit.author_date|date:"DATETIME_FORMAT" }}</dd>#} |
127 |
{# Gonna leave the email out for now, don't like email scrapers #} |
128 |
{# <dt>{% translate "E-mail" %}</dt> #} |
129 |
{# <dl>{{ commit.author.email }}</dl> #} |
130 |
</dl> |
131 |
</section> |
132 |
|
133 |
{% for mod_file in modified_files %} |
134 |
<section> |
135 |
<h3 id="{{ mod_file.path }}">{{ mod_file.path }} <a href="#{{ mod_file.path }}">¶</a></h3> |
136 |
<p> |
137 |
{{ mod_file.object.added_lines }} |
138 |
{% blocktranslate count counter=mod_file.object.added_lines %} |
139 |
addition |
140 |
{% plural %} |
141 |
additions |
142 |
{% endblocktranslate %} |
143 |
{% translate "and" %} |
144 |
{{ mod_file.object.deleted_lines }} |
145 |
{% blocktranslate count counter=mod_file.object.deleted_lines %} |
146 |
deletion. |
147 |
{% plural %} |
148 |
deletions. |
149 |
{% endblocktranslate %} |
150 |
</p> |
151 |
{% if mod_file.methods_available %} |
152 |
|
153 |
{% endif %} |
154 |
<details open> |
155 |
<summary class="ripple"><span class="closed"> {% translate "View changes" %}</span><span class="opened"> {% translate "Hide changes" %}</span> |
156 |
</summary> |
157 |
|
158 |
<table class="highlight" style="font-family: 'Fira Code', monospace;"> |
159 |
{% for row in mod_file.rows %} |
160 |
{% if row.type == "deletion" %} |
161 |
<tr class="deletion"> |
162 |
<td id="{{ mod_file.path }}-A{{ row.old_num }}" class="line-number"> |
163 |
<a href="#{{ mod_file.path }}-A{{ row.old_num }}" class="accent-on-hover-only"><pre>{{ row.old_num }}</pre> |
164 |
</a></td> |
165 |
<td class="line-number symbol">-</td> |
166 |
{% elif row.type == "addition" %} |
167 |
<tr class="addition"> |
168 |
<td class="line-number symbol">+</td> |
169 |
<td id="{{ mod_file.path }}-B{{ row.new_num }}" class="line-number"> |
170 |
<a href="#{{ mod_file.path }}-B{{ row.new_num }}" class="accent-on-hover-only"><pre>{{ row.new_num }}</pre> |
171 |
</a></td> |
172 |
{% else %} |
173 |
<tr class="nochange"> |
174 |
<td id="{{ mod_file.path }}-A{{ row.old_num }}" class="line-number"> |
175 |
<a href="#{{ mod_file.path }}-A{{ row.old_num }}" class="accent-on-hover-only"><pre>{{ row.old_num }}</pre> |
176 |
<td id="{{ mod_file.path }}-B{{ row.new_num }}" class="line-number"> |
177 |
<a href="#{{ mod_file.path }}-B{{ row.new_num }}" class="accent-on-hover-only"><pre>{{ row.new_num }}</pre> |
178 |
</a></td> |
179 |
{% endif %} |
180 |
<td style="padding-left: 1em;"><pre>{{ row.line|safe }}</pre></td> |
181 |
</tr> |
182 |
{% endfor %} |
183 |
</table> |
184 |
</details> |
185 |
</section> |
186 |
{% endfor %} |
187 |
|
188 |
{% endblock main %} |
189 |