diff options
author | Daniel Baumann <daniel@debian.org> | 2024-10-18 20:33:49 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-12-12 23:57:56 +0100 |
commit | e68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch) | |
tree | 97775d6c13b0f416af55314eb6a89ef792474615 /templates/repo/issue/view_content/sidebar | |
parent | Initial commit. (diff) | |
download | forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip |
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'templates/repo/issue/view_content/sidebar')
16 files changed, 746 insertions, 0 deletions
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 0000000..36f2182 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/actions.tmpl @@ -0,0 +1,114 @@ +{{if or .PinEnabled .Issue.IsPinned}} + <form class="tw-mt-1 form-fetch-action single-button-form" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.max_pinned"}}"{{end}}> + {{$.CsrfTokenHtml}} + <button class="fluid ui button {{if not $.NewPinAllowed}}disabled{{end}}"> + {{if not .Issue.IsPinned}} + {{svg "octicon-pin" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "pin"}} + {{else}} + {{svg "octicon-pin-slash" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "unpin"}} + {{end}} + </button> + </form> +{{end}} + +<button class="tw-mt-1 fluid ui show-modal button {{if .Issue.IsLocked}} negative {{end}}" data-modal="#lock"> + {{if .Issue.IsLocked}} + {{svg "octicon-key"}} + {{ctx.Locale.Tr "repo.issues.unlock"}} + {{else}} + {{svg "octicon-lock"}} + {{ctx.Locale.Tr "repo.issues.lock"}} + {{end}} +</button> +<div class="ui tiny modal" id="lock"> + <div class="header"> + {{if .Issue.IsLocked}} + {{ctx.Locale.Tr "repo.issues.unlock.title"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.lock.title"}} + {{end}} + </div> + <div class="content"> + <div class="ui warning message"> + {{if .Issue.IsLocked}} + {{ctx.Locale.Tr "repo.issues.unlock.notice_1"}}<br> + {{ctx.Locale.Tr "repo.issues.unlock.notice_2"}}<br> + {{else}} + {{ctx.Locale.Tr "repo.issues.lock.notice_1"}}<br> + {{ctx.Locale.Tr "repo.issues.lock.notice_2"}}<br> + {{ctx.Locale.Tr "repo.issues.lock.notice_3"}}<br> + {{end}} + </div> + + <form class="ui form form-fetch-action" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}" + method="post"> + {{.CsrfTokenHtml}} + + {{if not .Issue.IsLocked}} + <div class="field"> + <strong> {{ctx.Locale.Tr "repo.issues.lock.reason"}} </strong> + </div> + + <div class="field"> + <div class="ui fluid dropdown selection"> + + <select name="reason"> + <option value=""> </option> + {{range .LockReasons}} + <option value="{{.}}">{{.}}</option> + {{end}} + </select> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + + <div class="default text"> </div> + + <div class="menu"> + {{range .LockReasons}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + </div> + {{end}} + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button"> + {{if .Issue.IsLocked}} + {{ctx.Locale.Tr "repo.issues.unlock_confirm"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.lock_confirm"}} + {{end}} + </button> + </div> + </form> + </div> +</div> +<button class="tw-mt-1 fluid ui show-modal button" data-modal="#sidebar-delete-issue"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.issues.delete"}} +</button> +<div class="ui g-modal-confirm modal" id="sidebar-delete-issue"> + <div class="header"> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.pulls.delete.title"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.delete.title"}} + {{end}} + </div> + <div class="content"> + <p> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.pulls.delete.text"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.delete.text"}} + {{end}} + </p> + </div> + <form action="{{.Issue.Link}}/delete" method="post"> + {{.CsrfTokenHtml}} + {{template "base/modal_actions_confirm" .}} + </form> +</div> 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 0000000..7a928fa --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/assignees.tmpl @@ -0,0 +1,62 @@ +<input id="assignee_ids" name="assignee_ids" type="hidden" value="{{.assignee_ids}}"> +<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-assignees{{if .isExistingIssue}}-modify{{end}} dropdown"> + <a class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="filter menu" {{if .isExistingIssue}} data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee" {{else}} data-id="#assignee_ids" {{end}}> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}"> + </div> + <div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div> + {{range .Assignees}} + + {{$AssigneeID := .ID}} + <a class="item{{range $.Issue.Assignees}}{{if eq .ID $AssigneeID}} checked{{end}}{{end}}" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}"> + {{$checked := false}} + {{range $.Issue.Assignees}} + {{if eq .ID $AssigneeID}} + {{$checked = true}} + {{end}} + {{end}} + <span class="octicon-check {{if not $checked}}tw-invisible{{end}}">{{svg "octicon-check"}}</span> + <span class="text"> + {{ctx.AvatarUtils.Avatar . 20 "tw-mr-2"}}{{template "repo/search_name" .}} + </span> + </a> + {{end}} + </div> +</div> +<div class="ui assignees list"> + <span class="no-select item {{if .Issue.Assignees}}tw-hidden{{end}}"> + {{ctx.Locale.Tr "repo.issues.new.no_assignees"}} + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{with index .Assignees 0}} + – + <a class="select-assign-me" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}" {{if $.isExistingIssue}} data-action="update" {{end}} data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee" role="option"> + {{ctx.Locale.Tr "repo.issues.new.assign_to_me"}} + </a> + {{end}} + {{end}} + </span> + <div class="selected"> + {{if .isExistingIssue}} + {{range .Issue.Assignees}} + <div class="item"> + <a class="muted sidebar-item-link" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "tw-mr-2"}}{{.GetDisplayName}} + </a> + </div> + {{end}} + {{else}} + {{range .Assignees}} + <a class="item tw-p-1 muted tw-hidden" id="assignee_{{.ID}}" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "tw-mr-2"}}{{.GetDisplayName}} + </a> + {{end}} + {{end}} + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl b/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl new file mode 100644 index 0000000..c23e13b --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl @@ -0,0 +1,59 @@ +{{if and (not .Issue.IsPull) (not .PageIsComparePull)}} +<input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}"> +<input id="editing_mode" name="edit_mode" type="hidden" value="{{(or .IsIssueWriter .HasIssuesOrPullsWritePermission)}}"> +<form method="post" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref" id="update_issueref_form"> + {{$.CsrfTokenHtml}} +</form> +{{/* TODO: share this branch selector dropdown with the same in repo page */}} +<div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating filter select-branch dropdown tw-max-w-full" data-no-results="{{ctx.Locale.Tr "repo.pulls.no_results"}}"> + <div class="ui basic small button"> + <span class="text branch-name gt-ellipsis">{{if .Reference}}{{$.RefEndName}}{{else}}{{ctx.Locale.Tr "repo.issues.no_ref"}}{{end}}</span> + {{if .HasIssuesOrPullsWritePermission}}{{svg "octicon-triangle-down" 14 "dropdown icon"}}{{end}} + </div> + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-filter" 16}}</i> + <input name="search" placeholder="{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}..."> + </div> + <div class="header"> + <div class="ui grid"> + <div class="two column row"> + <a class="reference column muted" href="#" data-target="#branch-list"> + <span class="text black"> + {{svg "octicon-git-branch" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.branches"}} + </span> + </a> + <a class="reference column muted" href="#" data-target="#tag-list"> + <span class="text"> + {{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.tags"}} + </span> + </a> + </div> + </div> + </div> + <div class="branch-tag-divider"></div> + <div id="branch-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}}"> + {{if .Reference}} + <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{ctx.Locale.Tr "repo.clear_ref"}}</a></strong></div> + {{end}} + {{range .Branches}} + <div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector" title="{{.}}">{{.}}</div> + {{else}} + <div class="item">{{ctx.Locale.Tr "repo.pulls.no_results"}}</div> + {{end}} + </div> + <div id="tag-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}} tw-hidden"> + {{if .Reference}} + <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{ctx.Locale.Tr "repo.clear_ref"}}</a></strong></div> + {{end}} + {{range .Tags}} + <div class="item" data-id="refs/tags/{{.}}" data-name="tags/{{.}}" data-id-selector="#ref_selector">{{.}}</div> + {{else}} + <div class="item">{{ctx.Locale.Tr "repo.pulls.no_results"}}</div> + {{end}} + </div> + </div> +</div> + +<div class="divider"></div> +{{end}} 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 0000000..6a9b651 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/dependencies.tmpl @@ -0,0 +1,146 @@ +<div class="ui depending"> + {{if (and (not .BlockedByDependencies) (not .BlockedByDependenciesNotPermitted) (not .BlockingDependencies) (not .BlockingDependenciesNotPermitted))}} + <span class="text"><strong>{{ctx.Locale.Tr "repo.issues.dependency.title"}}</strong></span> + <br> + <p> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.issues.dependency.pr_no_dependencies"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.dependency.issue_no_dependencies"}} + {{end}} + </p> + {{end}} + + {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}} + <span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{ctx.Locale.Tr "repo.issues.dependency.pr_close_blocks"}}{{else}}{{ctx.Locale.Tr "repo.issues.dependency.issue_close_blocks"}}{{end}}"> + <strong>{{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}}</strong> + </span> + <div class="ui relaxed divided list"> + {{range .BlockingDependencies}} + <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> + <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> + <a class="title muted" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{RenderRefIssueTitle $.Context .Issue.Title}}}"> + #{{.Issue.Index}} {{RenderRefIssueTitle $.Context .Issue.Title}}} + </a> + <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> + {{.Repository.OwnerName}}/{{.Repository.Name}} + </div> + </div> + <div class="item-right tw-flex tw-items-center tw-m-1"> + {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + {{svg "octicon-trash" 16}} + </a> + {{end}} + </div> + </div> + {{end}} + {{if .BlockingDependenciesNotPermitted}} + <div class="item tw-flex tw-items-center tw-justify-between gt-ellipsis"> + <span>{{ctx.Locale.TrN (len .BlockingDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockingDependenciesNotPermitted)}}</span> + </div> + {{end}} + </div> + {{end}} + + {{if or .BlockedByDependencies .BlockedByDependenciesNotPermitted}} + <span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{ctx.Locale.Tr "repo.issues.dependency.pr_closing_blockedby"}}{{else}}{{ctx.Locale.Tr "repo.issues.dependency.issue_closing_blockedby"}}{{end}}"> + <strong>{{ctx.Locale.Tr "repo.issues.dependency.blocked_by_short"}}</strong> + </span> + <div class="ui relaxed divided list"> + {{range .BlockedByDependencies}} + <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> + <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> + {{$title := RenderRefIssueTitle $.Context .Issue.Title}} + <a class="title muted" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{RenderRefIssueTitle $.Context .Issue.Title}}"> + #{{.Issue.Index}} {{RenderRefIssueTitle $.Context .Issue.Title}} + </a> + <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> + {{.Repository.OwnerName}}/{{.Repository.Name}} + </div> + </div> + <div class="item-right tw-flex tw-items-center tw-m-1"> + {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blockedBy" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + {{svg "octicon-trash" 16}} + </a> + {{end}} + </div> + </div> + {{end}} + {{if $.CanCreateIssueDependencies}} + {{range .BlockedByDependenciesNotPermitted}} + <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> + <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> + <div class="gt-ellipsis"> + <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.no_permission.can_remove"}}">{{svg "octicon-lock" 16}}</span> + <span class="title" data-tooltip-content="#{{.Issue.Index}} {{RenderRefIssueTitle $.Context .DependentIssue.Title}}"> + #{{.Issue.Index}} {{RenderRefIssueTitle $.Context .DependentIssue.Title}} + </span> + </div> + <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> + {{.Repository.OwnerName}}/{{.Repository.Name}} + </div> + </div> + <div class="item-right tw-flex tw-items-center tw-m-1"> + {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + {{svg "octicon-trash" 16}} + </a> + {{end}} + </div> + </div> + {{end}} + {{else if .BlockedByDependenciesNotPermitted}} + <div class="item tw-flex tw-items-center tw-justify-between gt-ellipsis"> + <span>{{ctx.Locale.TrN (len .BlockedByDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockedByDependenciesNotPermitted)}}</span> + </div> + {{end}} + </div> + {{end}} + + {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} + <div> + <form method="post" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm"> + {{$.CsrfTokenHtml}} + <div class="ui fluid action input"> + <div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}"> + <input name="newDependency" type="hidden"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <input type="text" class="search"> + <div class="default text">{{ctx.Locale.Tr "repo.issues.dependency.add"}}</div> + </div> + <button class="ui icon button"> + {{svg "octicon-plus"}} + </button> + </div> + </form> + </div> + {{end}} +</div> + +{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} + <input type="hidden" id="crossRepoSearch" value="{{.AllowCrossRepositoryDependencies}}"> + + <div class="ui g-modal-confirm modal remove-dependency"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.issues.dependency.remove_header"}} + </div> + <div class="content"> + <form method="post" action="{{.Issue.Link}}/dependency/delete" id="removeDependencyForm"> + {{$.CsrfTokenHtml}} + <input type="hidden" value="" name="removeDependencyID" id="removeDependencyID"> + <input type="hidden" value="" name="dependencyType" id="dependencyType"> + </form> + <p>{{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.issues.dependency.pr_remove_text"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.dependency.issue_remove_text"}} + {{end}}</p> + </div> + {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}} + {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}} + {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}} + </div> +{{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 0000000..2de836b --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/due_deadline.tmpl @@ -0,0 +1,41 @@ +<span class="text"><strong>{{ctx.Locale.Tr "repo.issues.due_date"}}</strong></span> +<div class="ui form" id="deadline-loader"> + <div class="ui negative message tw-hidden" id="deadline-err-invalid-date"> + {{svg "octicon-x" 16 "close icon"}} + {{ctx.Locale.Tr "repo.issues.due_date_invalid"}} + </div> + {{if ne .Issue.DeadlineUnix 0}} + <p> + <div class="tw-flex tw-justify-between tw-items-center"> + <div class="due-date {{if .Issue.IsOverdue}}text red{{end}}" {{if .Issue.IsOverdue}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date_overdue"}}"{{end}}> + {{svg "octicon-calendar" 16 "tw-mr-2"}} + {{DateTime "long" .Issue.DeadlineUnix.FormatDate}} + </div> + <div> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + <a class="issue-due-edit muted" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date_form_edit"}}">{{svg "octicon-pencil" 16 "tw-mr-1"}}</a> + <a class="issue-due-remove muted" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date_form_remove"}}">{{svg "octicon-trash"}}</a> + {{end}} + </div> + </div> + </p> + {{else}} + <p>{{ctx.Locale.Tr "repo.issues.due_date_not_set"}}</p> + {{end}} + + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + <div {{if ne .Issue.DeadlineUnix 0}} class="tw-hidden"{{end}} id="deadlineForm"> + <form class="ui fluid action input issue-due-form" action="{{AppSubUrl}}/{{PathEscape .Repository.Owner.Name}}/{{PathEscape .Repository.Name}}/issues/{{.Issue.Index}}/deadline" method="post" id="update-issue-deadline-form"> + {{$.CsrfTokenHtml}} + <input required placeholder="{{ctx.Locale.Tr "repo.issues.due_date_form"}}" {{if gt .Issue.DeadlineUnix 0}}value="{{.Issue.DeadlineUnix.FormatDate}}"{{end}} type="date" name="deadlineDate" id="deadlineDate"> + <button class="ui icon button"> + {{if ne .Issue.DeadlineUnix 0}} + {{svg "octicon-pencil"}} + {{else}} + {{svg "octicon-plus"}} + {{end}} + </button> + </form> + </div> + {{end}} +</div> 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 0000000..44d9419 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/milestones.tmpl @@ -0,0 +1,24 @@ +<div id="milestone-section" hx-swap="morph" hx-target="this" hx-indicator="this"> + <div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-milestone dropdown"> + <a class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.milestone"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="menu"> + {{template "repo/issue/milestone/select_menu" .}} + </div> + </div> + <div class="ui select-milestone list"> + <span class="no-select item {{if .Issue.Milestone}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_milestone"}}</span> + <div class="selected"> + {{if .Issue.Milestone}} + <a class="item muted sidebar-item-link" href="{{.RepoLink}}/milestone/{{.Issue.Milestone.ID}}"> + {{svg "octicon-milestone" 18 "tw-mr-2"}} + {{.Issue.Milestone.Name}} + </a> + {{end}} + </div> + </div> +</div> 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 0000000..93e2579 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/participants.tmpl @@ -0,0 +1,8 @@ +<span class="text"><strong>{{ctx.Locale.TrN .NumParticipants "repo.issues.num_participants_one" "repo.issues.num_participants_few" .NumParticipants}}</strong></span> +<div class="ui list tw-flex tw-flex-wrap"> + {{range .Participants}} + <a {{if gt .ID 0}}href="{{.HomeLink}}"{{end}} data-tooltip-content="{{.GetDisplayName}}"> + {{ctx.AvatarUtils.Avatar . 28 "tw-my-0.5 tw-mr-1"}} + </a> + {{end}} +</div> 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 0000000..91d75f3 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/projects.tmpl @@ -0,0 +1,54 @@ +<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-project dropdown"> + <a class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.projects"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/projects"> + {{if or .OpenProjects .ClosedProjects}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_projects"}}"> + </div> + {{end}} + <div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}</div> + {{if and (not .OpenProjects) (not .ClosedProjects)}} + <div class="disabled item"> + {{ctx.Locale.Tr "repo.issues.new.no_items"}} + </div> + {{end}} + {{if .OpenProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.open_projects"}} + </div> + {{range .OpenProjects}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link ctx}}"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </a> + {{end}} + {{end}} + {{if .ClosedProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.closed_projects"}} + </div> + {{range .ClosedProjects}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link ctx}}"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </a> + {{end}} + {{end}} + </div> +</div> +<div class="ui select-project list"> + <span class="no-select item {{if .Issue.Project}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_projects"}}</span> + <div class="selected"> + {{if .Issue.Project}} + <a class="item muted sidebar-item-link" href="{{.Issue.Project.Link ctx}}"> + {{svg .Issue.Project.IconName 18 "tw-mr-2"}}{{.Issue.Project.Title}} + </a> + {{end}} + </div> +</div> 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 0000000..6ec5c05 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl @@ -0,0 +1,10 @@ +<div class="inline field"> + <div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers" + data-url="{{.Issue.Link}}" + data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}" + data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}" + > + <label><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label> + <input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}}> + </div> +</div> 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 0000000..930c2a6 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_review.tmpl @@ -0,0 +1,45 @@ +<input id="reviewer_id" name="reviewer_id" type="hidden" value="{{.reviewer_id}}"> +<div class="ui {{if or (and (not .Reviewers) (not .TeamReviewers)) (not .CanChooseReviewer) .Repository.IsArchived}}disabled{{end}} floating jump select-reviewers-modify dropdown"> + <a class="text tw-flex tw-items-center muted"> + <strong>{{ctx.Locale.Tr "repo.issues.review.reviewers"}}</strong> + {{if and .CanChooseReviewer (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="filter menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/request_review"> + {{if .Reviewers}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_reviewers"}}"> + </div> + {{end}} + {{if .Reviewers}} + {{range .Reviewers}} + {{if .User}} + <a class="{{if not .CanChange}}ui{{end}} item {{if .Checked}}checked{{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-tooltip-content="{{ctx.Locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}> + <span class="octicon-check {{if not .Checked}}tw-invisible{{end}}">{{svg "octicon-check"}}</span> + <span class="text"> + {{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}{{template "repo/search_name" .User}} + </span> + </a> + {{end}} + {{end}} + {{end}} + {{if .TeamReviewers}} + {{if .Reviewers}} + <div class="divider"></div> + {{end}} + {{range .TeamReviewers}} + {{if .Team}} + <a class="{{if not .CanChange}}ui{{end}} item {{if .Checked}}checked{{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_team_{{.Team.ID}}" {{if not .CanChange}} data-tooltip-content="{{ctx.Locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}> + <span class="octicon-check {{if not .Checked}}tw-invisible{{end}}">{{svg "octicon-check" 16}}</span> + <span class="text"> + {{svg "octicon-people" 16 "tw-ml-4 tw-mr-1"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}} + </span> + </a> + {{end}} + {{end}} + {{end}} + </div> +</div> +{{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 0000000..102508f --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl @@ -0,0 +1,67 @@ +<div class="ui assignees list"> + <span class="no-select item {{if or .OriginalReviews .PullReviewers}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_reviewers"}}</span> + <div class="selected"> + {{range .PullReviewers}} + <div class="item tw-flex tw-items-center tw-py-2"> + <div class="tw-flex tw-items-center tw-flex-1"> + {{if .User}} + <a class="muted sidebar-item-link" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20 "tw-mr-2"}}{{.User.GetDisplayName}}</a> + {{else if .Team}} + <span class="text">{{svg "octicon-people" 20 "tw-mr-2"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}</span> + {{end}} + </div> + <div class="tw-flex tw-items-center tw-gap-2"> + {{if (and $.Permission.IsAdmin (or (eq .Review.Type 1) (eq .Review.Type 3)) (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged))}} + <a href="#" class="ui muted icon tw-flex tw-items-center show-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dismiss_review"}}" data-modal="#dismiss-review-modal-{{.Review.ID}}"> + {{svg "octicon-x" 20}} + </a> + <div class="ui small modal" id="dismiss-review-modal-{{.Review.ID}}"> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.dismiss_review"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.issues.dismiss_review_warning"}} + </div> + <form class="ui form dismiss-review-form" id="dismiss-review-{{.Review.ID}}" action="{{$.RepoLink}}/issues/dismiss_review" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="review_id" value="{{.Review.ID}}"> + <div class="field"> + <label for="message">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</label> + <input id="message" name="message"> + </div> + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button" type="submit">{{ctx.Locale.Tr "ok"}}</button> + </div> + </form> + </div> + </div> + {{end}} + {{if .Review.Stale}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.is_stale"}}"> + {{svg "octicon-hourglass" 16}} + </span> + {{end}} + {{if and .CanChange (or .Checked (and (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged)))}} + <a href="#" class="ui muted icon re-request-review{{if .Checked}} checked{{end}}" data-tooltip-content="{{if .Checked}}{{ctx.Locale.Tr "repo.issues.remove_request_review"}}{{else}}{{ctx.Locale.Tr "repo.issues.re_request_review"}}{{end}}" data-issue-id="{{$.Issue.ID}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review">{{if .Checked}}{{svg "octicon-trash"}}{{else}}{{svg "octicon-sync"}}{{end}}</a> + {{end}} + {{svg (printf "octicon-%s" .Review.Type.Icon) 16 (printf "text %s" (.Review.HTMLTypeColorName))}} + </div> + </div> + {{end}} + {{range .OriginalReviews}} + <div class="item tw-flex tw-items-center tw-py-2"> + <div class="tw-flex tw-items-center tw-flex-1"> + <a class="muted" href="{{$.Repository.OriginalURL}}" data-tooltip-content="{{ctx.Locale.Tr "repo.migrated_from_fake" $.Repository.GetOriginalURLHostname}}"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname) 20 "tw-mr-2"}} + {{.OriginalAuthor}} + </a> + </div> + <div class="tw-flex tw-items-center tw-gap-2"> + {{svg (printf "octicon-%s" .Type.Icon) 16 (printf "text %s" (.HTMLTypeColorName))}} + </div> + </div> + {{end}} + </div> + </div> 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 0000000..f1588b3 --- /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)}} + <div class="toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}" data-update-url="{{.Issue.Link}}/title"> + <a class="muted"> + {{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}} + </a> + </div> +{{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 0000000..bbbc099 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/reference.tmpl @@ -0,0 +1,7 @@ +<div class="ui equal width compact grid"> + {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} + <div class="row tw-items-center" data-tooltip-content="{{$issueReferenceLink}}"> + <span class="text column truncate">{{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}</span> + <button class="ui two wide button column tw-p-2" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button> + </div> +</div> 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 0000000..610600b --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/timetracking.tmpl @@ -0,0 +1,73 @@ +{{if and .CanUseTimetracker (not .Repository.IsArchived)}} + <div class="divider"></div> + <div class="ui timetrack"> + <span class="text"><strong>{{ctx.Locale.Tr "repo.issues.tracker"}}</strong></span> + <div class="tw-mt-2"> + <form method="post" action="{{.Issue.Link}}/times/stopwatch/toggle" id="toggle_stopwatch_form"> + {{$.CsrfTokenHtml}} + </form> + <form method="post" action="{{.Issue.Link}}/times/stopwatch/cancel" id="cancel_stopwatch_form"> + {{$.CsrfTokenHtml}} + </form> + {{if $.IsStopwatchRunning}} + <button class="ui fluid button issue-stop-time"> + {{svg "octicon-stopwatch" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.stop_tracking"}} + </button> + <button class="ui fluid button issue-cancel-time tw-mt-2"> + {{svg "octicon-trash" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.cancel_tracking"}} + </button> + {{else}} + {{if .HasUserStopwatch}} + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.issues.tracking_already_started" .OtherStopwatchURL}} + </div> + {{end}} + <button class="ui fluid button issue-start-time" data-tooltip-content='{{ctx.Locale.Tr "repo.issues.start_tracking"}}'> + {{svg "octicon-stopwatch" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.start_tracking_short"}} + </button> + <div class="ui mini modal issue-start-time-modal"> + <div class="header">{{ctx.Locale.Tr "repo.issues.add_time"}}</div> + <div class="content"> + <form method="post" id="add_time_manual_form" action="{{.Issue.Link}}/times/add" class="ui input fluid tw-gap-2"> + {{$.CsrfTokenHtml}} + <input placeholder='{{ctx.Locale.Tr "repo.issues.add_time_hours"}}' type="number" name="hours"> + <input placeholder='{{ctx.Locale.Tr "repo.issues.add_time_minutes"}}' type="number" name="minutes" class="ui compact"> + </form> + </div> + <div class="actions"> + <button class="ui primary approve button">{{ctx.Locale.Tr "repo.issues.add_time_short"}}</button> + <button class="ui cancel button">{{ctx.Locale.Tr "repo.issues.add_time_cancel"}}</button> + </div> + </div> + <button class="ui fluid button issue-add-time tw-mt-2" data-tooltip-content='{{ctx.Locale.Tr "repo.issues.add_time"}}'> + {{svg "octicon-plus" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.add_time_short"}} + </button> + {{end}} + </div> + </div> +{{end}} +{{if .WorkingUsers}} + <div class="divider"></div> + <div class="ui comments"> + <span class="text"><strong>{{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time)}}</strong></span> + <div> + {{range $user, $trackedtime := .WorkingUsers}} + <div class="comment tw-mt-2"> + <a class="avatar"> + {{ctx.AvatarUtils.Avatar $user}} + </a> + <div class="content"> + {{template "shared/user/authorlink" $user}} + <div class="text"> + {{$trackedtime|Sec2Time}} + </div> + </div> + </div> + {{end}} + </div> + </div> +{{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 0000000..ee14168 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/watch.tmpl @@ -0,0 +1,6 @@ +<div class="ui watching"> + <span class="text"><strong>{{ctx.Locale.Tr "notification.notifications"}}</strong></span> + <div class="tw-mt-2"> + {{template "repo/issue/view_content/sidebar/watching" .}} + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/watching.tmpl b/templates/repo/issue/view_content/sidebar/watching.tmpl new file mode 100644 index 0000000..d3d7594 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/watching.tmpl @@ -0,0 +1,19 @@ +<form hx-boost="true" hx-sync="this:replace" hx-target="this" method="post" action="{{.Issue.Link}}/watch" + {{if not $.IsSigned}} + {{if $.Issue.IsPull}} + data-tooltip-content="{{ctx.Locale.Tr "repo.subscribe.pull.guest.tooltip"}}" + {{else}} + data-tooltip-content="{{ctx.Locale.Tr "repo.subscribe.issue.guest.tooltip"}}" + {{end}} + {{end}}> + <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}"> + <button class="fluid ui button {{if not $.IsSigned}}disabled{{end}}"> + {{if $.IssueWatch.IsWatching}} + {{svg "octicon-mute" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.unsubscribe"}} + {{else}} + {{svg "octicon-unmute" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.subscribe"}} + {{end}} + </button> +</form> |