gitea/templates/repo/home_sidebar_bottom.tmpl
silverwind df9a78cd04
Tweak repo sidebar (#32847)
Before and after:

<img width="218" alt="Screenshot 2024-12-15 at 04 53 53"
src="https://github.com/user-attachments/assets/299b1f0a-ba72-47c6-b662-a9d540d4d741"
/>
<img width="222" alt="Screenshot 2024-12-15 at 04 53 41"
src="https://github.com/user-attachments/assets/5a2b5332-e324-4d20-82e9-21d1c850e826"
/>

Diff without whitespace:
https://github.com/go-gitea/gitea/pull/32847/files?diff=unified&w=1

The `tw-mt-2` is fine even if the element renders empty:

<img width="387" alt="image"
src="https://github.com/user-attachments/assets/76a976e4-ba2e-48a5-9248-c361552a937a"
/>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-15 10:01:46 +00:00

62 lines
1.9 KiB
Handlebars

<div class="repo-home-sidebar-bottom">
<div class="flex-list">
{{if .LatestRelease}}
<div class="flex-item">
<div class="flex-item-main">
<div class="flex-item-title">
<a class="item muted" href="{{.Link}}/releases">
{{ctx.Locale.Tr "repo.releases"}}
<span class="ui small label">{{.NumReleases}}</span>
</a>
</div>
<div class="flex-item">
<div class="flex-item-icon">
{{svg "octicon-tag" 16}}
</div>
<div class="flex-item-main">
<div class="flex-item-header">
<div class="flex-item-title tw-gap-2">
<a class="gt-ellipsis muted" href="{{.LatestRelease.Link}}" title="{{.LatestRelease.Title}}">{{.LatestRelease.Title}}</a>
{{template "repo/release/label" (dict "Release" .LatestRelease "IsLatest" true)}}
</div>
</div>
<div class="flex-item-body">
<span class="time">{{DateUtils.TimeSince .LatestRelease.CreatedUnix}}</span>
</div>
</div>
</div>
</div>
</div>
{{end}}
{{if and (not .IsEmptyRepo) .LanguageStats}}
<div class="flex-item">
<div class="flex-item-main">
<div class="flex-item-title">
{{ctx.Locale.Tr "repo.repo_lang"}}
</div>
<div class="flex-item-body">
<div class="language-stats">
{{range .LanguageStats}}
<div class="bar" style="width: {{.Percentage}}%; background-color: {{.Color}}" data-tooltip-placement="top" data-tooltip-content={{.Language}} data-tooltip-follow-cursor="horizontal"></div>
{{end}}
</div>
<div class="language-stats-details">
{{range .LanguageStats}}
<div class="item">
<i class="color-icon" style="background-color: {{.Color}}"></i>
<span class="tw-font-semibold">
{{Iif (eq .Language "other") (ctx.Locale.Tr "repo.language_other") .Language}}
</span>
{{.Percentage}}%
</div>
{{end}}
</div>
</div>
</div>
</div>
{{end}}
</div>
</div>