add multifile support to diff view highlighting

This commit is contained in:
Alexey Makhov 2015-02-04 21:54:45 +03:00
parent 7f71fe9dae
commit 5d4425bbbc

View File

@ -74,11 +74,11 @@
</ol> </ol>
</div> </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 panel-radius diff-file-box diff-box file-content" id="diff-{{.Index}}">
<div class="panel-header"> <div class="panel-header">
<div class="diff-counter count pull-left"> <div class="diff-counter count pull-left">
{{if not .IsBin}} {{if not $file.IsBin}}
<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span> <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
<span class="bar"> <span class="bar">
<span class="pull-left add"></span> <span class="pull-left add"></span>
@ -90,9 +90,9 @@
{{end}} {{end}}
</div> </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> <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> </div>
{{$isImage := (call $.IsImageFile .Name)}} {{$isImage := (call $.IsImageFile $file.Name)}}
<div class="panel-body file-body file-code code-view code-diff"> <div class="panel-body file-body file-code code-view code-diff">
{{if $isImage}} {{if $isImage}}
<div class="text-center"> <div class="text-center">
@ -101,14 +101,14 @@
{{else}} {{else}}
<table> <table>
<tbody> <tbody>
{{range .Sections}} {{range $j, $section := $file.Sections}}
{{range $i, $line := .Lines}} {{range $k, $line := $section.Lines}}
<tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$i}} ol-{{$i}}"> <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$i}} ol-{{$i}}">
<td class="lines-num lines-num-old"> <td class="lines-num lines-num-old">
<span rel="L{{$i}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span> <span rel="L{{Add $i 1}}{{Add $j 1}}{{$k}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
</td> </td>
<td class="lines-num lines-num-new"> <td class="lines-num lines-num-new">
<span rel="L{{$i}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span> <span rel="L{{Add $i 1}}{{Add $j 1}}{{$k}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
</td> </td>
<td class="lines-code"> <td class="lines-code">