support paginated history, branches, tags

This commit is contained in:
Trevor Bentley
2023-01-12 20:19:48 +01:00
parent c60b1d26a0
commit 273d62c645
9 changed files with 404 additions and 25 deletions
+23
View File
@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block content %}
<table class="branches">
<tr>
<th>Branch</th>
<th>Commit ID</th>
<th>Message</th>
<th>Author</th>
<th>Date</th>
</tr>
{% for entry in branches -%}
<tr class="branch">
<td class="name"><a href="branch/{{entry.full_hash}}.html">{{entry.ref_name}}</a></td>
<td class="oid">{{entry.short_hash}}</td>
<td class="commit-msg" style="font-family: sans-serif;">{{entry.summary}}</td>
<td class="author">{{entry.author.name}}</td>
<td class="date">{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}</td>
</tr>
{% endfor -%}
</table>
{% if page.prev_page %}<a href="{{ page.prev_page }}">PREV</a>{% endif %} &nbsp; &nbsp; &nbsp; <a href="{{ page.cur_page }}">CUR</a> &nbsp; &nbsp; &nbsp; {%if page.next_page %}<a href="{{ page.next_page }}">NEXT</a>{% endif %}<br>
{% endblock content %}
+27
View File
@@ -0,0 +1,27 @@
{% extends "base.html" %}
{% block content %}
<table class="commits">
<tr>
<th>Commit ID</th>
<th>Message</th>
<th>Author</th>
<th>Date</th>
<th>Diff</th>
<th>Refs</th>
</tr>
{% for entry in history -%}
{% if loop.index0 < 250 -%}
<tr class="commit">
<td class="oid"><a href="commit/{{entry.full_hash}}.html">{{entry.short_hash}}</a></td>
<td class="commit-msg" style="font-family: sans-serif;">{{entry.summary}}</td>
<td class="author" style="font-family: sans-serif;">{{entry.author.name}}</td>
<td class="date">{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}</td>
<td class="diff">{{entry.stats.files}} (+{{entry.stats.additions}}/-{{entry.stats.deletions}})</td>
<td class="refs">{%- for ref in entry.alt_refs -%}{%- if loop.index0 > 0 -%},&nbsp; {%- endif -%}<span class="commit-ref">{{ref}}</span>{%- endfor -%}</td>
</tr>
{% endif -%}
{% endfor -%}
</table>
{% if page.prev_page %}<a href="{{ page.prev_page }}">PREV</a>{% endif %} &nbsp; &nbsp; &nbsp; <a href="{{ page.cur_page }}">CUR</a> &nbsp; &nbsp; &nbsp; {%if page.next_page %}<a href="{{ page.next_page }}">NEXT</a>{% endif %}<br>
{% endblock content %}
+9 -1
View File
@@ -1,6 +1,10 @@
{% extends "base.html" %}
{% block content %}
<a href="history.html">Commit history</a><br>
<a href="branches.html">All branches</a><br>
<a href="tags.html">All tags</a><br>
<br/>
<table class="commits">
<tr>
<th>Commit ID</th>
@@ -11,7 +15,7 @@
<th>Refs</th>
</tr>
{% for entry in history -%}
{% if loop.index0 < 250 -%}
{% if loop.index0 < 10 -%}
<tr class="commit">
<td class="oid"><a href="commit/{{entry.full_hash}}.html">{{entry.short_hash}}</a></td>
<td class="commit-msg" style="font-family: sans-serif;">{{entry.summary}}</td>
@@ -33,6 +37,7 @@
<th>Date</th>
</tr>
{% for entry in branches -%}
{% if loop.index0 < 10 -%}
<tr class="branch">
<td class="name"><a href="branch/{{entry.full_hash}}.html">{{entry.ref_name}}</a></td>
<td class="oid">{{entry.short_hash}}</td>
@@ -40,6 +45,7 @@
<td class="author">{{entry.author.name}}</td>
<td class="date">{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}</td>
</tr>
{% endif -%}
{% endfor -%}
</table>
@@ -52,6 +58,7 @@
<th>Date</th>
</tr>
{% for entry in tags -%}
{% if loop.index0 < 10 -%}
<tr class="tag">
<td class="name"><a href="tag/{{entry.full_hash}}.html">{{entry.ref_name}}</a></td>
<td class="oid">{{entry.short_hash}}</td>
@@ -59,6 +66,7 @@
<td class="author">{{entry.author.name}}</td>
<td class="date">{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}</td>
</tr>
{% endif -%}
{% endfor -%}
</table>
+23
View File
@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block content %}
<table class="tags">
<tr>
<th>Tag</th>
<th>Commit ID</th>
<th>Message</th>
<th>Author</th>
<th>Date</th>
</tr>
{% for entry in tags -%}
<tr class="tag">
<td class="name"><a href="tag/{{entry.full_hash}}.html">{{entry.ref_name}}</a></td>
<td class="oid">{{entry.short_hash}}</td>
<td class="commit-msg" style="font-family: sans-serif;">{{entry.summary}}</td>
<td class="author">{{entry.author.name}}</td>
<td class="date">{{ts_to_date(ts=entry.ts_utc, tz=entry.ts_offset)}}</td>
</tr>
{% endfor -%}
</table>
{% if page.prev_page %}<a href="{{ page.prev_page }}">PREV</a>{% endif %} &nbsp; &nbsp; &nbsp; <a href="{{ page.cur_page }}">CUR</a> &nbsp; &nbsp; &nbsp; {%if page.next_page %}<a href="{{ page.next_page }}">NEXT</a>{% endif %}<br>
{% endblock content %}