Forgejo/templates/repo/actions/runs_list.tmpl
wxiaoguang ffa4949eaa
Improve flex list UI (#26970)
1. There is already `gt-ac`, so no need to introduce `flex-item-center`
2. The `flex-item-baseline` and `.flex-item-icon svg { margin-top: 1px
}` seem to be a tricky patch, they don't resolve the root problem, and
still cause misalignment in some cases.
* The root problem is: the "icon" needs to align with the sibling
"title"
    * So, make the "icon" and the "title" both have the same height 
3. `flex-text-inline` could only be used if the element is really
"inline", otherwise its `vertical-align` would make the box size change.
In most cases, `flex-text-block` is good enough.


![image](https://github.com/go-gitea/gitea/assets/2114189/1b7acfc2-b1c7-4e9c-a983-2fa932026479)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-09-08 13:57:18 +00:00

40 lines
1.5 KiB
Handlebars

<div class="flex-list">
{{if eq (len .Runs) 0}}
<div class="empty center">
{{svg "octicon-no-entry" 48}}
<h2>{{if $.IsFiltered}}{{.locale.Tr "actions.runs.no_results"}}{{else}}{{.locale.Tr "actions.runs.no_runs"}}{{end}}</h2>
</div>
{{end}}
{{range .Runs}}
<div class="flex-item gt-ac">
<div class="flex-item-leading">
{{template "repo/actions/status" (dict "status" .Status.String "locale" $.locale)}}
</div>
<div class="flex-item-main">
<a class="flex-item-title" title="{{.Title}}" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
{{- .Title -}}
</a>
<div class="flex-item-body">
<b>{{if not $.CurWorkflow}}{{.WorkflowID}} {{end}}#{{.Index}}</b>
: {{$.locale.Tr "actions.runs.commit"}}
<a href="{{$.RepoLink}}/commit/{{.CommitSHA}}">{{ShortSha .CommitSHA}}</a>
{{$.locale.Tr "actions.runs.pushed_by"}}
<a href="{{.TriggerUser.HomeLink}}">{{.TriggerUser.GetDisplayName}}</a>
</div>
</div>
<div class="flex-item-trailing">
{{if .RefLink}}
<a class="ui label gt-px-2 gt-mx-0" href="{{.RefLink}}">{{.PrettyRef}}</a>
{{else}}
<span class="ui label gt-px-2 gt-mx-0">{{.PrettyRef}}</span>
{{end}}
</div>
<div class="run-list-item-right">
<div class="run-list-meta">{{svg "octicon-calendar" 16}}{{TimeSinceUnix .Updated $.locale}}</div>
<div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{.Duration}}</div>
</div>
</div>
{{end}}
</div>
{{template "base/paginate" .}}