diff options
author | Unknwon <u@gogs.io> | 2016-08-30 02:08:38 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-30 02:08:38 -0700 |
commit | 780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2 (patch) | |
tree | 1657d9fecdcf70d4e0067724344f531d608efb71 /templates | |
parent | 2a13f682e0fa039a610e7817495d87685f9632f2 (diff) | |
download | gitea-780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2.tar.gz gitea-780cc2d11093e048e41f2d6da9d76f6c6ac4a5e2.zip |
router/repo: code refactoring
Diffstat (limited to 'templates')
-rw-r--r-- | templates/.VERSION | 2 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/view_file.tmpl | 12 | ||||
-rw-r--r-- | templates/repo/view_list.tmpl | 16 |
4 files changed, 18 insertions, 18 deletions
diff --git a/templates/.VERSION b/templates/.VERSION index 8e1e3e9848..bbf71e4218 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.94.0829
\ No newline at end of file +0.9.94.0830
\ No newline at end of file diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 7ef75277e6..2b8c7e06e0 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -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" .}} diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index d0b793b0e7..68e8444768 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -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}} diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index a92123b865..19a18c1ca4 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -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> |