From 66cab785fce8878af2208baf8de45f5dbbc00061 Mon Sep 17 00:00:00 2001 From: Otto Richter Date: Wed, 24 Apr 2024 21:06:22 +0200 Subject: [PATCH] Split PR-only templates --- .../repo/issue/view_content/sidebar.tmpl | 125 +----------------- .../view_content/sidebar/pull_review.tmpl | 45 +++++++ .../view_content/sidebar/pull_reviewers.tmpl | 67 ++++++++++ .../issue/view_content/sidebar/pull_wip.tmpl | 11 ++ 4 files changed, 125 insertions(+), 123 deletions(-) create mode 100644 templates/repo/issue/view_content/sidebar/pull_review.tmpl create mode 100644 templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl create mode 100644 templates/repo/issue/view_content/sidebar/pull_wip.tmpl diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index e8b1b2258f..37280f69e4 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -1,129 +1,8 @@
{{template "repo/issue/view_content/sidebar/branch_selector_field" .}} {{if .Issue.IsPull}} - - - -
- {{ctx.Locale.Tr "repo.issues.new.no_reviewers"}} -
- {{range .PullReviewers}} -
-
- {{if .User}} - {{ctx.AvatarUtils.Avatar .User 20 "tw-mr-2"}}{{.User.GetDisplayName}} - {{else if .Team}} - {{svg "octicon-people" 20 "tw-mr-2"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}} - {{end}} -
-
- {{if (and $.Permission.IsAdmin (or (eq .Review.Type 1) (eq .Review.Type 3)) (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged))}} - - {{svg "octicon-x" 20}} - - - {{end}} - {{if .Review.Stale}} - - {{svg "octicon-hourglass" 16}} - - {{end}} - {{if and .CanChange (or .Checked (and (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged)))}} - {{if .Checked}}{{svg "octicon-trash"}}{{else}}{{svg "octicon-sync"}}{{end}} - {{end}} - {{svg (printf "octicon-%s" .Review.Type.Icon) 16 (printf "text %s" (.Review.HTMLTypeColorName))}} -
-
- {{end}} - {{range .OriginalReviews}} -
- -
- {{svg (printf "octicon-%s" .Type.Icon) 16 (printf "text %s" (.HTMLTypeColorName))}} -
-
- {{end}} -
-
- {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed)}} - - {{end}} + {{template "repo/issue/view_content/sidebar/pull_review" .}} + {{template "repo/issue/view_content/sidebar/pull_wip" .}}
{{end}} diff --git a/templates/repo/issue/view_content/sidebar/pull_review.tmpl b/templates/repo/issue/view_content/sidebar/pull_review.tmpl new file mode 100644 index 0000000000..930c2a6392 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_review.tmpl @@ -0,0 +1,45 @@ + + +{{template "repo/issue/view_content/sidebar/pull_reviewers" .}} diff --git a/templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl b/templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl new file mode 100644 index 0000000000..102508fdaf --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl @@ -0,0 +1,67 @@ +
+ {{ctx.Locale.Tr "repo.issues.new.no_reviewers"}} +
+ {{range .PullReviewers}} +
+
+ {{if .User}} + {{ctx.AvatarUtils.Avatar .User 20 "tw-mr-2"}}{{.User.GetDisplayName}} + {{else if .Team}} + {{svg "octicon-people" 20 "tw-mr-2"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}} + {{end}} +
+
+ {{if (and $.Permission.IsAdmin (or (eq .Review.Type 1) (eq .Review.Type 3)) (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged))}} + + {{svg "octicon-x" 20}} + + + {{end}} + {{if .Review.Stale}} + + {{svg "octicon-hourglass" 16}} + + {{end}} + {{if and .CanChange (or .Checked (and (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged)))}} + {{if .Checked}}{{svg "octicon-trash"}}{{else}}{{svg "octicon-sync"}}{{end}} + {{end}} + {{svg (printf "octicon-%s" .Review.Type.Icon) 16 (printf "text %s" (.Review.HTMLTypeColorName))}} +
+
+ {{end}} + {{range .OriginalReviews}} +
+ +
+ {{svg (printf "octicon-%s" .Type.Icon) 16 (printf "text %s" (.HTMLTypeColorName))}} +
+
+ {{end}} +
+
diff --git a/templates/repo/issue/view_content/sidebar/pull_wip.tmpl b/templates/repo/issue/view_content/sidebar/pull_wip.tmpl new file mode 100644 index 0000000000..f1588b3f80 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_wip.tmpl @@ -0,0 +1,11 @@ +{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed)}} + +{{end}}