Skip to content

Fix label display on new issues #13590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions routers/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
ctx.Data["BaseIsCommit"] = baseIsCommit
ctx.Data["BaseIsBranch"] = baseIsBranch
ctx.Data["BaseIsTag"] = baseIsTag
ctx.Data["IsPull"] = true

// Now we have the repository that represents the base

Expand Down
9 changes: 9 additions & 0 deletions templates/repo/issue/labels/label.tmpl
Original file line number Diff line number Diff line change
@@ -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>
9 changes: 9 additions & 0 deletions templates/repo/issue/labels/labels_sidebar.tmpl
Original file line number Diff line number Diff line change
@@ -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>
14 changes: 1 addition & 13 deletions templates/repo/issue/new_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,7 @@
{{end}}
</div>
</div>
<div class="ui labels list">
<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>
{{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}}

<div class="ui divider"></div>

Expand Down
20 changes: 1 addition & 19 deletions templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,7 @@
{{end}}
</div>
</div>
<div class="ui labels list">
{{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>
{{template "repo/issue/labels/labels_sidebar" dict "root" $ "ctx" .}}

<div class="ui divider"></div>

Expand Down
13 changes: 5 additions & 8 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@
max-width: 100px;
}
}

.label.color {
padding: 0 8px;
margin-right: 5px;
}
}

#deadlineForm input {
Expand Down Expand Up @@ -2985,12 +2980,14 @@
}

.labels.list .item {
padding: 0 !important;
margin-bottom: 2px;
padding: .3em .5em !important;
margin-left: 0;
margin-right: 0;
margin-bottom: 3px;
}

.labels.list .item + .item {
margin-left: 2px;
margin-left: 3px;
}

tbody.commit-list {
Expand Down