diff --git a/CODEOWNERS b/CODEOWNERS index 88c71ba17..e30d2c42b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -16,6 +16,8 @@ web_src/.* @caesar @crystal @gusted # HTML templates used by the backend. templates/.* @caesar @crystal @gusted +## the issue sidebar was touched by fnetx +templates/repo/issue/view_content/sidebar.* @fnetx # Files related to Go development. diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 88a6c39e5..465cb44f6 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -47,7 +47,7 @@
- {{template "repo/issue/branch_selector_field" .}} + {{template "repo/issue/view_content/sidebar/branch_selector_field" .}} {{template "repo/issue/labels/labels_selector_field" .}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index cbea32d30..ba1553984 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -1,129 +1,8 @@
- {{template "repo/issue/branch_selector_field" .}} + {{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}} @@ -132,567 +11,56 @@
- -
- {{ctx.Locale.Tr "repo.issues.new.no_milestone"}} - -
- + {{template "repo/issue/view_content/sidebar/milestones" .}}
- -
- {{ctx.Locale.Tr "repo.issues.new.no_projects"}} - -
- + {{template "repo/issue/view_content/sidebar/projects" .}}
- - -
- {{ctx.Locale.Tr "repo.issues.new.no_assignees"}} -
- {{range .Issue.Assignees}} - - {{end}} -
-
- + {{template "repo/issue/view_content/sidebar/assignees" .}}
{{if .Participants}} - {{ctx.Locale.TrN .NumParticipants "repo.issues.num_participants_one" "repo.issues.num_participants_few" .NumParticipants}} -
- {{range .Participants}} - - {{ctx.AvatarUtils.Avatar . 28 "tw-my-0.5 tw-mr-1"}} - - {{end}} -
+ {{template "repo/issue/view_content/sidebar/participants" .}} {{end}} {{if and $.IssueWatch (not .Repository.IsArchived)}}
-
- {{ctx.Locale.Tr "notification.notifications"}} -
- {{template "repo/issue/view_content/watching" .}} -
-
+ {{template "repo/issue/view_content/sidebar/watch" .}} {{end}} + {{if .Repository.IsTimetrackerEnabled $.Context}} - {{if and .CanUseTimetracker (not .Repository.IsArchived)}} -
-
- {{ctx.Locale.Tr "repo.issues.tracker"}} -
-
- {{$.CsrfTokenHtml}} -
-
- {{$.CsrfTokenHtml}} -
- {{if $.IsStopwatchRunning}} - - - {{else}} - {{if .HasUserStopwatch}} -
- {{ctx.Locale.Tr "repo.issues.tracking_already_started" .OtherStopwatchURL}} -
- {{end}} - - - - {{end}} -
-
- {{end}} - {{if .WorkingUsers}} -
-
- {{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time)}} -
- {{range $user, $trackedtime := .WorkingUsers}} -
- - {{ctx.AvatarUtils.Avatar $user}} - -
- {{template "shared/user/authorlink" $user}} -
- {{$trackedtime|Sec2Time}} -
-
-
- {{end}} -
-
- {{end}} + {{template "repo/issue/view_content/sidebar/timetracking" .}} {{end}}
- {{ctx.Locale.Tr "repo.issues.due_date"}} -
-
- {{svg "octicon-x" 16 "close icon"}} - {{ctx.Locale.Tr "repo.issues.due_date_invalid"}} -
- {{if ne .Issue.DeadlineUnix 0}} -

-

-
- {{svg "octicon-calendar" 16 "tw-mr-2"}} - {{DateTime "long" .Issue.DeadlineUnix.FormatDate}} -
-
- {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} - {{svg "octicon-pencil" 16 "tw-mr-1"}} - {{svg "octicon-trash"}} - {{end}} -
-
-

- {{else}} -

{{ctx.Locale.Tr "repo.issues.due_date_not_set"}}

- {{end}} - - {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} -
-
- {{$.CsrfTokenHtml}} - - -
-
- {{end}} -
+ {{template "repo/issue/view_content/sidebar/due_deadline" .}} {{if .Repository.IsDependenciesEnabled $.Context}}
-
- {{if (and (not .BlockedByDependencies) (not .BlockedByDependenciesNotPermitted) (not .BlockingDependencies) (not .BlockingDependenciesNotPermitted))}} - {{ctx.Locale.Tr "repo.issues.dependency.title"}} -
-

- {{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.issues.dependency.pr_no_dependencies"}} - {{else}} - {{ctx.Locale.Tr "repo.issues.dependency.issue_no_dependencies"}} - {{end}} -

- {{end}} - - {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}} - - {{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}} - -
- {{range .BlockingDependencies}} -
-
- - #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} - -
- {{.Repository.OwnerName}}/{{.Repository.Name}} -
-
-
- {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - - {{svg "octicon-trash" 16}} - - {{end}} -
-
- {{end}} - {{if .BlockingDependenciesNotPermitted}} -
- {{ctx.Locale.TrN (len .BlockingDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockingDependenciesNotPermitted)}} -
- {{end}} -
- {{end}} - - {{if or .BlockedByDependencies .BlockedByDependenciesNotPermitted}} - - {{ctx.Locale.Tr "repo.issues.dependency.blocked_by_short"}} - -
- {{range .BlockedByDependencies}} -
-
- - #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} - -
- {{.Repository.OwnerName}}/{{.Repository.Name}} -
-
-
- {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - - {{svg "octicon-trash" 16}} - - {{end}} -
-
- {{end}} - {{if $.CanCreateIssueDependencies}} - {{range .BlockedByDependenciesNotPermitted}} -
-
-
- {{svg "octicon-lock" 16}} - - #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} - -
-
- {{.Repository.OwnerName}}/{{.Repository.Name}} -
-
-
- {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - - {{svg "octicon-trash" 16}} - - {{end}} -
-
- {{end}} - {{else if .BlockedByDependenciesNotPermitted}} -
- {{ctx.Locale.TrN (len .BlockedByDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockedByDependenciesNotPermitted)}} -
- {{end}} -
- {{end}} - - {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} -
-
- {{$.CsrfTokenHtml}} -
- - -
-
-
- {{end}} -
- - {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} - - - - {{end}} + {{template "repo/issue/view_content/sidebar/dependencies" .}} {{end}}
-
- {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} -
- {{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}} - -
-
+ {{template "repo/issue/view_content/sidebar/reference" .}} {{if and .IsRepoAdmin (not .Repository.IsArchived)}}
- {{if or .PinEnabled .Issue.IsPinned}} -
- {{$.CsrfTokenHtml}} - -
- {{end}} - - - - - + {{template "repo/issue/view_content/sidebar/actions" .}} {{end}} - {{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}} - {{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}} -
-
-
- - -
-
- {{end}} + {{if and + .Issue.IsPull + .IsIssuePoster + (not .Issue.IsClosed) + .Issue.PullRequest.HeadRepo + (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) + .CanWriteToHeadRepo + }} +
+ {{template "repo/issue/view_content/sidebar/pull_maintainer_edits" .}} {{end}}
diff --git a/templates/repo/issue/view_content/sidebar/actions.tmpl b/templates/repo/issue/view_content/sidebar/actions.tmpl new file mode 100644 index 000000000..36f21822a --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/actions.tmpl @@ -0,0 +1,114 @@ +{{if or .PinEnabled .Issue.IsPinned}} +
+ {{$.CsrfTokenHtml}} + +
+{{end}} + + + + + diff --git a/templates/repo/issue/view_content/sidebar/assignees.tmpl b/templates/repo/issue/view_content/sidebar/assignees.tmpl new file mode 100644 index 000000000..e51bda95d --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/assignees.tmpl @@ -0,0 +1,45 @@ + + +
+ {{ctx.Locale.Tr "repo.issues.new.no_assignees"}} +
+ {{range .Issue.Assignees}} + + {{end}} +
+
diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl similarity index 100% rename from templates/repo/issue/branch_selector_field.tmpl rename to templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl diff --git a/templates/repo/issue/view_content/sidebar/dependencies.tmpl b/templates/repo/issue/view_content/sidebar/dependencies.tmpl new file mode 100644 index 000000000..791bd5c4a --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/dependencies.tmpl @@ -0,0 +1,145 @@ +
+ {{if (and (not .BlockedByDependencies) (not .BlockedByDependenciesNotPermitted) (not .BlockingDependencies) (not .BlockingDependenciesNotPermitted))}} + {{ctx.Locale.Tr "repo.issues.dependency.title"}} +
+

+ {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.issues.dependency.pr_no_dependencies"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.dependency.issue_no_dependencies"}} + {{end}} +

+ {{end}} + + {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}} + + {{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}} + +
+ {{range .BlockingDependencies}} +
+
+ + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} + +
+ {{.Repository.OwnerName}}/{{.Repository.Name}} +
+
+
+ {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + + {{svg "octicon-trash" 16}} + + {{end}} +
+
+ {{end}} + {{if .BlockingDependenciesNotPermitted}} +
+ {{ctx.Locale.TrN (len .BlockingDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockingDependenciesNotPermitted)}} +
+ {{end}} +
+ {{end}} + + {{if or .BlockedByDependencies .BlockedByDependenciesNotPermitted}} + + {{ctx.Locale.Tr "repo.issues.dependency.blocked_by_short"}} + +
+ {{range .BlockedByDependencies}} +
+
+ + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} + +
+ {{.Repository.OwnerName}}/{{.Repository.Name}} +
+
+
+ {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + + {{svg "octicon-trash" 16}} + + {{end}} +
+
+ {{end}} + {{if $.CanCreateIssueDependencies}} + {{range .BlockedByDependenciesNotPermitted}} +
+
+
+ {{svg "octicon-lock" 16}} + + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} + +
+
+ {{.Repository.OwnerName}}/{{.Repository.Name}} +
+
+
+ {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + + {{svg "octicon-trash" 16}} + + {{end}} +
+
+ {{end}} + {{else if .BlockedByDependenciesNotPermitted}} +
+ {{ctx.Locale.TrN (len .BlockedByDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockedByDependenciesNotPermitted)}} +
+ {{end}} +
+ {{end}} + + {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} +
+
+ {{$.CsrfTokenHtml}} +
+ + +
+
+
+ {{end}} +
+ +{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} + + + +{{end}} diff --git a/templates/repo/issue/view_content/sidebar/due_deadline.tmpl b/templates/repo/issue/view_content/sidebar/due_deadline.tmpl new file mode 100644 index 000000000..2de836b4e --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/due_deadline.tmpl @@ -0,0 +1,41 @@ +{{ctx.Locale.Tr "repo.issues.due_date"}} +
+
+ {{svg "octicon-x" 16 "close icon"}} + {{ctx.Locale.Tr "repo.issues.due_date_invalid"}} +
+ {{if ne .Issue.DeadlineUnix 0}} +

+

+
+ {{svg "octicon-calendar" 16 "tw-mr-2"}} + {{DateTime "long" .Issue.DeadlineUnix.FormatDate}} +
+
+ {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-pencil" 16 "tw-mr-1"}} + {{svg "octicon-trash"}} + {{end}} +
+
+

+ {{else}} +

{{ctx.Locale.Tr "repo.issues.due_date_not_set"}}

+ {{end}} + + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} +
+
+ {{$.CsrfTokenHtml}} + + +
+
+ {{end}} +
diff --git a/templates/repo/issue/view_content/sidebar/milestones.tmpl b/templates/repo/issue/view_content/sidebar/milestones.tmpl new file mode 100644 index 000000000..661ca8074 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/milestones.tmpl @@ -0,0 +1,22 @@ + +
+ {{ctx.Locale.Tr "repo.issues.new.no_milestone"}} + +
diff --git a/templates/repo/issue/view_content/sidebar/participants.tmpl b/templates/repo/issue/view_content/sidebar/participants.tmpl new file mode 100644 index 000000000..93e2579d8 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/participants.tmpl @@ -0,0 +1,8 @@ +{{ctx.Locale.TrN .NumParticipants "repo.issues.num_participants_one" "repo.issues.num_participants_few" .NumParticipants}} +
+ {{range .Participants}} + + {{ctx.AvatarUtils.Avatar . 28 "tw-my-0.5 tw-mr-1"}} + + {{end}} +
diff --git a/templates/repo/issue/view_content/sidebar/projects.tmpl b/templates/repo/issue/view_content/sidebar/projects.tmpl new file mode 100644 index 000000000..91d75f3bd --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/projects.tmpl @@ -0,0 +1,54 @@ + +
+ {{ctx.Locale.Tr "repo.issues.new.no_projects"}} + +
diff --git a/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl b/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl new file mode 100644 index 000000000..6ec5c05fd --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl @@ -0,0 +1,10 @@ +
+
+ + +
+
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 000000000..930c2a639 --- /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 000000000..102508fda --- /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 000000000..f1588b3f8 --- /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)}} +
+ + {{if .IsPullWorkInProgress}} + {{ctx.Locale.Tr "repo.pulls.ready_for_review"}} {{ctx.Locale.Tr "repo.pulls.remove_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} + {{else}} + {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} + {{end}} + +
+{{end}} diff --git a/templates/repo/issue/view_content/sidebar/reference.tmpl b/templates/repo/issue/view_content/sidebar/reference.tmpl new file mode 100644 index 000000000..bbbc09955 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/reference.tmpl @@ -0,0 +1,7 @@ +
+ {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} +
+ {{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}} + +
+
diff --git a/templates/repo/issue/view_content/sidebar/timetracking.tmpl b/templates/repo/issue/view_content/sidebar/timetracking.tmpl new file mode 100644 index 000000000..610600b2f --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/timetracking.tmpl @@ -0,0 +1,73 @@ +{{if and .CanUseTimetracker (not .Repository.IsArchived)}} +
+
+ {{ctx.Locale.Tr "repo.issues.tracker"}} +
+
+ {{$.CsrfTokenHtml}} +
+
+ {{$.CsrfTokenHtml}} +
+ {{if $.IsStopwatchRunning}} + + + {{else}} + {{if .HasUserStopwatch}} +
+ {{ctx.Locale.Tr "repo.issues.tracking_already_started" .OtherStopwatchURL}} +
+ {{end}} + + + + {{end}} +
+
+{{end}} +{{if .WorkingUsers}} +
+
+ {{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time)}} +
+ {{range $user, $trackedtime := .WorkingUsers}} +
+ + {{ctx.AvatarUtils.Avatar $user}} + +
+ {{template "shared/user/authorlink" $user}} +
+ {{$trackedtime|Sec2Time}} +
+
+
+ {{end}} +
+
+{{end}} diff --git a/templates/repo/issue/view_content/sidebar/watch.tmpl b/templates/repo/issue/view_content/sidebar/watch.tmpl new file mode 100644 index 000000000..6c74b140c --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/watch.tmpl @@ -0,0 +1,17 @@ +
+ {{ctx.Locale.Tr "notification.notifications"}} +
+
+ + +
+
+
diff --git a/templates/repo/issue/view_content/watching.tmpl b/templates/repo/issue/view_content/watching.tmpl deleted file mode 100644 index 05936d090..000000000 --- a/templates/repo/issue/view_content/watching.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -
- - -