Files
itsy-gitsy/templates/default_dark/commit.html
T
Lukas Stancik 943746aaca Fix templates markup to prevent nesting of commit files diff blocks
Commit detail page improperly closes `.commit-diff` tags inside for-loop which results in diff blocks being nested within each other. This is best visible at large commits with lots of files and lots of changes - with increasing "indentation" from the left side as one scrolls down the long page.
2025-04-27 15:47:22 +00:00

40 lines
1.7 KiB
HTML

{% extends "base.html" %}
{% block tab_history_selected -%}selected{% endblock -%}
{% block content %}
<div class="commit-page">
<table class="commit-header">
<tr class="header"><td class="field">commit:</td><td class="value">{{commit.full_hash}}</td></tr>
<tr class="header"><td class="field">author:</td><td class="value">{{commit.author.name}} <{{commit.author.email}}></td></tr>
<tr class="header"><td class="field">committer:</td><td class="value">{{commit.committer.name}} <{{commit.committer.email}}></td></tr>
<tr class="header"><td class="field">date:</td><td class="value">{{ts_to_git_timestamp(ts=commit.ts_utc, tz=commit.ts_offset)}}</td></tr>
<tr class="header"><td class="field">parents:</td><td class="value">{% for parent in commit.parents -%}{% if loop.index0 > 0 -%}, {%endif-%}{% if parent in commit_ids -%}<a href="{{parent}}.html">{{parent}}</a>{%else-%}{{parent}}{%endif-%}{%-endfor-%}</td></tr>
</table>
<div class="commit-message">
<pre style="margin: 0;">{{commit.message}}</pre>
</div>
{% if commit.diff -%}
{% for file in commit.diff.files -%}
<div class="commit-diff">
<div class="commit-diff-header">
<pre>diff --git a/{{file.basefile}} b/{{file.basefile}}
line changes: +{{file.additions}}/-{{file.deletions}}
index {{file.oldid | truncate(length=7,end="")}}..{{file.newid | truncate(length=7,end="")}}
--- {{file.oldfile}}
+++ {{file.newfile}}</pre>
</div>
{% for hunk in file.hunks -%}
<pre><span class="hunk-header">{{hunk.context}}</span>
{%- for line in hunk.lines -%}
<span class="{{ line.kind }}">{{line.prefix}}{{line.text}}</span>
{%- endfor -%}
</pre>
{% endfor -%}
</div>
<br/>
{% endfor -%}
{% endif -%}
</div>
{% endblock content %}