aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-03-28 21:47:07 +0800
committerGitHub <noreply@github.com>2022-03-28 21:47:07 +0800
commitc5549b442be6278ffba2c0628274b8159b70f3c8 (patch)
tree682273f3733aaf58da1138530dbc728b1b6bc218 /templates
parent70c6f0a490e9d5dc03aa5f0dcb27c0a7879b1796 (diff)
templates: use `OldIndex` for delete files in diff (#6878)
Diffstat (limited to 'templates')
1 files changed, 3 insertions, 3 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index ef1a0076..7d40ab1e 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -27,7 +27,7 @@
</div>
<!-- todo finish all file status, now modify, add, delete and rename -->
<span class="status {{DiffFileTypeToStr .Type}} poping up" data-content="{{DiffFileTypeToStr .Type}}" data-variation="inverted tiny" data-position="right center">&nbsp;</span>
- <a class="file" href="#diff-{{.Index}}">{{.Name}}</a>
+ <a class="file" href="#diff-{{if .IsDeleted}}{{.OldIndex}}{{else}}{{.Index}}{{end}}">{{.Name}}</a>
</li>
{{end}}
</ol>
@@ -50,7 +50,7 @@
</h4>
</div>
{{else}}
- <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{.Index}}">
+ <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{if .IsDeleted}}{{.OldIndex}}{{else}}{{.Index}}{{end}}">
<h4 class="ui top attached normal header">
<div class="diff-counter count ui left">
{{if $file.IsBinary}}
@@ -106,7 +106,7 @@
<pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.ComputedInlineDiffFor $line}}</code></pre>
</td>
{{else}}
- <td class="lines-num lines-num-old" {{if $line.LeftLine}} id="diff-{{Sha1 $file.Index}}L{{$line.LeftLine}}" data-line-number="{{$line.LeftLine}}"{{end}}>
+ <td class="lines-num lines-num-old" {{if $line.LeftLine}} id="diff-{{Sha1 $file.OldIndex}}L{{$line.LeftLine}}" data-line-number="{{$line.LeftLine}}"{{end}}>
</td>
<td class="lines-code halfwidth">
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftLine}}{{$section.ComputedInlineDiffFor $line}}{{end}}</code></pre>