router/repo: code refactoring

This commit is contained in:
Unknwon
2016-08-30 02:08:38 -07:00
parent 2a13f682e0
commit 780cc2d110
13 changed files with 253 additions and 261 deletions

View File

@ -1 +1 @@
0.9.94.0829
0.9.94.0830

View File

@ -19,9 +19,9 @@
<div class="fitted item">
<div class="ui breadcrumb">
<a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchName}}">{{.Repository.Name}}</a>
{{ $n := len .Treenames}}
{{ $n := len .TreeNames}}
{{ $l := Subtract $n 1}}
{{range $i, $v := .Treenames}}
{{range $i, $v := .TreeNames}}
<div class="divider"> / </div>
{{if eq $i $l}}
<span class="active section">{{$v}}</span>
@ -74,7 +74,7 @@
{{end}}
</div>
</div>
{{if .IsFile}}
{{if .IsViewFile}}
{{template "repo/view_file" .}}
{{else}}
{{template "repo/view_list" .}}

View File

@ -18,7 +18,7 @@
<a class="ui button" href="{{.RepoLink}}/src/{{.CommitID}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_permalink"}}</a>
{{end}}
<a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a>
<a class="ui button" href="{{EscapePound .FileLink}}">{{.i18n.Tr "repo.file_raw"}}</a>
<a class="ui button" href="{{EscapePound $.RawFileLink}}">{{.i18n.Tr "repo.file_raw"}}</a>
</div>
{{if .Repository.CanEnableEditor}}
{{if .CanEditFile}}
@ -36,17 +36,17 @@
{{end}}
</h4>
<div class="ui attached table segment">
<div class="file-view {{if .IsMarkdown}}markdown{{else if .IsFileText}}code-view{{end}} has-emoji">
<div class="file-view {{if .IsMarkdown}}markdown{{else if .IsTextFile}}code-view{{end}} has-emoji">
{{if .IsMarkdown}}
{{if .FileContent}}{{.FileContent | Str2html}}{{end}}
{{else if not .IsFileText}}
{{else if not .IsTextFile}}
<div class="view-raw ui center">
{{if .IsImageFile}}
<img src="{{EscapePound .FileLink}}">
<img src="{{EscapePound $.RawFileLink}}">
{{else if .IsPDFFile}}
<iframe width="100%" height="600px" src="{{AppSubUrl}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound .FileLink}}"></iframe>
<iframe width="100%" height="600px" src="{{AppSubUrl}}/plugins/pdfjs-1.4.20/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
{{else}}
<a href="{{EscapePound $.FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
<a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
{{end}}
</div>
{{else if .FileSize}}

View File

@ -2,19 +2,19 @@
<thead>
<tr>
<th class="four wide">
{{if .LastCommitUser}}
<img class="ui avatar image img-12" src="{{.LastCommitUser.RelAvatarLink}}" />
<a href="{{AppSubUrl}}/{{.LastCommitUser.Name}}"><strong>{{.LastCommit.Author.Name}}</strong></a>
{{if .LatestCommitUser}}
<img class="ui avatar image img-12" src="{{.LatestCommitUser.RelAvatarLink}}" />
<a href="{{AppSubUrl}}/{{.LatestCommitUser.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></a>
{{else}}
<img class="ui avatar image img-12" src="{{AvatarLink .LastCommit.Author.Email}}" />
<strong>{{.LastCommit.Author.Name}}</strong>
<img class="ui avatar image img-12" src="{{AvatarLink .LatestCommit.Author.Email}}" />
<strong>{{.LatestCommit.Author.Name}}</strong>
{{end}}
<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.LastCommit.ID}}" rel="nofollow">{{ShortSha .LastCommit.ID.String}}</a>
<span class="grey has-emoji">{{RenderCommitMessage false .LastCommit.Summary .RepoLink $.Repository.ComposeMetas}}</span>
<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}" rel="nofollow">{{ShortSha .LatestCommit.ID.String}}</a>
<span class="grey has-emoji">{{RenderCommitMessage false .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}}</span>
</th>
<th class="nine wide">
</th>
<th class="three wide text grey right age">{{TimeSince .LastCommit.Author.When $.Lang}}</th>
<th class="three wide text grey right age">{{TimeSince .LatestCommit.Author.When $.Lang}}</th>
</tr>
</thead>
<tbody>