From da4bb6fc4ef552865816303fc9c0db25509ff626 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 29 Nov 2020 04:26:03 +0100 Subject: [PATCH] Fix label styles affecting shabox (#13734) * Fix label styles affecting shabox Add common parent .labels-list to issue labels lists to prevent affecting other elements. Fixes: https://github.com/go-gitea/gitea/issues/13704 * Update templates/shared/issuelist.tmpl * Update templates/shared/issuelist.tmpl Co-authored-by: Lunny Xiao --- modules/templates/helper.go | 9 +++---- .../repo/issue/labels/labels_sidebar.tmpl | 14 +++++----- templates/shared/issuelist.tmpl | 8 +++--- web_src/less/_repository.less | 27 +++++-------------- 4 files changed, 23 insertions(+), 35 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 4e5c96cd0f..bb7a3476f2 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -364,13 +364,12 @@ func NewFuncMap() []template.FuncMap { return "" }, "RenderLabels": func(labels []*models.Label) template.HTML { - html := "" - + html := `` for _, label := range labels { - html = fmt.Sprintf("%s
%s
", - html, label.ForegroundColor(), label.Color, RenderEmoji(label.Name)) + html += fmt.Sprintf("
%s
", + label.ForegroundColor(), label.Color, RenderEmoji(label.Name)) } - + html += "
" return template.HTML(html) }, }} diff --git a/templates/repo/issue/labels/labels_sidebar.tmpl b/templates/repo/issue/labels/labels_sidebar.tmpl index bf6f98c888..1d61ecf3df 100644 --- a/templates/repo/issue/labels/labels_sidebar.tmpl +++ b/templates/repo/issue/labels/labels_sidebar.tmpl @@ -1,9 +1,11 @@
{{.ctx.i18n.Tr "repo.issues.new.no_label"}} - {{range .ctx.Labels}} - {{template "repo/issue/labels/label" dict "root" $ "label" .}} - {{end}} - {{range .ctx.OrgLabels}} - {{template "repo/issue/labels/label" dict "root" $ "label" .}} - {{end}} + + {{range .ctx.Labels}} + {{template "repo/issue/labels/label" dict "root" $ "label" .}} + {{end}} + {{range .ctx.OrgLabels}} + {{template "repo/issue/labels/label" dict "root" $ "label" .}} + {{end}} +
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 9393583862..beb78a5491 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -37,9 +37,11 @@ {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} {{end}} {{end}} - {{range .Labels}} - {{.Name | RenderEmoji}} - {{end}} + + {{range .Labels}} + {{.Name | RenderEmoji}} + {{end}} +