1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00
gitea/templates/repo/diff.tmpl

139 lines
5.4 KiB
Cheetah
Raw Normal View History

2015-08-20 08:18:49 -04:00
{{template "base/head" .}}
<div class="repository diff">
{{template "repo/header" .}}
2015-08-20 12:18:30 -04:00
<div class="ui container">
{{if .IsDiffCompare }}
{{template "repo/commits_table" .}}
{{else}}
<h4 class="ui top attached info header">
{{RenderCommitMessage .Commit.Message $.RepoLink}}
<div class="ui right">
<a class="ui blue tiny button" href="{{EscapePound .SourcePath}}">
{{.i18n.Tr "repo.diff.browse_source"}}
</a>
</div>
</h4>
<div class="ui attached info segment">
{{if .Author}}
<img class="ui avatar image" src="{{.Author.AvatarLink}}" />
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
{{else}}
<img class="ui avatar image" src="{{AvatarLink .Commit.Author.Email}}" />
<strong>{{.Commit.Author.Name}}</strong>
2015-08-20 08:18:49 -04:00
{{end}}
2015-08-20 12:18:30 -04:00
<span class="text grey" id="authored-time">{{TimeSince .Commit.Author.When $.Lang}}</span>
<div class="ui right">
<div class="ui horizontal list">
2015-08-31 03:24:28 -04:00
{{if .Parents}}
2015-08-20 12:18:30 -04:00
<div class="item">
{{.i18n.Tr "repo.diff.parent"}}
</div>
<div class="item">
{{range .Parents}}
<a class="ui blue sha label" href="{{$.RepoLink}}/commit/{{.}}">{{ShortSha .}}</a>
{{end}}
</div>
2015-08-31 03:24:28 -04:00
{{end}}
2015-08-20 12:18:30 -04:00
<div class="item">{{.i18n.Tr "repo.diff.commit"}}</div>
2015-08-31 03:24:28 -04:00
<div class="item"><span class="ui blue sha label">{{ShortSha .CommitID}}</span></div>
2014-03-24 09:27:19 -04:00
</div>
2015-08-20 12:18:30 -04:00
</div>
</div>
{{end}}
{{if .DiffNotAvailable}}
<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
{{else}}
<div class="diff-detail-box diff-box">
<div>
<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 black toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
2014-03-24 09:27:19 -04:00
</div>
2015-08-20 12:18:30 -04:00
</div>
<ol class="detail-files hide" id="diff-files">
{{range .Diff.Files}}
<li>
<div class="diff-counter count pull-right">
{{if not .IsBin}}
<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>
{{else}}
<span>{{$.i18n.Tr "repo.diff.bin"}}</span>
{{end}}
</div>
<!-- todo finish all file status, now modify, add, delete and rename -->
<span class="status {{DiffTypeToStr .Type}} poping up" data-content="{{DiffTypeToStr .Type}}" data-variation="inverted tiny" data-position="right center">&nbsp;</span>
<a class="file" href="#diff-{{.Index}}">{{.Name}}</a>
</li>
2014-03-25 23:53:01 -04:00
{{end}}
2015-08-20 12:18:30 -04:00
</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 not $file.IsBin}}
<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>
{{else}}
{{$.i18n.Tr "repo.diff.bin"}}
{{end}}
</div>
<span class="file">{{$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">
{{$isImage := (call $.IsImageFile $file.Name)}}
{{if $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>
2014-04-12 01:45:43 -04:00
{{end}}
2015-08-20 12:18:30 -04:00
</div>
</div>
<br>
{{end}}
{{end}}
2015-08-20 08:18:49 -04:00
</div>
2014-03-24 09:27:19 -04:00
</div>
2015-08-20 08:18:49 -04:00
{{template "base/footer" .}}