From a6a79add68e1d47c3e6a84c4a7c96e4980d82709 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Thu, 28 Sep 2023 06:51:01 +0800 Subject: [PATCH] Fix protected branch icon location (#26576) (#27317) Backport #26576 by @yp05327 Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/717c726d-d3ae-4ea3-86bf-36fd8430f1ba) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/f4508428-380a-4b44-9cc2-fa9483971808) Co-authored-by: yp05327 <576951401@qq.com> --- templates/repo/branch/list.tmpl | 16 ++++++++-------- templates/repo/commit_status.tmpl | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 36d1b628c9..f554c851d3 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -19,12 +19,12 @@ - {{if .DefaultBranchBranch.IsProtected}} - {{svg "octicon-shield-lock"}} - {{end}}
+ {{if .DefaultBranchBranch.IsProtected}} + {{svg "octicon-shield-lock"}} + {{end}} {{.DefaultBranchBranch.DBBranch.Name}} - + {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}}

{{svg "octicon-git-commit" 16 "gt-mr-2"}}{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}} · {{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage .RepoLink .Repository.ComposeMetas}} · {{ctx.Locale.Tr "org.repo_updated"}} {{TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime ctx.Locale}}{{if .DefaultBranchBranch.DBBranch.Pusher}}  {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}

@@ -97,12 +97,12 @@

{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{TimeSinceUnix .DBBranch.DeletedUnix ctx.Locale}}

{{else}} - {{if .IsProtected}} - {{svg "octicon-shield-lock"}} - {{end}}
+ {{if .IsProtected}} + {{svg "octicon-shield-lock"}} + {{end}} {{.DBBranch.Name}} - + {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}}

{{svg "octicon-git-commit" 16 "gt-mr-2"}}{{ShortSha .DBBranch.CommitID}} · {{RenderCommitMessage $.Context .DBBranch.CommitMessage $.RepoLink $.Repository.ComposeMetas}} · {{ctx.Locale.Tr "org.repo_updated"}} {{TimeSince .DBBranch.CommitTime.AsTime ctx.Locale}}{{if .DBBranch.Pusher}}  {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}}  {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}

diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl index ebd8a55f65..3dc1da61d3 100644 --- a/templates/repo/commit_status.tmpl +++ b/templates/repo/commit_status.tmpl @@ -1,4 +1,5 @@ + {{if eq .State "pending"}} {{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}} {{end}} @@ -11,3 +12,4 @@ {{if eq .State "failure"}} {{svg "octicon-x" 18 "commit-status icon text red"}} {{end}} +