Skip to content

Commit 46a6987

Browse files
committed
fix alignment and ellipsis
1 parent 4162213 commit 46a6987

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

modules/templates/util_render.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (ut *RenderUtils) RenderLabel(label *issues_model.Label) template.HTML {
137137

138138
if labelScope == "" {
139139
// Regular label
140-
return htmlutil.HTMLFormat(`<div class="ui label %s" style="color: %s !important; background-color: %s !important;" data-tooltip-content title="%s">%s</div>`,
140+
return htmlutil.HTMLFormat(`<div class="ui label %s" style="color: %s !important; background-color: %s !important;" data-tooltip-content title="%s"><span class="gt-ellipsis">%s</span></div>`,
141141
extraCSSClasses, textColor, label.Color, descriptionText, ut.RenderEmoji(label.Name))
142142
}
143143

templates/repo/issue/card.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@
6363

6464
{{if or .Labels .Assignees}}
6565
<div class="issue-card-bottom">
66-
<div class="labels-list">
66+
<div class="flex-text-inline tw-flex-wrap tw-overflow-hidden">
67+
<div class="labels-list">
6768
{{range .Labels}}
6869
<a target="_blank" href="{{$.Issue.Repo.Link}}/issues?labels={{.ID}}">{{ctx.RenderUtils.RenderLabel .}}</a>
6970
{{end}}
71+
</div>
7072
</div>
7173
<div class="issue-card-assignees">
7274
{{range .Assignees}}

web_src/css/base.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
/* z-index */
3535
--z-index-modal: 1001; /* modal dialog, hard-coded from Fomantic modal.css */
3636
--z-index-toast: 1002; /* should be larger than modal */
37+
38+
--font-size-label: 14px;
3739
}
3840

3941
@media (min-width: 768px) and (max-width: 1200px) {

web_src/css/modules/label.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
align-items: center;
77
gap: .25rem;
88
min-width: 0;
9-
vertical-align: middle;
9+
max-width: 100%;
1010
line-height: 1;
1111
background: var(--color-label-bg);
1212
color: var(--color-label-text);
1313
padding: 0.3em 0.5em;
14-
font-size: 0.85714286rem;
14+
font-size: var(--font-size-label);
1515
font-weight: var(--font-weight-medium);
1616
border: 0 solid transparent;
1717
border-radius: 0.28571429rem;

web_src/css/repo.css

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@
8282
visibility: hidden;
8383
}
8484

85+
.issue-content-right .ui.list.labels-list {
86+
display: flex;
87+
gap: 0.25em;
88+
flex-wrap: wrap;
89+
}
90+
91+
.issue-content-right .ui.list.labels-list .item {
92+
display: inline-flex;
93+
min-width: 0;
94+
}
95+
8596
@media (max-width: 767.98px) {
8697
.issue-content-left,
8798
.issue-content-right {
@@ -1549,18 +1560,11 @@ td .commit-summary {
15491560
border-bottom-right-radius: 4px;
15501561
}
15511562

1563+
/* To let labels break up and wrap across multiple lines (issue title, comment event), use "display: contents here" to apply parent layout.
1564+
If the labels-list itself needs some layouts, use extra classes or "tw" helpers. */
15521565
.labels-list {
1553-
display: inline-flex;
1554-
flex-wrap: wrap;
1555-
gap: 2px 0.25rem; /* 2px to make vertical gap look equal */
1556-
align-content: center;
1557-
contain: paint;
1558-
}
1559-
1560-
/* To let labels break up and wrap across multiple lines, we use display: contents here. The parent
1561-
element (.flex-item-title) must have 0.25rem gap for consistent label gap. */
1562-
.flex-list .labels-list {
15631566
display: contents;
1567+
font-size: var(--font-size-label); /* it must match the label font size, otherwise the height mismatches */
15641568
}
15651569

15661570
.labels-list .label,

0 commit comments

Comments
 (0)