Fix label display on new issues (#13590)
* Fix label display on new issues PR #13570 broke label rendering for new issues and pulls because missed the fact that the code was relying on the DOM elements being toggled by JavaScript. On top of that, the label rendering for new issues and pull was using an outdated template which I consolidated in a new shared template. * remove wrapper element and style tweaks * style tweaks * use shared template for whole label list Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
0a6ce3eaf1
commit
b83825253e
|
@ -184,6 +184,7 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
|
||||||
ctx.Data["BaseIsCommit"] = baseIsCommit
|
ctx.Data["BaseIsCommit"] = baseIsCommit
|
||||||
ctx.Data["BaseIsBranch"] = baseIsBranch
|
ctx.Data["BaseIsBranch"] = baseIsBranch
|
||||||
ctx.Data["BaseIsTag"] = baseIsTag
|
ctx.Data["BaseIsTag"] = baseIsTag
|
||||||
|
ctx.Data["IsPull"] = true
|
||||||
|
|
||||||
// Now we have the repository that represents the base
|
// Now we have the repository that represents the base
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<a
|
||||||
|
class="ui label item {{if not .label.IsChecked}}hide{{end}}"
|
||||||
|
id="label_{{.label.ID}}"
|
||||||
|
href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}"
|
||||||
|
style="color: {{.label.ForegroundColor}}; background-color: {{.label.Color}}"
|
||||||
|
title="{{.label.Description | RenderEmojiPlain}}"
|
||||||
|
>
|
||||||
|
{{.label.Name | RenderEmoji}}
|
||||||
|
</a>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<div class="ui labels list">
|
||||||
|
<span class="no-select item {{if .ctx.HasSelectedLabel}}hide{{end}}">{{.ctx.i18n.Tr "repo.issues.new.no_label"}}</span>
|
||||||
|
{{range .ctx.Labels}}
|
||||||
|
{{template "repo/issue/labels/label" dict "root" $ "label" .}}
|
||||||
|
{{end}}
|
||||||
|
{{range .ctx.OrgLabels}}
|
||||||
|
{{template "repo/issue/labels/label" dict "root" $ "label" .}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
|
@ -70,19 +70,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui labels list">
|
{{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}}
|
||||||
<span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
|
|
||||||
{{range .Labels}}
|
|
||||||
{{if .IsChecked}}
|
|
||||||
<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>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{range .OrgLabels}}
|
|
||||||
{{if .IsChecked}}
|
|
||||||
<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>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
|
|
|
@ -125,25 +125,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui labels list">
|
{{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}}
|
||||||
{{if not .HasSelectedLabel}}
|
|
||||||
<span class="no-select item">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
|
|
||||||
{{end}}
|
|
||||||
{{range .Labels}}
|
|
||||||
{{if .IsChecked}}
|
|
||||||
<div class="item">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{range .OrgLabels}}
|
|
||||||
{{if .IsChecked}}
|
|
||||||
<div class="item">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
|
|
|
@ -133,11 +133,6 @@
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.label.color {
|
|
||||||
padding: 0 8px;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#deadlineForm input {
|
#deadlineForm input {
|
||||||
|
@ -2985,12 +2980,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.labels.list .item {
|
.labels.list .item {
|
||||||
padding: 0 !important;
|
padding: .3em .5em !important;
|
||||||
margin-bottom: 2px;
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.labels.list .item + .item {
|
.labels.list .item + .item {
|
||||||
margin-left: 2px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody.commit-list {
|
tbody.commit-list {
|
||||||
|
|
Loading…
Reference in New Issue