summaryrefslogtreecommitdiffstats
path: root/templates/repo/header.tmpl
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-04 23:53:46 +0800
committerGitHub <noreply@github.com>2017-02-04 23:53:46 +0800
commit8a421b1fd702d99e8438f6ef6f4ee339f1eaa130 (patch)
treec69e598ca9dca29dc64a4e1d8525165ec794106f /templates/repo/header.tmpl
parent49fa03bf4286bd2cbf90b271fb65d4f70e5de57f (diff)
downloadgitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.tar.gz
gitea-8a421b1fd702d99e8438f6ef6f4ee339f1eaa130.zip
Add units concept for modulable functions of a repository (#742)
* Add units concept for modulable functions of a repository * remove unused comment codes & fix lints and tests * remove unused comment codes * use struct config instead of map * fix lint * rm wrong files * fix tests
Diffstat (limited to 'templates/repo/header.tmpl')
-rw-r--r--templates/repo/header.tmpl24
1 files changed, 21 insertions, 3 deletions
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index a46bf5b807..24ddb46d08 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -49,30 +49,48 @@
{{if not (or .IsBareRepo .IsDiffCompare)}}
<div class="ui tabs container">
<div class="ui tabular menu navbar">
+ {{if .Repository.EnableUnit $.UnitTypeCode}}
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}">
<i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
</a>
- {{if .Repository.EnableIssues}}
+ {{end}}
+
+ {{if .Repository.EnableUnit $.UnitTypeIssues}}
+ <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
+ <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
+ </a>
+ {{end}}
+
+ {{if .Repository.EnableUnit $.UnitTypeExternalTracker}}
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
- <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} {{if not .Repository.EnableExternalTracker}}<span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}{{end}}</span>
+ <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} </span>
</a>
{{end}}
+
{{if .Repository.AllowsPulls}}
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
<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}}
+
+ {{if .Repository.EnableUnit $.UnitTypeCommits}}
<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>
+ {{end}}
+
+ {{if .Repository.EnableUnit $.UnitTypeReleases}}
<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}}
+ {{end}}
+
+ {{if or (.Repository.EnableUnit $.UnitTypeWiki) (.Repository.EnableUnit $.UnitTypeExternalWiki)}}
<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki">
<i class="octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}}
</a>
{{end}}
+
{{if .IsRepositoryAdmin}}
<div class="right menu">
<a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">