summaryrefslogtreecommitdiffstats
path: root/templates/repo/diff_box.tmpl
diff options
context:
space:
mode:
authorKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2015-12-26 12:26:26 +0100
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2016-01-05 19:21:41 +0100
commit0df39b33ebcff50df537f4682a72dcc29f046d01 (patch)
tree9454f38fb3a9ce16d58d20dc9a9a7016dba3359f /templates/repo/diff_box.tmpl
parent7392b6a755300e9f921535d2c1ec6358d4e8bfe8 (diff)
downloadgitea-0df39b33ebcff50df537f4682a72dcc29f046d01.tar.gz
gitea-0df39b33ebcff50df537f4682a72dcc29f046d01.zip
Implement Split Diff-View
- Unified/Inline Diff-View Selectable
Diffstat (limited to 'templates/repo/diff_box.tmpl')
-rw-r--r--templates/repo/diff_box.tmpl63
1 files changed, 5 insertions, 58 deletions
diff --git a/templates/repo/diff_box.tmpl b/templates/repo/diff_box.tmpl
index 036d4a6491..c408fd492b 100644
--- a/templates/repo/diff_box.tmpl
+++ b/templates/repo/diff_box.tmpl
@@ -6,6 +6,7 @@
<i class="fa fa-retweet"></i>
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
<div class="ui right">
+ <a class="ui tiny basic toggle button" href="?style={{if .Style}}inline{{else}}split{{end}}">{{ if .Style }}Inline{{else}}Split{{end}}</a>
<a class="ui tiny basic toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
</div>
</div>
@@ -32,63 +33,9 @@
</ol>
</div>
- {{range $i, $file := .Diff.Files}}
- <div class="diff-file-box diff-box file-content" id="diff-{{.Index}}">
- <h4 class="ui top attached normal header">
- <div class="diff-counter count ui left">
- {{if $file.IsBin}}
- {{$.i18n.Tr "repo.diff.bin"}}
- {{else if not $file.IsRenamed}}
- <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
- <span class="bar">
- <span class="pull-left add"></span>
- <span class="pull-left del"></span>
- </span>
- <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
- {{end}}
- </div>
- <span class="file">{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}</span>
- <div class="ui right">
- {{if $file.IsDeleted}}
- <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
- {{else}}
- <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
- {{end}}
- </div>
- </h4>
- <div class="ui attached table segment">
- {{if not $file.IsRenamed}}
- {{$isImage := (call $.IsImageFile $file.Name)}}
- {{if and $isImage}}
- <div class="center">
- <img src="{{$.RawPath}}/{{EscapePound .Name}}">
- </div>
- {{else}}
- <div class="file-body file-code code-view code-diff">
- <table>
- <tbody>
- {{range .Sections}}
- {{range $k, $line := .Lines}}
- <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$k}} ol-{{$k}}">
- <td class="lines-num lines-num-old">
- <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
- </td>
- <td class="lines-num lines-num-new">
- <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
- </td>
- <td class="lines-code">
- <pre>{{$line.Content}}</pre>
- </td>
- </tr>
- {{end}}
- {{end}}
- </tbody>
- </table>
- </div>
- {{end}}
- {{end}}
- </div>
- </div>
- <br>
+ {{if .Style}}
+ {{ template "repo/diff_box_split" . }}
+ {{else}}
+ {{ template "repo/diff_box_inline" . }}
{{end}}
{{end}}