Add typed commit links

This commit is contained in:
Joscha 2023-08-10 22:04:30 +02:00
parent 0253d2d90b
commit c3c597897c
10 changed files with 82 additions and 69 deletions

View file

@ -22,22 +22,15 @@
{% for commit in parents %}
<dt>Parent:</dt>
<dd>
<a href="{{ commit.hash }}">
{% call util::commit_short(commit.short, commit.reachable)%}
</a>
</dd>
<dd>{{ commit|safe }}</dd>
{% endfor %}
{% for commit in children %}
<dt>Child:</dt>
<dd>
<a href="{{ commit.hash }}">
{% call util::commit_short(commit.short, commit.reachable)%}
</a>
</dd>
<dd>{{ commit|safe }}</dd>
{% endfor %}
</dl>
<pre class="{% call util::r_class(reachable) %}" title="{% call util::r_title(reachable) %}">{{ message }}</pre>
<pre class="{% call util::commit_class(reachable) %}"
title="{% call util::commit_title(reachable) %}">{{ message }}</pre>
</div>
{% endblock %}

View file

@ -10,11 +10,7 @@
<dl>
{% for ref in tracked_refs %}
<dt>{{ ref.name }}</dt>
<dd>
<a href="{{ base.root }}commit/{{ ref.hash }}">
{% call util::commit_short(ref.short, ref.reachable) %}
</a>
</dd>
<dd>{{ ref.commit|safe }}</dd>
{% endfor %}
</dl>
</details>
@ -23,11 +19,7 @@
<dl>
{% for ref in untracked_refs %}
<dt>{{ ref.name }}</dt>
<dd>
<a href="{{ base.root }}commit/{{ ref.hash }}">
{% call util::commit_short(ref.short, ref.reachable) %}
</a>
</dd>
<dd>{{ ref.commit|safe }}</dd>
{% endfor %}
</dl>
</details>

View file

@ -13,7 +13,7 @@
<tr {% if task.odd %} class="odd" {% endif %}>
<td>
<a href="{{ base.root }}commit/{{ task.hash }}">
{% call util::commit_short(task.short, task.reachable) %}
{# {% call util::commit_short(task.short, task.reachable) %} #}
</a>
</td>
<td>{{ task.since }}</td>

View file

@ -1,4 +1,4 @@
{% macro r_class(reachable) %}
{% macro commit_class(reachable) %}
{%- if reachable == 0 -%}
orphaned
{%- else if reachable == 1 -%}
@ -8,7 +8,7 @@ tracked
{%- endif -%}
{% endmacro %}
{% macro r_title(reachable) %}
{% macro commit_title(reachable) %}
{%- if reachable == 0 -%}
This commit is orphaned. It can't be reached from any ref.
{%- else if reachable == 1 -%}
@ -17,7 +17,3 @@ This commit can only be reached from untracked refs.
This commit can be reached from a tracked ref.
{%- endif -%}
{% endmacro %}
{% macro commit_short(short, reachable) -%}
<span class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">{{ short }}</span>
{%- endmacro %}