Skip to content

Commit 50cbb20

Browse files
Fix issue label rendering (#13570)
* Fix issue label rendering Prevent rendering of inactive labels and make them wrap inline. Fixes: #13566 * also don't render the placeholder Co-authored-by: techknowlogick <[email protected]>
1 parent f0ed712 commit 50cbb20

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

templates/repo/issue/new_form.tmpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@
7373
<div class="ui labels list">
7474
<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
7575
{{range .Labels}}
76-
<a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name | RenderEmoji}}</span></a>
76+
{{if .IsChecked}}
77+
<a class="item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name | RenderEmoji}}</span></a>
78+
{{end}}
7779
{{end}}
7880
{{range .OrgLabels}}
79-
<a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name | RenderEmoji}}</span></a>
81+
{{if .IsChecked}}
82+
<a class="item" id="label_{{.ID}}" href="/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name | RenderEmoji}}</span></a>
83+
{{end}}
8084
{{end}}
8185
</div>
8286

templates/repo/issue/view_content/sidebar.tmpl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,22 @@
126126
</div>
127127
</div>
128128
<div class="ui labels list">
129-
<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
129+
{{if not .HasSelectedLabel}}
130+
<span class="no-select item">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
131+
{{end}}
130132
{{range .Labels}}
131-
<div class="item">
132-
<a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
133-
</div>
133+
{{if .IsChecked}}
134+
<div class="item">
135+
<a class="ui label" id="label_{{.ID}}" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
136+
</div>
137+
{{end}}
134138
{{end}}
135139
{{range .OrgLabels}}
136-
<div class="item">
137-
<a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
138-
</div>
139-
140+
{{if .IsChecked}}
141+
<div class="item">
142+
<a class="ui label" id="label_{{.ID}}" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
143+
</div>
144+
{{end}}
140145
{{end}}
141146
</div>
142147

web_src/less/_repository.less

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,6 +2983,20 @@
29832983
}
29842984
}
29852985

2986+
.labels.list {
2987+
display: flex;
2988+
flex-wrap: wrap;
2989+
}
2990+
2991+
.labels.list .item {
2992+
padding: 0 !important;
2993+
margin-bottom: 2px;
2994+
}
2995+
2996+
.labels.list .item + .item {
2997+
margin-left: 2px;
2998+
}
2999+
29863000
tbody.commit-list {
29873001
vertical-align: baseline;
29883002
}

0 commit comments

Comments
 (0)