1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-22 08:42:32 -05:00

Merge pull request '[v8.0/forgejo] fix: labels set during issue creation are not displayed' (#4547) from bp-v8.0/forgejo-3269583 into v8.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4547
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-07-17 13:33:23 +00:00
commit b3f60875d2
4 changed files with 22 additions and 26 deletions

View file

@ -5,7 +5,7 @@
{{svg "octicon-gear" 16 "tw-ml-1"}} {{svg "octicon-gear" 16 "tw-ml-1"}}
{{end}} {{end}}
</span> </span>
<div class="filter menu" {{if .Issue}}data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels"{{else}}data-id="#label_ids"{{end}}> <div class="filter menu ugc-labels" {{if .Issue}}data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels"{{else}}data-id="#label_ids"{{end}}>
{{if or .Labels .OrgLabels}} {{if or .Labels .OrgLabels}}
<div class="ui icon search input"> <div class="ui icon search input">
<i class="icon">{{svg "octicon-search" 16}}</i> <i class="icon">{{svg "octicon-search" 16}}</i>

View file

@ -1,13 +1,11 @@
<div class="ui labels list"> <div class="ui labels list">
<span class="no-select item {{if .root.HasSelectedLabel}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span> <span class="no-select {{if .root.HasSelectedLabel}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span>
{{if .root.HasSelectedLabel}} <span class="labels-list ugc-labels">
<span class="labels-list"> {{range .root.Labels}}
{{range .root.Labels}} {{template "repo/issue/labels/label" dict "root" $.root "label" .}}
{{template "repo/issue/labels/label" dict "root" $.root "label" .}} {{end}}
{{end}} {{range .root.OrgLabels}}
{{range .root.OrgLabels}} {{template "repo/issue/labels/label" dict "root" $.root "label" .}}
{{template "repo/issue/labels/label" dict "root" $.root "label" .}} {{end}}
{{end}} </span>
</span>
{{end}}
</div> </div>

View file

@ -1129,10 +1129,11 @@ func TestIssueUnsubscription(t *testing.T) {
func TestIssueLabelList(t *testing.T) { func TestIssueLabelList(t *testing.T) {
defer tests.PrepareTestEnv(t)() defer tests.PrepareTestEnv(t)()
// The label list should always be present. When no labels are selected, .no-select is visible, otherwise hidden.
labelListSelector := ".labels.list .labels-list" labelListSelector := ".labels.list .labels-list"
hiddenClass := "tw-hidden" hiddenClass := "tw-hidden"
t.Run("Show label list", func(t *testing.T) { t.Run("Test label list", func(t *testing.T) {
defer tests.PrintCurrentTest(t)() defer tests.PrintCurrentTest(t)()
req := NewRequest(t, "GET", "/user2/repo1/issues/1") req := NewRequest(t, "GET", "/user2/repo1/issues/1")
@ -1140,18 +1141,6 @@ func TestIssueLabelList(t *testing.T) {
htmlDoc := NewHTMLParser(t, resp.Body) htmlDoc := NewHTMLParser(t, resp.Body)
htmlDoc.AssertElement(t, labelListSelector, true) htmlDoc.AssertElement(t, labelListSelector, true)
htmlDoc.AssertElement(t, ".labels.list .no-select.item."+hiddenClass, true) htmlDoc.AssertElement(t, ".labels.list .no-select."+hiddenClass, true)
})
t.Run("Show no label list", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
session := loginUser(t, "user2")
req := NewRequest(t, "GET", "/user2/repo2/issues/1")
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
htmlDoc.AssertElement(t, labelListSelector, false)
htmlDoc.AssertElement(t, ".labels.list .no-select.item:not([class*='"+hiddenClass+"'])", true)
}) })
} }

View file

@ -98,6 +98,15 @@ a.ui.label:hover {
display: inline-block !important; display: inline-block !important;
} }
.ugc-labels .item {
text-overflow: unset !important;
}
.ugc-labels .item .ui.label {
text-wrap: auto;
overflow-wrap: anywhere;
}
.ui.basic.label { .ui.basic.label {
background: var(--color-button); background: var(--color-button);
border: 1px solid var(--color-light-border); border: 1px solid var(--color-light-border);