aboutsummaryrefslogtreecommitdiff
path: root/templates/repo
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-10 15:13:48 -0500
committerUnknwon <u@gogs.io>2017-03-10 15:13:48 -0500
commitebc0943713196abe939e445f35e0f726f5cbee1e (patch)
treee4f7248ba87586c12129bd36718f27d571ece513 /templates/repo
parent451aef7a1c177b58c4519239a65dbfbab32b4888 (diff)
templates/repo: only show Git stats in repository home page (#3518)
Move 'Commits' and 'Releases' tabs down to body. This patch also reduces page load time for pages that do not need to use commits count anywhere. Get commits count can hurt performance badly for huge repositories that has tens of thousands commits like Linux Kernel.
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/header.tmpl6
-rw-r--r--templates/repo/home.tmpl20
2 files changed, 16 insertions, 10 deletions
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index fe3f30d6..5ad5139c 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -62,12 +62,6 @@
<i class="octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span>
</a>
{{end}}
- <a class="{{if (or (.PageIsCommits) (.PageIsDiff))}}active{{end}} item" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}">
- <i class="octicon octicon-history"></i> {{.i18n.Tr "repo.commits"}} <span class="ui {{if not .CommitsCount}}gray{{else}}blue{{end}} small label">{{.CommitsCount}}</span>
- </a>
- <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
- <i class="octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumTags}}gray{{else}}blue{{end}} small label">{{.Repository.NumTags}}</span>
- </a>
{{if .Repository.EnableWiki}}
<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki">
<i class="octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index f059ea19..1a8e0432 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -3,10 +3,22 @@
{{template "repo/header" .}}
<div class="ui container">
{{template "base/alert" .}}
- <p id="repo-desc">
- {{if .Repository.DescriptionHtml}}<span class="description has-emoji">{{.Repository.DescriptionHtml}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}
- <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
- </p>
+ {{if .PageIsRepoHome}}
+ <p id="repo-desc">
+ {{if .Repository.DescriptionHtml}}<span class="description has-emoji">{{.Repository.DescriptionHtml}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}
+ <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
+ </p>
+ <div class="ui segment" id="git-stats">
+ <div class="ui two horizontal center link list">
+ <div class="item">
+ <a href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}"><span class="ui text black"><i class="octicon octicon-history"></i> <b>{{.CommitsCount}}</b> {{.i18n.Tr "repo.commits"}}</span> </a>
+ </div>
+ <div class="item">
+ <a href="{{.RepoLink}}/releases"><span class="ui text black"><i class="octicon octicon-tag"></i> <b>{{.Repository.NumTags}}</b> {{.i18n.Tr "repo.releases"}}</span> </a>
+ </div>
+ </div>
+ </div>
+ {{end}}
<div class="ui secondary menu">
{{if .PullRequestCtx.Allowed}}
<div class="fitted item">