summaryrefslogtreecommitdiffstats
path: root/templates/repo/diff.tmpl
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-02-04 19:13:40 -0500
committer无闻 <u@gogs.io>2015-02-04 19:13:40 -0500
commit3e307e7862b29db87c99cccbf0866cb7be52b13c (patch)
tree769dbdb42c593e16c8ec30c3fa6dda0efb2c5c20 /templates/repo/diff.tmpl
parent98f7f6bef8ad9687324fd72ef115f5d2d1e5c34a (diff)
parente91b28eb9bd7b8e30a68e51e9c4d0bec4cf66624 (diff)
downloadgitea-3e307e7862b29db87c99cccbf0866cb7be52b13c.tar.gz
gitea-3e307e7862b29db87c99cccbf0866cb7be52b13c.zip
Merge pull request #901 from makhov/fix-diff-view
fix lines highlighting at diff view
Diffstat (limited to 'templates/repo/diff.tmpl')
-rw-r--r--templates/repo/diff.tmpl20
1 files changed, 10 insertions, 10 deletions
diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl
index 8045351600..ce31da6db5 100644
--- a/templates/repo/diff.tmpl
+++ b/templates/repo/diff.tmpl
@@ -74,11 +74,11 @@
</ol>
</div>
- {{range .Diff.Files}}
+ {{range $i, $file := .Diff.Files}}
<div class="panel panel-radius diff-file-box diff-box file-content" id="diff-{{.Index}}">
<div class="panel-header">
<div class="diff-counter count pull-left">
- {{if not .IsBin}}
+ {{if not $file.IsBin}}
<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
<span class="bar">
<span class="pull-left add"></span>
@@ -90,9 +90,9 @@
{{end}}
</div>
<a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{$.SourcePath}}/{{.Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
- <span class="file">{{.Name}}</span>
+ <span class="file">{{$file.Name}}</span>
</div>
- {{$isImage := (call $.IsImageFile .Name)}}
+ {{$isImage := (call $.IsImageFile $file.Name)}}
<div class="panel-body file-body file-code code-view code-diff">
{{if $isImage}}
<div class="text-center">
@@ -101,18 +101,18 @@
{{else}}
<table>
<tbody>
- {{range .Sections}}
- {{range .Lines}}
- <tr class="{{DiffLineTypeToStr .Type}}-code nl-1 ol-1">
+ {{range $j, $section := $file.Sections}}
+ {{range $k, $line := $section.Lines}}
+ <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$i}} ol-{{$i}}">
<td class="lines-num lines-num-old">
- <span rel="L1">{{if .LeftIdx}}{{.LeftIdx}}{{end}}</span>
+ <span rel="L{{Add $i 1}}{{$j}}{{$k}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
</td>
<td class="lines-num lines-num-new">
- <span rel="L1">{{if .RightIdx}}{{.RightIdx}}{{end}}</span>
+ <span rel="L{{Add $i 1}}{{$j}}{{$k}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
</td>
<td class="lines-code">
- <pre>{{.Content}}</pre>
+ <pre>{{$line.Content}}</pre>
</td>
</tr>
{{end}}