From 46b253cb5e5bfe2387d0ef7007fa70ad25f3cea0 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 28 Nov 2020 16:17:48 +0100 Subject: [PATCH 1/3] 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 --- 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 4e5c96cd0fa7..bb7a3476f29b 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 bf6f98c88860..1d61ecf3df5b 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 93935838628e..52281b532375 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}} +
diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 1f39cc565982..e77e9719c350 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2856,35 +2856,20 @@ } } -.labels.list { - display: flex; +.labels-list { + display: inline-flex; flex-wrap: wrap; } -.labels.list .item, -.timeline-item .label { - padding: .3em .5em !important; - margin-left: 0; - margin-right: 0; - margin-bottom: 3px; -} - -.issue-item-top-row .label { - margin-left: 0; - margin-right: 0; +.labels-list .label { margin-top: 1.5px; margin-bottom: 1.5px; -} - -.labels.list .item, -.timeline-item .label, -.issue-item-top-row .label { margin-right: 3px; - display: inline !important; + margin-left: 0; + display: inline-block !important; } -.timeline-item .label:last-of-type, -.issue-item-top-row .label:last-of-type { +.labels-list .label:last-of-type { margin-right: 0; } From b04e6e14ead1c32cfa54da17c803f12c2f320363 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 28 Nov 2020 21:17:21 +0100 Subject: [PATCH 2/3] Update templates/shared/issuelist.tmpl --- templates/shared/issuelist.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 52281b532375..ea1b13598ff9 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -37,7 +37,7 @@ {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}} {{end}} {{end}} -
+ {{range .Labels}} {{.Name | RenderEmoji}} {{end}} From 43e3fd00cdcd576bea6f8d2b6b980cbab5a87eed Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 28 Nov 2020 21:17:44 +0100 Subject: [PATCH 3/3] Update templates/shared/issuelist.tmpl --- templates/shared/issuelist.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index ea1b13598ff9..beb78a54914b 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -41,7 +41,7 @@ {{range .Labels}} {{.Name | RenderEmoji}} {{end}} -
+