mirror of
https://codeberg.org/forgejo/forgejo
synced 2025-10-19 10:20:58 +02:00
Followup to https://codeberg.org/forgejo/forgejo/pulls/6700 & https://codeberg.org/forgejo/forgejo/pulls/9429 ## Testing Test coverage is already present in `tests/e2e/repo-home.test.e2e.ts` - there are no changes in behavior, so just selectors were updated. ## Changes * Re-make stats using details+summary: it now works without JS, works immediately after page is displayed, responds to clicking more quickly * Make the clickable bar taller on coarse screens * Fix broken overflowing on narrow screens Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9532 Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
49 lines
2.2 KiB
Go HTML Template
49 lines
2.2 KiB
Go HTML Template
{{if and (not .HideRepoInfo) (not .IsBlame)}}
|
|
<div class="ui segments repository-summary tw-mt-1 tw-mb-0">
|
|
<div class="ui segment repository-menu">
|
|
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo)}}
|
|
<a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}">
|
|
{{svg "octicon-history"}} {{ctx.Locale.TrN .CommitsCount "repo.n_commit_one" "repo.n_commit_few" (printf "<b>%s</b>" (ctx.Locale.PrettyNumber .CommitsCount) | SafeHTML)}}
|
|
</a>
|
|
<a class="item muted {{if .PageIsBranches}}active{{end}}" href="{{.RepoLink}}/branches">
|
|
{{svg "octicon-git-branch"}} {{ctx.Locale.TrN .BranchesCount "repo.n_branch_one" "repo.n_branch_few" (printf "<b>%s</b>" (ctx.Locale.PrettyNumber .BranchesCount) | SafeHTML)}}
|
|
</a>
|
|
{{if $.Permission.CanRead $.UnitTypeCode}}
|
|
<a class="item muted {{if .PageIsTagList}}active{{end}}" href="{{.RepoLink}}/tags">
|
|
{{svg "octicon-tag"}} {{ctx.Locale.TrN .NumTags "repo.n_tag_one" "repo.n_tag_few" (printf "<b>%s</b>" (ctx.Locale.PrettyNumber .NumTags) | SafeHTML)}}
|
|
</a>
|
|
{{end}}
|
|
<span class="item" {{if not (eq .Repository.Size 0)}}data-tooltip-content="{{.Repository.SizeDetailsString ctx.Locale}}"{{end}}>
|
|
{{$fileSizeFields := ctx.Locale.TrSize .Repository.Size}}
|
|
{{svg "octicon-database"}} <b>{{$fileSizeFields.PrettyNumber}}</b> {{$fileSizeFields.TranslatedUnit}}
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats}}
|
|
<details class="stats" id="language-stats">
|
|
<summary>
|
|
<stats-bar>
|
|
{{range .LanguageStats}}
|
|
<div class="slice" style="width: {{.Percentage}}%; background-color: {{.Color}}" data-tooltip-placement="top" data-tooltip-content={{.Language}} data-tooltip-follow-cursor="horizontal"></div>
|
|
{{end}}
|
|
</stats-bar>
|
|
</summary>
|
|
<ul>
|
|
{{range .LanguageStats}}
|
|
<li>
|
|
<i class="color-icon" style="background-color: {{.Color}}"></i>
|
|
<span>
|
|
{{if eq .Language "other"}}
|
|
{{ctx.Locale.Tr "repo.language_other"}}
|
|
{{else}}
|
|
{{.Language}}
|
|
{{end}}
|
|
</span>
|
|
{{.Percentage}}%
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</details>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|