summaryrefslogtreecommitdiffstats
path: root/templates/repo/sub_menu.tmpl
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2020-02-11 11:34:17 +0200
committerGitHub <noreply@github.com>2020-02-11 11:34:17 +0200
commitad2642a8aac9facb217a8471df1d3e00f1214e92 (patch)
treeea198b2b3130d22bb60886b6ba0a1df352f160ff /templates/repo/sub_menu.tmpl
parent37892be63580e40ced80e041ff2e7dabb2e80866 (diff)
downloadgitea-ad2642a8aac9facb217a8471df1d3e00f1214e92.tar.gz
gitea-ad2642a8aac9facb217a8471df1d3e00f1214e92.zip
Language statistics bar for repositories (#8037)
* Implementation for calculating language statistics Impement saving code language statistics to database Implement rendering langauge stats Add primary laguage to show in repository list Implement repository stats indexer queue Add indexer test Refactor to use queue module * Do not timeout for queues
Diffstat (limited to 'templates/repo/sub_menu.tmpl')
-rw-r--r--templates/repo/sub_menu.tmpl51
1 files changed, 38 insertions, 13 deletions
diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl
index b97fe902eb..96128fb2af 100644
--- a/templates/repo/sub_menu.tmpl
+++ b/templates/repo/sub_menu.tmpl
@@ -1,17 +1,42 @@
-<div class="ui segment sub-menu">
- <div class="ui two horizontal center link list">
- {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo)}}
- <div class="item{{if .PageIsCommits}} active{{end}}">
- <a class="ui" href="{{.RepoLink}}/commits{{if .IsViewBranch}}/branch{{else if .IsViewTag}}/tag{{else if .IsViewCommit}}/commit{{end}}/{{EscapePound .BranchName}}"><i class="octicon octicon-history"></i> <b>{{.CommitsCount}}</b> {{.i18n.Tr (TrN .i18n.Lang .CommitsCount "repo.commit" "repo.commits") }}</a>
- </div>
- {{end}}
- {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) }}
- <div class="item{{if .PageIsBranches}} active{{end}}">
- <a class="ui" href="{{.RepoLink}}/branches/"><i class="octicon octicon-git-branch"></i> <b>{{.BranchesCount}}</b> {{.i18n.Tr (TrN .i18n.Lang .BranchesCount "repo.branch" "repo.branches") }}</a>
- </div>
+<div class="ui segments">
+ <div class="ui segment sub-menu repository-menu">
+ <div class="ui two horizontal center link list">
+ {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo)}}
+ <div class="item{{if .PageIsCommits}} active{{end}}">
+ <a class="ui" href="{{.RepoLink}}/commits{{if .IsViewBranch}}/branch{{else if .IsViewTag}}/tag{{else if .IsViewCommit}}/commit{{end}}/{{EscapePound .BranchName}}"><i class="octicon octicon-history"></i> <b>{{.CommitsCount}}</b> {{.i18n.Tr (TrN .i18n.Lang .CommitsCount "repo.commit" "repo.commits") }}</a>
+ </div>
+ {{end}}
+ {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) }}
+ <div class="item{{if .PageIsBranches}} active{{end}}">
+ <a class="ui" href="{{.RepoLink}}/branches/"><i class="octicon octicon-git-branch"></i> <b>{{.BranchesCount}}</b> {{.i18n.Tr (TrN .i18n.Lang .BranchesCount "repo.branch" "repo.branches") }}</a>
+ </div>
+ <div class="item">
+ <a class="ui" href="#"><i class="octicon octicon-database"></i> <b>{{SizeFmt .Repository.Size}}</b></a>
+ </div>
+ {{end}}
+ </div>
+ </div>
+ {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats }}
+ <div class="ui segment sub-menu language-stats-details" style="display: none">
+ <div class="ui horizontal center link list">
+ {{range .LanguageStats}}
<div class="item">
- <a class="ui" href="#"><i class="octicon octicon-database"></i> <b>{{SizeFmt .Repository.Size}}</b></a>
+ <i class="color-icon" style="background-color: {{ .Color }}"></i>
+ <span class="ui"><b>
+ {{if eq .Language "other" }}
+ {{ $.i18n.Tr "repo.language_other" }}
+ {{else}}
+ {{ .Language }}
+ {{end}}
+ </b> {{ .Percentage }}%</span>
</div>
- {{end}}
+ {{end}}
+ </div>
</div>
+ <a class="ui segment language-stats">
+ {{range .LanguageStats}}
+ <div class="bar" style="width: {{ .Percentage }}%; background-color: {{ .Color }}">&nbsp;</div>
+ {{end}}
+ </a>
+ {{end}}
</div>