mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-03-02 23:43:13 +01:00
This PR introduces a new UI element type for Gitea called `flex-item`. It consists of a horizontal card with a leading, main and trailing part:  The idea behind it is that in Gitea UI, we have many cases where we use this kind of layout, but it is achieved in many different ways: - grid layout - `.ui.list` with additional hacky flexbox - `.ui.key.list` - looks to me like a style set originally created for ssh/gpg key list, was used in many other places - `.issue.list` - created for issue cards, used in many other places - ... This new style is based on `.issue.list`, specifically the refactoring of it done in #25750. In this PR, the new element is introduced and lots of templates are being refactored to use that style. This allows to remove a lot of page-specific css, makes many of the elements responsive or simply provides a cleaner/better-looking way to present information. A devtest section with the new style is also available. <details> <summary>Screenshots (left: before, right: after)</summary>                    </details> --------- Co-authored-by: Giteabot <teabot@gitea.io>
56 lines
2.2 KiB
Go HTML Template
56 lines
2.2 KiB
Go HTML Template
<h4 class="ui top attached header">
|
|
{{.locale.Tr "packages.owner.settings.cleanuprules.title"}}
|
|
<div class="ui right">
|
|
<a class="ui primary tiny button" href="{{.Link}}/rules/add">{{.locale.Tr "packages.owner.settings.cleanuprules.add"}}</a>
|
|
</div>
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<div class="flex-list">
|
|
{{range .CleanupRules}}
|
|
<div class="flex-item">
|
|
<div class="flex-item-leading">
|
|
{{svg .Type.SVGName 32}}
|
|
</div>
|
|
<div class="flex-item-main">
|
|
<div class="flex-item-title">
|
|
<a class="item" href="{{$.Link}}/rules/{{.ID}}">{{.Type.Name}}</a>
|
|
</div>
|
|
<div class="flex-item-body">
|
|
<i>{{if .Enabled}}{{$.locale.Tr "enabled"}}{{else}}{{$.locale.Tr "disabled"}}{{end}}</i>
|
|
</div>
|
|
{{if .KeepCount}}
|
|
<div class="flex-item-body">
|
|
<i>{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}:</i> {{if eq .KeepCount 1}}{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}{{else}}{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" .KeepCount}}{{end}}
|
|
</div>
|
|
{{end}}
|
|
{{if .KeepPattern}}
|
|
<div class="flex-item-body">
|
|
<i>{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}:</i> {{StringUtils.EllipsisString .KeepPattern 100}}
|
|
</div>
|
|
{{end}}
|
|
{{if .RemoveDays}}
|
|
<div class="flex-item-body">
|
|
<i>{{$.locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}:</i> {{$.locale.Tr "tool.days" .RemoveDays}}
|
|
</div>
|
|
{{end}}
|
|
{{if .RemovePattern}}
|
|
<div class="flex-item-body">
|
|
<i>{{$.locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}:</i> {{StringUtils.EllipsisString .RemovePattern 100}}
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
<div class="flex-item-trailing">
|
|
<div class="ui dropdown tiny basic button">
|
|
{{svg "octicon-kebab-horizontal"}}
|
|
<div class="menu">
|
|
<a class="item" href="{{$.Link}}/rules/{{.ID}}">{{$.locale.Tr "edit"}}</a>
|
|
<a class="item" href="{{$.Link}}/rules/{{.ID}}/preview">{{$.locale.Tr "packages.owner.settings.cleanuprules.preview"}}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{else}}
|
|
<div class="item">{{.locale.Tr "packages.owner.settings.cleanuprules.none"}}</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|