diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl index 5793a8bfda8..643222ca72c 100644 --- a/templates/repo/issue/branch_selector_field.tmpl +++ b/templates/repo/issue/branch_selector_field.tmpl @@ -44,6 +44,4 @@ - -
{{end}} diff --git a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl new file mode 100644 index 00000000000..43736deeed8 --- /dev/null +++ b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl @@ -0,0 +1,15 @@ +{{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}} +{{end}} diff --git a/templates/repo/issue/sidebar/assignee_list.tmpl b/templates/repo/issue/sidebar/assignee_list.tmpl new file mode 100644 index 00000000000..260f7c5be4d --- /dev/null +++ b/templates/repo/issue/sidebar/assignee_list.tmpl @@ -0,0 +1,46 @@ +
+ + +
+ {{ctx.Locale.Tr "repo.issues.new.no_assignees"}} +
+ {{range .Issue.Assignees}} + + {{end}} +
+
diff --git a/templates/repo/issue/sidebar/due_date.tmpl b/templates/repo/issue/sidebar/due_date.tmpl new file mode 100644 index 00000000000..e6e19f6f86f --- /dev/null +++ b/templates/repo/issue/sidebar/due_date.tmpl @@ -0,0 +1,29 @@ +
+{{ctx.Locale.Tr "repo.issues.due_date"}} +
+ {{if .Issue.DeadlineUnix}} +
+
+ {{svg "octicon-calendar"}} {{DateUtils.AbsoluteLong .Issue.DeadlineUnix}} +
+
+ {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-pencil"}} + {{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/sidebar/issue_dependencies.tmpl b/templates/repo/issue/sidebar/issue_dependencies.tmpl new file mode 100644 index 00000000000..f372ff81b2a --- /dev/null +++ b/templates/repo/issue/sidebar/issue_dependencies.tmpl @@ -0,0 +1,149 @@ +{{if .Repository.IsDependenciesEnabled ctx}} +
+ +
+ {{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 | ctx.RenderUtils.RenderEmoji}} + +
+ {{.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 | ctx.RenderUtils.RenderEmoji}} + +
+ {{.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 | ctx.RenderUtils.RenderEmoji}} + +
+
+ {{.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}} +{{end}} diff --git a/templates/repo/issue/sidebar/issue_management.tmpl b/templates/repo/issue/sidebar/issue_management.tmpl new file mode 100644 index 00000000000..3342d992129 --- /dev/null +++ b/templates/repo/issue/sidebar/issue_management.tmpl @@ -0,0 +1,118 @@ +{{if and .IsRepoAdmin (not .Repository.IsArchived)}} +
+ + {{if or .PinEnabled .Issue.IsPinned}} +
+ {{$.CsrfTokenHtml}} + +
+ {{end}} + + + + + +{{end}} diff --git a/templates/repo/issue/sidebar/milestone_list.tmpl b/templates/repo/issue/sidebar/milestone_list.tmpl new file mode 100644 index 00000000000..e9ca02f77a1 --- /dev/null +++ b/templates/repo/issue/sidebar/milestone_list.tmpl @@ -0,0 +1,23 @@ +
+ +
+ {{ctx.Locale.Tr "repo.issues.new.no_milestone"}} +
+ {{if .Issue.Milestone}} + + {{svg "octicon-milestone" 18 "tw-mr-2"}} + {{.Issue.Milestone.Name}} + + {{end}} +
+
diff --git a/templates/repo/issue/sidebar/participant_list.tmpl b/templates/repo/issue/sidebar/participant_list.tmpl new file mode 100644 index 00000000000..91c36fc01ef --- /dev/null +++ b/templates/repo/issue/sidebar/participant_list.tmpl @@ -0,0 +1,11 @@ +{{if .Participants}} +
+ {{ctx.Locale.Tr "repo.issues.num_participants" .NumParticipants}} +
+ {{range .Participants}} + + {{ctx.AvatarUtils.Avatar . 28 "tw-my-0.5 tw-mr-1"}} + + {{end}} +
+{{end}} diff --git a/templates/repo/issue/sidebar/project_list.tmpl b/templates/repo/issue/sidebar/project_list.tmpl new file mode 100644 index 00000000000..ec79f8032f7 --- /dev/null +++ b/templates/repo/issue/sidebar/project_list.tmpl @@ -0,0 +1,53 @@ +{{if .IsProjectsEnabled}} +
+ + +
+ {{ctx.Locale.Tr "repo.issues.new.no_projects"}} +
+ {{if .Issue.Project}} + + {{svg .Issue.Project.IconName 18 "tw-mr-2"}}{{.Issue.Project.Title}} + + {{end}} +
+
+{{end}} diff --git a/templates/repo/issue/sidebar/reference_link.tmpl b/templates/repo/issue/sidebar/reference_link.tmpl new file mode 100644 index 00000000000..6b8f120c7b0 --- /dev/null +++ b/templates/repo/issue/sidebar/reference_link.tmpl @@ -0,0 +1,8 @@ +
+
+ {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} +
+ {{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}} + +
+
diff --git a/templates/repo/issue/sidebar/reviewer_list.tmpl b/templates/repo/issue/sidebar/reviewer_list.tmpl new file mode 100644 index 00000000000..cf4d067c0f8 --- /dev/null +++ b/templates/repo/issue/sidebar/reviewer_list.tmpl @@ -0,0 +1,116 @@ + + + +
+ {{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)))}} + {{svg (Iif .Checked "octicon-trash" "octicon-sync")}} + {{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/sidebar/stopwatch_timetracker.tmpl b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl new file mode 100644 index 00000000000..9a49664b0e6 --- /dev/null +++ b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl @@ -0,0 +1,75 @@ +{{if .Repository.IsTimetrackerEnabled ctx}} + {{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}} +{{end}} diff --git a/templates/repo/issue/sidebar/watch_notification.tmpl b/templates/repo/issue/sidebar/watch_notification.tmpl new file mode 100644 index 00000000000..aafee87ba34 --- /dev/null +++ b/templates/repo/issue/sidebar/watch_notification.tmpl @@ -0,0 +1,9 @@ +{{if and $.IssueWatch (not .Repository.IsArchived)}} +
+
+ {{ctx.Locale.Tr "notification.notifications"}} +
+ {{template "repo/issue/view_content/watching" .}} +
+
+{{end}} diff --git a/templates/repo/issue/sidebar/wip_switch.tmpl b/templates/repo/issue/sidebar/wip_switch.tmpl new file mode 100644 index 00000000000..2f8994673e9 --- /dev/null +++ b/templates/repo/issue/sidebar/wip_switch.tmpl @@ -0,0 +1,7 @@ +{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}} +
+ + {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} + +
+{{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 9c1acae0cfb..7afb76968a2 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -1,682 +1,24 @@
- {{template "repo/issue/branch_selector_field" .}} - {{if .Issue.IsPull}} - - + {{template "repo/issue/branch_selector_field" $}} -
- {{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)))}} - {{svg (Iif .Checked "octicon-trash" "octicon-sync")}} - {{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) (not .IsPullWorkInProgress)}} -
- - {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} - -
- {{end}} + {{if .Issue.IsPull}} + {{template "repo/issue/sidebar/reviewer_list" $}} + {{template "repo/issue/sidebar/wip_switch" $}}
{{end}} - {{template "repo/issue/labels/labels_selector_field" .}} + {{template "repo/issue/labels/labels_selector_field" $}} {{template "repo/issue/labels/labels_sidebar" dict "root" $}} -
- - -
- {{ctx.Locale.Tr "repo.issues.new.no_milestone"}} - -
- - {{if .IsProjectsEnabled}} -
- - -
- {{ctx.Locale.Tr "repo.issues.new.no_projects"}} - -
- {{end}} - -
- - - -
- {{ctx.Locale.Tr "repo.issues.new.no_assignees"}} -
- {{range .Issue.Assignees}} - - {{end}} -
-
- -
- - {{if .Participants}} - {{ctx.Locale.Tr "repo.issues.num_participants" .NumParticipants}} -
- {{range .Participants}} - - {{ctx.AvatarUtils.Avatar . 28 "tw-my-0.5 tw-mr-1"}} - - {{end}} -
- {{end}} - - {{if and $.IssueWatch (not .Repository.IsArchived)}} -
- -
- {{ctx.Locale.Tr "notification.notifications"}} -
- {{template "repo/issue/view_content/watching" .}} -
-
- {{end}} - {{if .Repository.IsTimetrackerEnabled ctx}} - {{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}} - {{end}} - -
- {{ctx.Locale.Tr "repo.issues.due_date"}} -
- {{if .Issue.DeadlineUnix}} -
-
- {{svg "octicon-calendar"}} {{DateUtils.AbsoluteLong .Issue.DeadlineUnix}} -
-
- {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} - {{svg "octicon-pencil"}} - {{svg "octicon-trash"}} - {{end}} -
-
- {{else}} - {{ctx.Locale.Tr "repo.issues.due_date_not_set"}} - {{end}} - - {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} -
- {{$.CsrfTokenHtml}} - - -
- {{end}} -
- - {{if .Repository.IsDependenciesEnabled ctx}} -
- -
- {{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 | ctx.RenderUtils.RenderEmoji}} - -
- {{.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 | ctx.RenderUtils.RenderEmoji}} - -
- {{.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 | ctx.RenderUtils.RenderEmoji}} - -
-
- {{.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}} - {{end}} - -
-
- {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} -
- {{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}} - -
-
- - {{if and .IsRepoAdmin (not .Repository.IsArchived)}} -
- - {{if or .PinEnabled .Issue.IsPinned}} -
- {{$.CsrfTokenHtml}} - -
- {{end}} - - - - - - {{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}} - {{end}} + {{template "repo/issue/sidebar/milestone_list" $}} + {{template "repo/issue/sidebar/project_list" $}} + {{template "repo/issue/sidebar/assignee_list" $}} + {{template "repo/issue/sidebar/participant_list" $}} + {{template "repo/issue/sidebar/watch_notification" $}} + {{template "repo/issue/sidebar/stopwatch_timetracker" $}} + {{template "repo/issue/sidebar/due_date" $}} + {{template "repo/issue/sidebar/issue_dependencies" $}} + {{template "repo/issue/sidebar/reference_link" $}} + {{template "repo/issue/sidebar/issue_management" $}} + {{template "repo/issue/sidebar/allow_maintainer_edit" $}}