From 3fd3b8f8ea6b8ea52d87eba6e0630c2ffe2b8e50 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Thu, 17 Aug 2023 04:48:17 +0000 Subject: [PATCH 1/3] improve --- routers/web/repo/projects.go | 4 ++-- templates/repo/header.tmpl | 2 +- templates/repo/issue/card.tmpl | 35 ++++++++++++++++++------------- web_src/css/features/projects.css | 9 +++++++- web_src/css/repo/issue-card.css | 8 +++++++ 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index eef57f46272f8..599225c8b3964 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -116,7 +116,7 @@ func Projects(ctx *context.Context) { ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(unit.TypeProjects) ctx.Data["IsShowClosed"] = isShowClosed - ctx.Data["IsProjectsPage"] = true + ctx.Data["PageIsProjects"] = true ctx.Data["SortType"] = sortType ctx.HTML(http.StatusOK, tplProjects) @@ -362,7 +362,7 @@ func ViewProject(ctx *context.Context) { return } - ctx.Data["IsProjectsPage"] = true + ctx.Data["PageIsProjects"] = true ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(unit.TypeProjects) ctx.Data["Project"] = project ctx.Data["IssuesMap"] = issuesMap diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 984e9f044eb06..4c6f0e8086151 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -195,7 +195,7 @@ {{end}} {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}} - + {{svg "octicon-project"}} {{.locale.Tr "repo.project_board"}} {{if .Repository.NumOpenProjects}} {{CountFmt .Repository.NumOpenProjects}} diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index 05b7dbaabcf50..cf9cb2a05a9f0 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -1,12 +1,12 @@ {{with .Issue}} {{if eq $.Page.Project.CardType 1}}{{/* Images and Text*/}} - + {{range (index $.Page.issuesAttachmentMap .ID)}} {{end}} {{end}} - + {{template "shared/issueicon" .}} @@ -18,7 +18,7 @@ {{end}} - + {{if not $.Page.Repository}}{{.Repo.FullName}}{{end}}#{{.Index}} {{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}} @@ -31,17 +31,19 @@ {{end}} + {{if .MilestoneID}} - - + + {{svg "octicon-milestone" 16 "gt-mr-2 gt-vm"}} - {{.Milestone.Name}} + {{.Milestone.Name}} {{end}} + {{if $.Page.LinkedPRs}} {{range index $.Page.LinkedPRs .ID}} - + {{svg "octicon-git-merge" 16 "gt-mr-2 gt-vm"}} {{.Title}} #{{.Index}} @@ -51,16 +53,19 @@ {{end}} - {{if or .Labels .Assignees}} - + {{if .Labels}} + {{range .Labels}} - {{RenderLabel ctx .}} + {{RenderLabel ctx .}} + {{end}} + + {{end}} + + {{if .Assignees}} + + {{range .Assignees}} + {{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}} {{end}} - - {{range .Assignees}} - {{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}} - {{end}} - {{end}} {{end}} diff --git a/web_src/css/features/projects.css b/web_src/css/features/projects.css index f85430a2a80ed..eb334a9dc0368 100644 --- a/web_src/css/features/projects.css +++ b/web_src/css/features/projects.css @@ -73,7 +73,8 @@ } .card-attachment-images { - display: inline-block; + display: flex; + flex-wrap: wrap; white-space: nowrap; overflow: hidden; text-align: center; @@ -82,12 +83,18 @@ .card-attachment-images img { display: inline-block; max-height: 50px; + max-width: 100%; border-radius: var(--border-radius); margin-right: 2px; } +.card-attachment-images img:not(:first-child) { + padding-top: 0.25rem; +} + .card-attachment-images img:only-child { max-height: 90px; + max-width: 100%; margin: auto; } diff --git a/web_src/css/repo/issue-card.css b/web_src/css/repo/issue-card.css index 31d3a2375b99f..47a7616d145ab 100644 --- a/web_src/css/repo/issue-card.css +++ b/web_src/css/repo/issue-card.css @@ -8,6 +8,14 @@ background: var(--color-card); } +.issue-card .issue-card-content { + width: 100%; +} + +.issue-card .issue-card-content:not(:first-child) { + padding-top: 0.25rem; +} + .issue-card-icon, .issue-card-unpin { margin-top: 1px; From b0e002f7fe96bf270c240df376bfc834a88f4aab Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Thu, 17 Aug 2023 05:14:27 +0000 Subject: [PATCH 2/3] fix lint --- templates/repo/issue/card.tmpl | 3 --- 1 file changed, 3 deletions(-) diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index cf9cb2a05a9f0..9adc46f2568d7 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -31,7 +31,6 @@ {{end}} - {{if .MilestoneID}} @@ -40,7 +39,6 @@ {{end}} - {{if $.Page.LinkedPRs}} {{range index $.Page.LinkedPRs .ID}} @@ -60,7 +58,6 @@ {{end}} {{end}} - {{if .Assignees}} {{range .Assignees}} From 3b23b2a71c630d2f14c51917fd8c36a22a49a107 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Fri, 18 Aug 2023 08:42:32 +0900 Subject: [PATCH 3/3] Update templates/repo/issue/card.tmpl Co-authored-by: delvh --- templates/repo/issue/card.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index 9adc46f2568d7..997e64d856c58 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -32,7 +32,7 @@ {{if .MilestoneID}} - + {{svg "octicon-milestone" 16 "gt-mr-2 gt-vm"}} {{.Milestone.Name}}