Use same commit link style everywhere

This commit is contained in:
Joscha 2023-08-06 23:38:12 +02:00
parent 2b81d497bc
commit 794787a4be
10 changed files with 96 additions and 75 deletions

View file

@ -1,27 +1,8 @@
{% extends "base.html" %}
{% import "util.html" as util %}
{% block title %}{{ summary }}{% endblock %}
{% macro r_class(reachable) %}
{%- if reachable == 0 -%}
orphaned
{%- else if reachable == 1 -%}
reachable
{%- else -%}
tracked
{%- endif -%}
{% endmacro %}
{% macro r_title(reachable) %}
{%- if reachable == 0 -%}
This commit is orphaned. It can't be reached from any ref.
{%- else if reachable == 1 -%}
This commit can only be reached from untracked refs.
{%- else -%}
This commit can be reached from a tracked ref.
{%- endif -%}
{% endmacro %}
{% block body %}
<h2>Commit</h2>
<div class="commit">
@ -40,19 +21,23 @@ This commit can be reached from a tracked ref.
<dd>{{ commit_date }}</dd>
{% for commit in parents %}
<dt class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">Parent:</dt>
<dd class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">
<a href="{{ commit.hash }}">{{ commit.short }}</a>
<dt>Parent:</dt>
<dd>
<a href="{{ commit.hash }}">
{% call util::commit_short(commit.short, commit.reachable)%}
</a>
</dd>
{% endfor %}
{% for commit in children %}
<dt class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">Child:</dt>
<dd class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">
<a href="{{ commit.hash }}">{{ commit.short }}</a>
<dt>Child:</dt>
<dd>
<a href="{{ commit.hash }}">
{% call util::commit_short(commit.short, commit.reachable)%}
</a>
</dd>
{% endfor %}
</dl>
<pre class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">{{ message }}</pre>
<pre class="{% call util::r_class(reachable) %}" title="{% call util::r_title(reachable) %}">{{ message }}</pre>
</div>
{% endblock %}

View file

@ -1,4 +1,5 @@
{% extends "base.html" %}
{% import "util.html" as util %}
{% block title %}overview{% endblock %}
@ -9,7 +10,11 @@
<dl>
{% for ref in tracked_refs %}
<dt>{{ ref.name }}</dt>
<dd><a href="{{ base.root }}/commit/{{ ref.hash }}">{{ ref.short }}</a></dd>
<dd>
<a href="{{ base.root }}/commit/{{ ref.hash }}">
{% call util::commit_short(ref.short, ref.reachable) %}
</a>
</dd>
{% endfor %}
</dl>
</details>
@ -18,7 +23,11 @@
<dl>
{% for ref in untracked_refs %}
<dt>{{ ref.name }}</dt>
<dd><a href="{{ base.root }}/commit/{{ ref.hash }}">{{ ref.short }}</a></dd>
<dd>
<a href="{{ base.root }}/commit/{{ ref.hash }}">
{% call util::commit_short(ref.short, ref.reachable) %}
</a>
</dd>
{% endfor %}
</dl>
</details>

View file

@ -1,27 +1,8 @@
{% extends "base.html" %}
{% import "util.html" as util %}
{% block title %}{{ summary }}{% endblock %}
{% macro r_class(reachable) %}
{%- if reachable == 0 -%}
orphaned
{%- else if reachable == 1 -%}
reachable
{%- else -%}
tracked
{%- endif -%}
{% endmacro %}
{% macro r_title(reachable) %}
{%- if reachable == 0 -%}
This commit is orphaned. It can't be reached from any ref.
{%- else if reachable == 1 -%}
This commit can only be reached from untracked refs.
{%- else -%}
This commit can be reached from a tracked ref.
{%- endif -%}
{% endmacro %}
{% block body %}
<h2>Task</h2>
<div class="task">
@ -33,9 +14,11 @@ This commit can be reached from a tracked ref.
<dt>Priority:</dt>
<dd>{{ priority }}</dd>
<dt class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">Commit:</dt>
<dd class="{% call r_class(reachable) %}" title="{% call r_title(reachable) %}">
<a href="{{ base.root }}/commit/{{ hash }}">{{ short }}</a>
<dt>Commit:</dt>
<dd>
<a href="{{ base.root }}/commit/{{ hash }}">
{% call util::commit_short(short, reachable) %}
</a>
</dd>
</dl>
</div>

View file

@ -1,3 +1,5 @@
{% import "util.html" as util %}
<table class="queue">
<thead>
<tr>
@ -9,7 +11,11 @@
<tbody>
{% for task in tasks %}
<tr {% if task.odd %} class="odd" {% endif %}>
<td><a href="{{ task.id }}">{{ task.short }}</a></td>
<td>
<a href="{{ task.id }}">
{% call util::commit_short(task.short, task.reachable) %}
</a>
</td>
<td>{{ task.since }}</td>
<td>{{ task.priority }}</td>
</tr>

23
templates/util.html Normal file
View file

@ -0,0 +1,23 @@
{% macro r_class(reachable) %}
{%- if reachable == 0 -%}
orphaned
{%- else if reachable == 1 -%}
reachable
{%- else -%}
tracked
{%- endif -%}
{% endmacro %}
{% macro r_title(reachable) %}
{%- if reachable == 0 -%}
This commit is orphaned. It can't be reached from any ref.
{%- else if reachable == 1 -%}
This commit can only be reached from untracked refs.
{%- else -%}
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 %}