More improvements for the "flex list" and the dashboard list (#26675)

Follow #26649 and #25790 and add one more example (text truncate) in the devtest page
This commit is contained in:
wxiaoguang 2023-08-23 12:23:30 +08:00 committed by GitHub
parent 5db21ce7e1
commit e4b2bdfbc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 24 deletions

View File

@ -48,6 +48,7 @@
</div> </div>
<div class="flex-item-body"> <div class="flex-item-body">
Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content
<span class="text truncate">Truncate very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content</span>
</div> </div>
</div> </div>
<div class="flex-item-trailing"> <div class="flex-item-trailing">

View File

@ -80,25 +80,21 @@
{{end}} {{end}}
</div> </div>
{{if or (eq .GetOpType 5) (eq .GetOpType 18)}} {{if or (eq .GetOpType 5) (eq .GetOpType 18)}}
<div class="gt-pl-5">
{{$push := ActionContent2Commits .}} {{$push := ActionContent2Commits .}}
{{$repoLink := .GetRepoLink}} {{$repoLink := .GetRepoLink}}
{{range $push.Commits}} {{range $push.Commits}}
{{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}} {{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
<div class="flex-item"> <div class="flex-text-block">
<img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16"> <img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16">
<a class="commit-id" href="{{$commitLink}}">{{ShortSha .Sha1}}</a> <a class="gt-mono" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
<span class="text truncate light grey"> <span class="text truncate light grey">
{{RenderCommitMessage $.Context .Message $repoLink $.ComposeMetas}} {{RenderCommitMessage $.Context .Message $repoLink $.ComposeMetas}}
</span> </span>
</div> </div>
{{end}} {{end}}
{{if and (gt $push.Len 1) $push.CompareURL}} {{if and (gt $push.Len 1) $push.CompareURL}}
<div class="flex-item">
<a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.locale.Tr "action.compare_commits" $push.Len}} »</a> <a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.locale.Tr "action.compare_commits" $push.Len}} »</a>
</div>
{{end}} {{end}}
</div>
{{else if eq .GetOpType 6}} {{else if eq .GetOpType 6}}
<span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji $.Context | RenderCodeBlock}}</span> <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji $.Context | RenderCodeBlock}}</span>
{{else if eq .GetOpType 7}} {{else if eq .GetOpType 7}}

View File

@ -96,10 +96,6 @@
} }
} }
.feeds .commit-id {
font-family: var(--fonts-monospace);
}
.feeds code { .feeds code {
padding: 2px 4px; padding: 2px 4px;
border-radius: 3px; border-radius: 3px;

View File

@ -29,7 +29,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
flex-basis: 60%; flex-basis: 60%; /* avoid wrapping the "flex-item-trailing" too aggressively */
min-width: 0; /* make the "text truncate" work, otherwise the flex axis is not limited and the text just overflows */
} }
.flex-item-header { .flex-item-header {
@ -66,6 +67,7 @@
font-size: 16px; font-size: 16px;
font-weight: var(--font-weight-semibold); font-weight: var(--font-weight-semibold);
word-break: break-word; word-break: break-word;
min-width: 0;
} }
.flex-item .flex-item-title a { .flex-item .flex-item-title a {