Skip to content

Commit e4b2bdf

Browse files
authored
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
1 parent 5db21ce commit e4b2bdf

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

templates/devtest/flex-list.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
</div>
4949
<div class="flex-item-body">
5050
Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content
51+
<span class="text truncate">Truncate very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content</span>
5152
</div>
5253
</div>
5354
<div class="flex-item-trailing">

templates/user/dashboard/feeds.tmpl

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,25 +80,21 @@
8080
{{end}}
8181
</div>
8282
{{if or (eq .GetOpType 5) (eq .GetOpType 18)}}
83-
<div class="gt-pl-5">
84-
{{$push := ActionContent2Commits .}}
85-
{{$repoLink := .GetRepoLink}}
86-
{{range $push.Commits}}
87-
{{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
88-
<div class="flex-item">
89-
<img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16">
90-
<a class="commit-id" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
91-
<span class="text truncate light grey">
92-
{{RenderCommitMessage $.Context .Message $repoLink $.ComposeMetas}}
93-
</span>
94-
</div>
95-
{{end}}
96-
{{if and (gt $push.Len 1) $push.CompareURL}}
97-
<div class="flex-item">
98-
<a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.locale.Tr "action.compare_commits" $push.Len}} »</a>
99-
</div>
100-
{{end}}
101-
</div>
83+
{{$push := ActionContent2Commits .}}
84+
{{$repoLink := .GetRepoLink}}
85+
{{range $push.Commits}}
86+
{{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
87+
<div class="flex-text-block">
88+
<img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16">
89+
<a class="gt-mono" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
90+
<span class="text truncate light grey">
91+
{{RenderCommitMessage $.Context .Message $repoLink $.ComposeMetas}}
92+
</span>
93+
</div>
94+
{{end}}
95+
{{if and (gt $push.Len 1) $push.CompareURL}}
96+
<a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{$.locale.Tr "action.compare_commits" $push.Len}} »</a>
97+
{{end}}
10298
{{else if eq .GetOpType 6}}
10399
<span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji $.Context | RenderCodeBlock}}</span>
104100
{{else if eq .GetOpType 7}}

web_src/css/dashboard.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@
9696
}
9797
}
9898

99-
.feeds .commit-id {
100-
font-family: var(--fonts-monospace);
101-
}
102-
10399
.feeds code {
104100
padding: 2px 4px;
105101
border-radius: 3px;

web_src/css/shared/flex-list.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
display: flex;
3030
flex-direction: column;
3131
flex-grow: 1;
32-
flex-basis: 60%;
32+
flex-basis: 60%; /* avoid wrapping the "flex-item-trailing" too aggressively */
33+
min-width: 0; /* make the "text truncate" work, otherwise the flex axis is not limited and the text just overflows */
3334
}
3435

3536
.flex-item-header {
@@ -66,6 +67,7 @@
6667
font-size: 16px;
6768
font-weight: var(--font-weight-semibold);
6869
word-break: break-word;
70+
min-width: 0;
6971
}
7072

7173
.flex-item .flex-item-title a {

0 commit comments

Comments
 (0)