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/shared | |
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 '')
27 files changed, 1186 insertions, 0 deletions
diff --git a/templates/shared/actions/runner_edit.tmpl b/templates/shared/actions/runner_edit.tmpl new file mode 100644 index 0000000..d60f10b --- /dev/null +++ b/templates/shared/actions/runner_edit.tmpl @@ -0,0 +1,96 @@ +<div class="runner-container"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.runners.runner_title"}} {{.Runner.ID}} {{.Runner.Name}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <div class="runner-basic-info"> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.status"}}</label> + <span class="ui {{if .Runner.IsOnline}}green{{else}}basic{{end}} label">{{.Runner.StatusLocaleName ctx.Locale}}</span> + </div> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.last_online"}}</label> + <span>{{if .Runner.LastOnline}}{{TimeSinceUnix .Runner.LastOnline ctx.Locale}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</span> + </div> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.labels"}}</label> + <span> + {{range .Runner.AgentLabels}} + <span class="ui label">{{.}}</span> + {{end}} + </span> + </div> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.owner_type"}}</label> + <span data-tooltip-content="{{.Runner.BelongsToOwnerName}}">{{.Runner.BelongsToOwnerType.LocaleString ctx.Locale}}</span> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <label for="description">{{ctx.Locale.Tr "actions.runners.description"}}</label> + <input id="description" name="description" value="{{.Runner.Description}}"> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button" data-url="{{.Link}}">{{ctx.Locale.Tr "actions.runners.update_runner"}}</button> + <button class="ui red button delete-button show-modal" data-url="{{.Link}}/delete" data-modal="#runner-delete-modal"> + {{ctx.Locale.Tr "actions.runners.delete_runner"}}</button> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.runners.task_list"}} + </h4> + <div class="ui attached segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "actions.runners.task_list.run"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.status"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.repository"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.commit"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.done_at"}}</th> + </tr> + </thead> + <tbody> + {{range .Tasks}} + <tr> + <td><a href="{{.GetRunLink}}" target="_blank">{{.ID}}</a></td> + <td><span class="ui label task-status-{{.Status.String}}">{{.Status.LocaleString ctx.Locale}}</span></td> + <td><a href="{{.GetRepoLink}}" target="_blank">{{.GetRepoName}}</a></td> + <td> + <strong><a href="{{.GetCommitLink}}" target="_blank">{{ShortSha .CommitSHA}}</a></strong> + </td> + <td>{{if .IsStopped}} + <span>{{TimeSinceUnix .Stopped ctx.Locale}}</span> + {{else}}-{{end}}</td> + </tr> + {{end}} + {{if not .Tasks}} + <tr> + <td colspan="5">{{ctx.Locale.Tr "actions.runners.task_list.no_tasks"}}</td> + </tr> + {{end}} + </tbody> + </table> + {{template "base/paginate" .}} + </div> + <div class="ui g-modal-confirm delete modal" id="runner-delete-modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "actions.runners.delete_runner_header"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "actions.runners.delete_runner_notice"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl new file mode 100644 index 0000000..abbf220 --- /dev/null +++ b/templates/shared/actions/runner_list.tmpl @@ -0,0 +1,95 @@ +<div class="runner-container"> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.runners.runner_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <div class="ui top right pointing dropdown"> + <button class="ui primary tiny button"> + {{ctx.Locale.Tr "actions.runners.new"}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </button> + <div class="menu"> + <div class="item"> + <a href="https://forgejo.org/docs/next/admin/actions/#forgejo-runner">{{ctx.Locale.Tr "actions.runners.new_notice"}}</a> + </div> + <div class="divider"></div> + <div class="header"> + Registration Token + </div> + <div class="ui input"> + <input type="text" value="{{.RegistrationToken}}"> + <button class="ui basic label button" aria-label="{{ctx.Locale.Tr "copy"}}" data-clipboard-text="{{.RegistrationToken}}"> + {{svg "octicon-copy" 14}} + </button> + </div> + <div class="divider"></div> + <div class="item"> + <a href="{{$.Link}}/reset_registration_token">{{ctx.Locale.Tr "actions.runners.reset_registration_token"}}</a> + </div> + </div> + </div> + + </div> + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty" id="user-list-search-form" action="{{$.Link}}"> + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.runner_kind")}} + </form> + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th data-sortt-asc="online" data-sortt-desc="offline"> + {{ctx.Locale.Tr "actions.runners.status"}} + {{SortArrow "online" "offline" .SortType false}} + </th> + <th data-sortt-asc="newest" data-sortt-desc="oldest"> + {{ctx.Locale.Tr "actions.runners.id"}} + {{SortArrow "oldest" "newest" .SortType false}} + </th> + <th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically"> + {{ctx.Locale.Tr "actions.runners.name"}} + {{SortArrow "alphabetically" "reversealphabetically" .SortType false}} + </th> + <th>{{ctx.Locale.Tr "actions.runners.version"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.owner_type"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.labels"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.last_online"}}</th> + <th>{{ctx.Locale.Tr "edit"}}</th> + </tr> + </thead> + <tbody> + {{if .Runners}} + {{range .Runners}} + <tr> + <td> + <span class="ui {{if .IsOnline}}green{{end}} label">{{.StatusLocaleName ctx.Locale}}</span> + </td> + <td>{{.ID}}</td> + <td><p data-tooltip-content="{{.Description}}">{{.Name}}</p></td> + <td>{{if .Version}}{{.Version}}{{else}}{{ctx.Locale.Tr "unknown"}}{{end}}</td> + <td><span data-tooltip-content="{{.BelongsToOwnerName}}">{{.BelongsToOwnerType.LocaleString ctx.Locale}}</span></td> + <td class="tw-flex tw-flex-wrap tw-gap-2 runner-tags"> + {{range .AgentLabels}}<span class="ui label">{{.}}</span>{{end}} + </td> + <td>{{if .LastOnline}}{{TimeSinceUnix .LastOnline ctx.Locale}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</td> + <td class="runner-ops"> + {{if .Editable $.RunnerOwnerID $.RunnerRepoID}} + <a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a> + {{end}} + </td> + </tr> + {{end}} + {{else}} + <tr> + <td class="center aligned" colspan="8">{{ctx.Locale.Tr "actions.runners.none"}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{template "base/paginate" .}} + +</div> diff --git a/templates/shared/blocked_users_list.tmpl b/templates/shared/blocked_users_list.tmpl new file mode 100644 index 0000000..409b7f4 --- /dev/null +++ b/templates/shared/blocked_users_list.tmpl @@ -0,0 +1,28 @@ +<div class="flex-list"> + {{range .BlockedUsers}} + <div class="flex-item flex-item-center"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar . 48}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .}} + </div> + <div class="flex-item-body"> + <span>{{ctx.Locale.Tr "settings.blocked_since" (DateTime "short" .CreatedUnix)}}</span> + </div> + </div> + <div class="flex-item-trailing"> + <form action="{{$.Link}}/unblock" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="user_id" value="{{.ID}}"> + <button class="ui red button">{{ctx.Locale.Tr "user.unblock"}}</button> + </form> + </div> + </div> + {{else}} + <div class="flex-item"> + <span class="text grey italic">{{ctx.Locale.Tr "settings.blocked_users_none"}}</span> + </div> + {{end}} +</div> diff --git a/templates/shared/combomarkdowneditor.tmpl b/templates/shared/combomarkdowneditor.tmpl new file mode 100644 index 0000000..48f72b6 --- /dev/null +++ b/templates/shared/combomarkdowneditor.tmpl @@ -0,0 +1,64 @@ +{{/* +Template Attributes: +* ContainerId: id attribute for the container element +* ContainerClasses: additional classes for the container element +* MarkdownPreviewUrl: preview url for the preview tab +* MarkdownPreviewContext: preview context for the preview tab +* TextareaName: name attribute for the textarea +* TextareaContent: content for the textarea +* TextareaPlaceholder: placeholder attribute for the textarea +* TextareaAriaLabel: aria-label attribute for the textarea +* DropzoneParentContainer: container for file upload (leave it empty if no upload) +* DisableAutosize: whether to disable automatic height resizing +* EasyMDE: whether to display button for switching to legacy editor +*/}} +<div {{if .ContainerId}}id="{{.ContainerId}}"{{end}} class="combo-markdown-editor {{.ContainerClasses}}" data-dropzone-parent-container="{{.DropzoneParentContainer}}"> + {{if .MarkdownPreviewUrl}} + <div class="ui top tabular menu"> + <a href="#" class="active item" data-tab-for="markdown-writer">{{ctx.Locale.Tr "write"}}</a> + <a href="#" class="item" data-tab-for="markdown-previewer" data-preview-url="{{.MarkdownPreviewUrl}}" data-preview-context="{{.MarkdownPreviewContext}}">{{ctx.Locale.Tr "preview"}}</a> + </div> + {{end}} + <div class="ui tab active" data-tab-panel="markdown-writer"> + <markdown-toolbar> + <div class="markdown-toolbar-group"> + <md-header class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.heading.tooltip"}}">{{svg "octicon-heading"}}</md-header> + <md-bold class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.bold.tooltip"}}">{{svg "octicon-bold"}}</md-bold> + <md-italic class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.italic.tooltip"}}">{{svg "octicon-italic"}}</md-italic> + </div> + <div class="markdown-toolbar-group"> + <md-quote class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.quote.tooltip"}}">{{svg "octicon-quote"}}</md-quote> + <md-code class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.code.tooltip"}}">{{svg "octicon-code"}}</md-code> + <md-link class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.link.tooltip"}}">{{svg "octicon-link"}}</md-link> + </div> + <div class="markdown-toolbar-group"> + <md-unordered-list class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.list.unordered.tooltip"}}">{{svg "octicon-list-unordered"}}</md-unordered-list> + <md-ordered-list class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.list.ordered.tooltip"}}">{{svg "octicon-list-ordered"}}</md-ordered-list> + <md-task-list class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.list.task.tooltip"}}">{{svg "octicon-tasklist"}}</md-task-list> + <button type="button" class="markdown-toolbar-button" data-md-button data-md-action="unindent" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.unindent.tooltip"}}">{{svg "octicon-arrow-left"}}</button> + <button type="button" class="markdown-toolbar-button" data-md-button data-md-action="indent" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.indent.tooltip"}}">{{svg "octicon-arrow-right"}}</button> + </div> + <div class="markdown-toolbar-group"> + <md-mention class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.mention.tooltip"}}">{{svg "octicon-mention"}}</md-mention> + <md-ref class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.ref.tooltip"}}">{{svg "octicon-cross-reference"}}</md-ref> + </div> + <div class="markdown-toolbar-group"> + <button class="markdown-toolbar-button markdown-switch-monospace" role="switch" data-enable-text="{{ctx.Locale.Tr "editor.buttons.enable_monospace_font"}}" data-disable-text="{{ctx.Locale.Tr "editor.buttons.disable_monospace_font"}}">{{svg "octicon-typography"}}</button> + {{if .EasyMDE}} + <button class="markdown-toolbar-button markdown-switch-easymde" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.switch_to_legacy.tooltip"}}">{{svg "octicon-arrow-switch"}}</button> + {{end}} + </div> + </markdown-toolbar> + <text-expander keys=": @" suffix=""> + <textarea class="markdown-text-editor js-quick-submit"{{if .TextareaName}} name="{{.TextareaName}}"{{end}}{{if .TextareaPlaceholder}} placeholder="{{.TextareaPlaceholder}}"{{end}}{{if .TextareaAriaLabel}} aria-label="{{.TextareaAriaLabel}}"{{end}}{{if .DisableAutosize}} data-disable-autosize="{{.DisableAutosize}}"{{end}}>{{.TextareaContent}}</textarea> + </text-expander> + <script> + if (localStorage?.getItem('markdown-editor-monospace') === 'true') { + document.querySelector('.markdown-text-editor').classList.add('tw-font-mono'); + } + </script> + </div> + <div class="ui tab markup" data-tab-panel="markdown-previewer"> + {{ctx.Locale.Tr "loading"}} + </div> +</div> diff --git a/templates/shared/issueicon.tmpl b/templates/shared/issueicon.tmpl new file mode 100644 index 0000000..d7c4414 --- /dev/null +++ b/templates/shared/issueicon.tmpl @@ -0,0 +1,25 @@ +{{if .IsPull}} + {{if not .PullRequest}} + No PullRequest + {{else}} + {{if .IsClosed}} + {{if .PullRequest.HasMerged}} + {{svg "octicon-git-merge" 16 "text purple"}} + {{else}} + {{svg "octicon-git-pull-request-closed" 16 "text red"}} + {{end}} + {{else}} + {{if .PullRequest.IsWorkInProgress ctx}} + {{svg "octicon-git-pull-request-draft" 16 "text grey"}} + {{else}} + {{svg "octicon-git-pull-request" 16 "text green"}} + {{end}} + {{end}} + {{end}} +{{else}} + {{if .IsClosed}} + {{svg "octicon-issue-closed" 16 "text red"}} + {{else}} + {{svg "octicon-issue-opened" 16 "text green"}} + {{end}} +{{end}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl new file mode 100644 index 0000000..f96c182 --- /dev/null +++ b/templates/shared/issuelist.tmpl @@ -0,0 +1,163 @@ +<div id="issue-list" class="flex-list"> + {{$approvalCounts := .ApprovalCounts}} + {{range .Issues}} + <div class="flex-item"> + + <div class="flex-item-icon"> + {{if $.CanWriteIssuesOrPulls}} + <input type="checkbox" autocomplete="off" class="issue-checkbox tw-mr-4" data-issue-id={{.ID}} aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}} "{{.Title}}""> + {{end}} + {{template "shared/issueicon" .}} + </div> + + <div class="flex-item-main"> + <div class="flex-item-header"> + <div class="flex-item-title"> + <a class="tw-no-underline issue-title" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{RenderEmoji $.Context .Title | RenderCodeBlock}}</a> + {{if .IsPull}} + {{if (index $.CommitStatuses .PullRequest.ID)}} + {{template "repo/commit_statuses" dict "Status" (index $.CommitLastStatus .PullRequest.ID) "Statuses" (index $.CommitStatuses .PullRequest.ID)}} + {{end}} + {{end}} + <span class="labels-list tw-ml-1"> + {{range .Labels}} + <a href="?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}" rel="nofollow">{{RenderLabel $.Context ctx.Locale .}}</a> + {{end}} + </span> + </div> + {{if or .TotalTrackedTime .Assignees .NumComments}} + <div class="flex-item-trailing"> + {{if .TotalTrackedTime}} + <div class="text grey flex-text-block"> + {{svg "octicon-clock" 16}} + {{.TotalTrackedTime | Sec2Time}} + </div> + {{end}} + {{if .Assignees}} + <div class="text grey"> + {{range .Assignees}} + <a class="ui assignee tw-no-underline" href="{{.HomeLink}}" data-tooltip-content="{{.GetDisplayName}}"> + {{ctx.AvatarUtils.Avatar . 20}} + </a> + {{end}} + </div> + {{end}} + {{if .NumComments}} + <div class="text grey"> + <a class="tw-no-underline muted flex-text-block" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> + {{svg "octicon-comment" 16}}{{.NumComments}} + </a> + </div> + {{end}} + </div> + {{end}} + </div> + <div class="flex-item-body"> + <a class="index" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> + {{if eq $.listType "dashboard"}} + {{.Repo.FullName}}#{{.Index}} + {{else}} + #{{.Index}} + {{end}} + </a> + {{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}} + {{if .OriginalAuthor}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}} + {{else if gt .Poster.ID 0}} + {{ctx.Locale.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.GetDisplayName}} + {{else}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .Poster.GetDisplayName}} + {{end}} + {{if .IsPull}} + <div class="branches flex-text-inline"> + <div class="branch"> + <a href="{{.PullRequest.BaseRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.BaseBranch}}"> + {{/* inline to remove the spaces between spans */}} + {{if ne .RepoID .PullRequest.BaseRepoID}}<span class="truncated-name">{{.PullRequest.BaseRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.BaseBranch}}</span> + </a> + </div> + {{svg "gitea-double-chevron-left" 12}} + {{if .PullRequest.HeadRepo}} + <div class="branch"> + <a href="{{.PullRequest.HeadRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.HeadBranch}}"> + {{/* inline to remove the spaces between spans */}} + {{if ne .RepoID .PullRequest.HeadRepoID}}<span class="truncated-name">{{.PullRequest.HeadRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.HeadBranch}}</span> + </a> + </div> + {{end}} + </div> + {{end}} + {{if and .Milestone (ne $.listType "milestone")}} + <a class="milestone flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}"{{else}}href="{{.Repo.Link}}/milestone/{{.Milestone.ID}}"{{end}}> + {{svg "octicon-milestone" 14}} + <span class="gt-ellipsis">{{.Milestone.Name}}</span> + </a> + {{end}} + {{if .Project}} + <a class="project flex-text-inline tw-max-w-[300px]" href="{{.Project.Link ctx}}"> + {{svg .Project.IconName 14}} + <span class="gt-ellipsis">{{.Project.Title}}</span> + </a> + {{end}} + {{if .Ref}} + <a class="ref flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{.Repo.Link}}{{index $.IssueRefURLs .ID}}"{{end}}> + {{svg "octicon-git-branch" 14}} + <span class="gt-ellipsis">{{index $.IssueRefEndNames .ID}}</span> + </a> + {{end}} + {{$tasks := .GetTasks}} + {{if gt $tasks 0}} + {{$tasksDone := .GetTasksDone}} + <span class="checklist flex-text-inline"> + {{svg "octicon-checklist" 14}}{{$tasksDone}} / {{$tasks}} + <progress value="{{$tasksDone}}" max="{{$tasks}}"></progress> + </span> + {{end}} + {{if ne .DeadlineUnix 0}} + <span class="due-date flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date"}}"> + <span{{if .IsOverdue}} class="text red"{{end}}> + {{svg "octicon-calendar" 14}} + {{DateTime "short" (.DeadlineUnix.FormatDate)}} + </span> + </span> + {{end}} + {{if .IsPull}} + {{$approveOfficial := call $approvalCounts .ID "approve"}} + {{$rejectOfficial := call $approvalCounts .ID "reject"}} + {{$waitingOfficial := call $approvalCounts .ID "waiting"}} + {{if gt $approveOfficial 0}} + <span class="approvals green flex-text-inline"> + {{svg "octicon-check" 14}} + {{ctx.Locale.TrN $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n" $approveOfficial}} + </span> + {{end}} + {{if gt $rejectOfficial 0}} + <span class="rejects red flex-text-inline"> + {{svg "octicon-diff" 14}} + {{ctx.Locale.TrN $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n" $rejectOfficial}} + </span> + {{end}} + {{if gt $waitingOfficial 0}} + <span class="waiting flex-text-inline"> + {{svg "octicon-eye" 14}} + {{ctx.Locale.TrN $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n" $waitingOfficial}} + </span> + {{end}} + {{if and (not .PullRequest.HasMerged) .PullRequest.ConflictedFiles}} + <span class="conflicting flex-text-inline"> + {{svg "octicon-x" 14}} + {{ctx.Locale.TrN (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len .PullRequest.ConflictedFiles)}} + </span> + {{end}} + {{end}} + </div> + </div> + </div> + {{end}} + {{if .IssueIndexerUnavailable}} + <div class="ui error message"> + <p>{{ctx.Locale.Tr "search.keyword_search_unavailable"}}</p> + </div> + {{end}} +</div> +{{template "base/paginate" .}} diff --git a/templates/shared/label_filter.tmpl b/templates/shared/label_filter.tmpl new file mode 100644 index 0000000..2269271 --- /dev/null +++ b/templates/shared/label_filter.tmpl @@ -0,0 +1,50 @@ +<!-- Label --> +<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item label-filter"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_label"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_label"}}"> + </div> + <div class="ui checkbox compact archived-label-filter"> + <input name="archived" type="checkbox" + id="archived-filter-checkbox" + {{if .ShowArchivedLabels}}checked{{end}} + > + <label for="archived-filter-checkbox"> + {{ctx.Locale.Tr "repo.issues.label_archived_filter"}} + <i class="tw-ml-1" data-tooltip-content={{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}> + {{svg "octicon-info"}} + </i> + </label> + </div> + <span class="info">{{ctx.Locale.Tr "repo.issues.filter_label_exclude"}}</span> + <div class="divider"></div> + <a rel="nofollow" class="{{if .AllLabels}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels=&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_label_no_select"}}</a> + <a rel="nofollow" class="{{if .NoLabel}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels=0&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a> + {{$previousExclusiveScope := "_no_scope"}} + {{range .Labels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope $exclusiveScope)}} + <div class="divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a rel="nofollow" class="item label-filter-item tw-flex tw-items-center" {{if .IsArchived}}data-is-archived{{end}} href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&labels={{.QueryString}}&state={{$.State}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}" data-label-id="{{.ID}}"> + {{if .IsExcluded}} + {{svg "octicon-circle-slash"}} + {{else if .IsSelected}} + {{if $exclusiveScope}} + {{svg "octicon-dot-fill"}} + {{else}} + {{svg "octicon-check"}} + {{end}} + {{end}} + {{RenderLabel $.Context ctx.Locale .}} + <p class="tw-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p> + </a> + {{end}} + </div> +</div> diff --git a/templates/shared/repo_search.tmpl b/templates/shared/repo_search.tmpl new file mode 100644 index 0000000..d08d601 --- /dev/null +++ b/templates/shared/repo_search.tmpl @@ -0,0 +1,69 @@ +<div class="ui small secondary filter menu"> + <form id="repo-search-form" class="ui form ignore-dirty tw-flex-1 tw-flex tw-flex-row tw-gap-x-2 tw-items-center"> + {{if .Language}}<input hidden name="language" value="{{.Language}}">{{end}} + {{if .TopicOnly}}<input hidden name="topic" value="{{.TopicOnly}}">{{end}} + <div class="ui small fluid action input tw-flex-1"> + {{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.repo_kind")}} + {{if .PageIsExploreRepositories}} + <input type="hidden" name="only_show_relevant" value="{{.OnlyShowRelevant}}"> + {{else if .TabName}} + <input type="hidden" name="tab" value="{{.TabName}}"> + {{end}} + {{template "shared/search/button"}} + </div> + <!-- Filter --> + <div class="ui small dropdown type jump item tw-mr-0"> + <span class="text"> + {{ctx.Locale.Tr "filter"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <label class="item"><input type="radio" name="clear-filter"> {{ctx.Locale.Tr "filter.clear"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="archived" {{if .IsArchived.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_archived"}}</label> + <label class="item"><input type="radio" name="archived" {{if (not (.IsArchived.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_archived"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="fork" {{if .IsFork.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_fork"}}</label> + <label class="item"><input type="radio" name="fork" {{if (not (.IsFork.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_fork"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="mirror" {{if .IsMirror.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_mirror"}}</label> + <label class="item"><input type="radio" name="mirror" {{if (not (.IsMirror.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_mirror"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="template" {{if .IsTemplate.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_template"}}</label> + <label class="item"><input type="radio" name="template" {{if (not (.IsTemplate.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_template"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="private" {{if .IsPrivate.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.private"}}</label> + <label class="item"><input type="radio" name="private" {{if (not (.IsPrivate.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.public"}}</label> + </div> + </div> + <!-- Sort --> + <div class="ui small dropdown type jump item tw-mr-0"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <label class="{{if eq .SortType "newest"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "newest"}}checked{{end}} value="newest"> {{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</label> + <label class="{{if eq .SortType "oldest"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "oldest"}}checked{{end}} value="oldest"> {{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</label> + <label class="{{if eq .SortType "alphabetically"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "alphabetically"}}checked{{end}} value="alphabetically"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</label> + <label class="{{if eq .SortType "reversealphabetically"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "reversealphabetically"}}checked{{end}} value="reversealphabetically"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</label> + <label class="{{if eq .SortType "recentupdate"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "recentupdate"}}checked{{end}} value="recentupdate"> {{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</label> + <label class="{{if eq .SortType "leastupdate"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "leastupdate"}}checked{{end}} value="leastupdate"> {{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</label> + {{if not .DisableStars}} + <label class="{{if eq .SortType "moststars"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "moststars"}}checked{{end}} value="moststars"> {{ctx.Locale.Tr "repo.issues.filter_sort.moststars"}}</label> + <label class="{{if eq .SortType "feweststars"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "feweststars"}}checked{{end}} value="feweststars"> {{ctx.Locale.Tr "repo.issues.filter_sort.feweststars"}}</label> + {{end}} + <label class="{{if eq .SortType "mostforks"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "mostforks"}}checked{{end}} value="mostforks"> {{ctx.Locale.Tr "repo.issues.filter_sort.mostforks"}}</label> + <label class="{{if eq .SortType "fewestforks"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "fewestforks"}}checked{{end}} value="fewestforks"> {{ctx.Locale.Tr "repo.issues.filter_sort.fewestforks"}}</label> + <label class="{{if eq .SortType "size"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "size"}}checked{{end}} value="size"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.by_size"}}</label> + <label class="{{if eq .SortType "reversesize"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "reversesize"}}checked{{end}} value="reversesize"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_by_size"}}</label> + </div> + </div> + </form> +</div> +{{if and .PageIsExploreRepositories .OnlyShowRelevant}} + <div class="ui message explore-relevancy-note"> + <span data-tooltip-content="{{ctx.Locale.Tr "explore.relevant_repositories_tooltip"}}">{{ctx.Locale.Tr "explore.relevant_repositories" (printf "?only_show_relevant=0&sort=%s&q=%s&language=%s" $.SortType (QueryEscape $.Keyword) (QueryEscape $.Language))}}</span> + </div> +{{end}} +<div class="divider"></div> diff --git a/templates/shared/search/button.tmpl b/templates/shared/search/button.tmpl new file mode 100644 index 0000000..7bb1662 --- /dev/null +++ b/templates/shared/search/button.tmpl @@ -0,0 +1,3 @@ +{{/* Disable (optional) - if search button has to be disabled */}} +{{/* Tooltip (optional) - a tooltip to be displayed on hover */}} +<button class="ui small icon button" aria-label="{{ctx.Locale.Tr "search.search"}}" {{with .Tooltip}}data-tooltip-content="{{.}}"{{end}}{{if .Disabled}} disabled{{end}}>{{svg "octicon-search"}}</button> diff --git a/templates/shared/search/code/results.tmpl b/templates/shared/search/code/results.tmpl new file mode 100644 index 0000000..fe37557 --- /dev/null +++ b/templates/shared/search/code/results.tmpl @@ -0,0 +1,44 @@ +<div class="flex-text-block tw-flex-wrap"> + {{range $term := .SearchResultLanguages}} + <a class="ui {{if eq $.Language $term.Language}}primary{{end}} basic label tw-m-0" + href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&fuzzy={{$.IsFuzzy}}"> + <i class="color-icon tw-mr-2" style="background-color: {{$term.Color}}"></i> + {{$term.Language}} + <div class="detail">{{$term.Count}}</div> + </a> + {{end}} +</div> +<div class="repository search"> + {{range $result := .SearchResults}} + {{$repo := or $.Repo (index $.RepoMaps .RepoID)}} + <details class="tw-group diff-file-box diff-box file-content non-diff-file-content repo-search-result" open> + <summary class="tw-list-none"> + <h4 class="ui top attached header tw-font-normal tw-flex tw-flex-wrap tw-transform-reset"> + <span class="tw-h-4 tw-transition -tw-rotate-90 group-open:tw-rotate-0"> + {{svg "octicon-chevron-down"}} + </span> + {{if not $.Repo}} + <span class="file tw-flex-1 tw-ml-2"> + <a rel="nofollow" href="{{$repo.Link}}">{{$repo.FullName}}</a> + {{if $repo.IsArchived}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span> + {{end}} + - {{.Filename}} + </span> + {{else}} + <span class="file tw-flex-1 tw-ml-2"> + <a rel="nofollow" class="muted file-link" href="{{$repo.Link}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{/* + */}}{{.Filename}}</a> + </span> + {{end}} + <a role="button" class="ui basic tiny button" rel="nofollow" href="{{$repo.Link}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + </h4> + </summary> + <div class="ui attached table segment"> + {{template "shared/searchfile" dict "RepoLink" $repo.Link "SearchResult" .}} + </div> + {{template "shared/searchbottom" dict "root" $ "result" .}} + </details> + {{end}} +</div> +{{template "base/paginate" .}} diff --git a/templates/shared/search/code/search.tmpl b/templates/shared/search/code/search.tmpl new file mode 100644 index 0000000..6a52bb9 --- /dev/null +++ b/templates/shared/search/code/search.tmpl @@ -0,0 +1,28 @@ +<form class="ui form ignore-dirty"> + {{template "shared/search/combo_fuzzy" + dict + "Value" .Keyword + "Disabled" .CodeIndexerUnavailable + "IsFuzzy" .IsFuzzy + "Placeholder" (ctx.Locale.Tr "search.code_kind") + "CodeIndexerDisabled" $.CodeIndexerDisabled}} +</form> +<div class="divider"></div> +<div class="ui user list"> + {{if .CodeIndexerUnavailable}} + <div class="ui error message"> + <p>{{ctx.Locale.Tr "search.code_search_unavailable"}}</p> + </div> + {{else}} + {{if .CodeIndexerDisabled}} + <div class="ui message" data-test-tag="grep"> + <p>{{ctx.Locale.Tr "search.code_search_by_git_grep"}}</p> + </div> + {{end}} + {{if .SearchResults}} + {{template "shared/search/code/results" .}} + {{else if .Keyword}} + <div>{{ctx.Locale.Tr "search.no_results"}}</div> + {{end}} + {{end}} +</div> diff --git a/templates/shared/search/combo.tmpl b/templates/shared/search/combo.tmpl new file mode 100644 index 0000000..788db95 --- /dev/null +++ b/templates/shared/search/combo.tmpl @@ -0,0 +1,8 @@ +{{/* Value - value of the search field (for search results page) */}} +{{/* Disabled (optional) - if search field/button has to be disabled */}} +{{/* Placeholder (optional) - placeholder text to be used */}} +{{/* Tooltip (optional) - a tooltip to be displayed on button hover */}} +<div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}} + {{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}} +</div> diff --git a/templates/shared/search/combo_fuzzy.tmpl b/templates/shared/search/combo_fuzzy.tmpl new file mode 100644 index 0000000..38189b0 --- /dev/null +++ b/templates/shared/search/combo_fuzzy.tmpl @@ -0,0 +1,15 @@ +{{/* Value - value of the search field (for search results page) */}} +{{/* Disabled (optional) - if search field/button has to be disabled */}} +{{/* Placeholder (optional) - placeholder text to be used */}} +{{/* IsFuzzy - state of the fuzzy/union search toggle */}} +{{/* CodeIndexerDisabled (optional) - if the performed search is done using git-grep */}} +{{/* Tooltip (optional) - a tooltip to be displayed on button hover */}} +<div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}} + {{template "shared/search/fuzzy" + dict + "Disabled" .Disabled + "IsFuzzy" .IsFuzzy + "CodeIndexerDisabled" .CodeIndexerDisabled}} + {{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}} +</div> diff --git a/templates/shared/search/fuzzy.tmpl b/templates/shared/search/fuzzy.tmpl new file mode 100644 index 0000000..25cfc57 --- /dev/null +++ b/templates/shared/search/fuzzy.tmpl @@ -0,0 +1,21 @@ +{{/* Disabled (optional) - if dropdown has to be disabled */}} +{{/* IsFuzzy - state of the fuzzy search toggle */}} +<div class="ui small dropdown selection {{if .Disabled}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}" data-test-tag="fuzzy-dropdown"> + {{$fuzzyType := "fuzzy"}} + {{if .CodeIndexerDisabled}} + {{$fuzzyType = "union"}} + {{end}} + <input name="fuzzy" type="hidden"{{if .Disabled}} disabled{{end}} value="{{.IsFuzzy}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{/* + if code indexer is disabled display fuzzy as union + */}}{{if .IsFuzzy}}{{/* + */}}{{ctx.Locale.Tr (printf "search.%s" $fuzzyType)}}{{/* + */}}{{else}}{{/* + */}}{{ctx.Locale.Tr "search.exact"}}{{/* + */}}{{end}}</div> + <div class="menu"> + <div class="item" data-value="true" data-tooltip-content="{{ctx.Locale.Tr (printf "search.%s_tooltip" $fuzzyType)}}">{{/* + */}}{{ctx.Locale.Tr (printf "search.%s" $fuzzyType)}}</div> + <div class="item" data-value="false" data-tooltip-content="{{ctx.Locale.Tr "search.exact_tooltip"}}">{{ctx.Locale.Tr "search.exact"}}</div> + </div> +</div> diff --git a/templates/shared/search/input.tmpl b/templates/shared/search/input.tmpl new file mode 100644 index 0000000..195cefc --- /dev/null +++ b/templates/shared/search/input.tmpl @@ -0,0 +1,4 @@ +{{/* Value - value of the search field (for search results page) */}} +{{/* Disabled (optional) - if search field has to be disabled */}} +{{/* Placeholder (optional) - placeholder text to be used */}} +<input type="search" spellcheck="false" name="q" maxlength="255" placeholder="{{with .Placeholder}}{{.}}{{else}}{{ctx.Locale.Tr "search.search"}}{{end}}"{{with .Value}} value="{{.}}"{{end}}{{if .Disabled}} disabled{{end}}> diff --git a/templates/shared/searchbottom.tmpl b/templates/shared/searchbottom.tmpl new file mode 100644 index 0000000..bee0397 --- /dev/null +++ b/templates/shared/searchbottom.tmpl @@ -0,0 +1,14 @@ +{{if or .result.Language (not .result.UpdatedUnix.IsZero)}} +<div class="ui bottom attached table segment tw-flex tw-items-center tw-justify-between"> + <div class="tw-flex tw-items-center tw-ml-4"> + {{if .result.Language}} + <i class="color-icon tw-mr-2" style="background-color: {{.result.Color}}"></i>{{.result.Language}} + {{end}} + </div> + <div class="tw-mr-4"> + {{if not .result.UpdatedUnix.IsZero}} + <span class="ui grey text">{{ctx.Locale.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix ctx.Locale)}}</span> + {{end}} + </div> +</div> +{{end}} diff --git a/templates/shared/searchfile.tmpl b/templates/shared/searchfile.tmpl new file mode 100644 index 0000000..a051742 --- /dev/null +++ b/templates/shared/searchfile.tmpl @@ -0,0 +1,25 @@ +<div class="file-body file-code code-view"> + <div> + <ol class="tw-p-0 tw-m-0"> + {{/* if the expected line number does not match + the actual line number end the ordered list + and begin a new one */}} + {{$expNum := 0}} + {{range .SearchResult.Lines}} + {{if and (gt $expNum 0) (ne .Num $expNum)}} + </ol> + <ol class="tw-p-0 tw-m-0 tw-pt-2 tw-mt-2 tw-border-t-4 tw-border-secondary"> + {{end}} + <li value="{{.Num}}" class="tw-grid tw-grid-cols-[minmax(50px,_1%)_auto] tw-list-none"> + <div class="lines-num"> + <a href="{{$.RepoLink}}/src/commit/{{PathEscape $.SearchResult.CommitID}}/{{PathEscapeSegments $.SearchResult.Filename}}#L{{.Num}}"> + {{.Num}} + </a> + </div> + <div class="lines-code chroma"><code class="code-inner">{{.FormattedContent}}</code></div> + </li> + {{$expNum = Eval .Num "+" 1}} + {{end}} + </ol> + </div> +</div> diff --git a/templates/shared/secrets/add_list.tmpl b/templates/shared/secrets/add_list.tmpl new file mode 100644 index 0000000..ea59459 --- /dev/null +++ b/templates/shared/secrets/add_list.tmpl @@ -0,0 +1,81 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "secrets.management"}} + <div class="ui right"> + <button class="ui primary tiny button show-modal" + data-modal="#add-secret-modal" + data-modal-form.action="{{.Link}}" + data-modal-header="{{ctx.Locale.Tr "secrets.creation"}}" + > + {{ctx.Locale.Tr "secrets.creation"}} + </button> + </div> +</h4> +<div class="ui attached segment"> + {{if .Secrets}} + <div class="flex-list"> + {{range .Secrets}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "octicon-key" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{.Name}} + </div> + <div class="flex-item-body"> + ****** + </div> + </div> + <div class="flex-item-trailing"> + <span class="color-text-light-2"> + {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} + </span> + <button class="ui btn interact-bg link-action tw-p-2" + data-url="{{$.Link}}/delete?id={{.ID}}" + data-modal-confirm="{{ctx.Locale.Tr "secrets.deletion.description"}}" + data-tooltip-content="{{ctx.Locale.Tr "secrets.deletion"}}" + > + {{svg "octicon-trash"}} + </button> + </div> + </div> + {{end}} + </div> + {{else}} + {{ctx.Locale.Tr "secrets.none"}} + {{end}} +</div> + +{{/* Add secret dialog */}} +<div class="ui small modal" id="add-secret-modal"> + <div class="header"> + <span id="actions-modal-header"></span> + </div> + <form class="ui form form-fetch-action" method="post"> + <div class="content"> + {{.CsrfTokenHtml}} + <div class="field"> + {{ctx.Locale.Tr "secrets.description"}} + </div> + <div class="field"> + <label for="secret-name">{{ctx.Locale.Tr "name"}}</label> + <input autofocus required + id="secret-name" + name="name" + value="{{.name}}" + pattern="^(?!GITEA_|GITHUB_)[a-zA-Z_][a-zA-Z0-9_]*$" + placeholder="{{ctx.Locale.Tr "secrets.creation.name_placeholder"}}" + > + </div> + <div class="field"> + <label for="secret-data">{{ctx.Locale.Tr "value"}}</label> + <textarea required + id="secret-data" + name="data" + placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}" + ></textarea> + </div> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> +</div> diff --git a/templates/shared/user/authorlink.tmpl b/templates/shared/user/authorlink.tmpl new file mode 100644 index 0000000..d57a635 --- /dev/null +++ b/templates/shared/user/authorlink.tmpl @@ -0,0 +1 @@ +<a class="author text black tw-font-semibold muted"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a>{{if .IsBot}}<span class="ui basic label tw-p-1">bot</span>{{end}} diff --git a/templates/shared/user/avatarlink.tmpl b/templates/shared/user/avatarlink.tmpl new file mode 100644 index 0000000..5e3ed7a --- /dev/null +++ b/templates/shared/user/avatarlink.tmpl @@ -0,0 +1 @@ +<a class="avatar"{{if gt .user.ID 0}} href="{{.user.HomeLink}}"{{end}}>{{ctx.AvatarUtils.Avatar .user}}</a> diff --git a/templates/shared/user/blocked_users.tmpl b/templates/shared/user/blocked_users.tmpl new file mode 100644 index 0000000..e83a039 --- /dev/null +++ b/templates/shared/user/blocked_users.tmpl @@ -0,0 +1,83 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "user.block.title"}} +</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "user.block.info_1"}}</p> + <ul> + <li>{{ctx.Locale.Tr "user.block.info_2"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_3"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_4"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_5"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_6"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_7"}}</li> + </ul> +</div> +<div class="ui segment"> + <form class="ui form ignore-dirty" action="{{$.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="block" /> + <div id="search-user-box" class="field ui fluid search input"> + <input class="prompt tw-mr-2" name="blockee" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" required> + <button class="ui red button">{{ctx.Locale.Tr "user.block.block"}}</button> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "user.block.note.title"}}</label> + <input name="note"> + <p class="help">{{ctx.Locale.Tr "user.block.note.info"}}</p> + </div> + </form> +</div> +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "user.block.list"}} +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + {{range .UserBlocks}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar .Blockee}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + <a class="item" href="{{.Blockee.HTMLURL}}">{{.Blockee.GetDisplayName}}</a> + </div> + {{if .Note}} + <div class="flex-item-body"> + <i>{{ctx.Locale.Tr "user.block.note"}}:</i> {{.Note}} + </div> + {{end}} + </div> + <div class="flex-item-trailing"> + <button class="ui compact mini button show-modal" data-modal="#block-user-note-modal" data-modal-modal-blockee="{{.Blockee.Name}}" data-modal-modal-note="{{.Note}}">{{ctx.Locale.Tr "user.block.note.edit"}}</button> + <form action="{{$.Link}}" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="action" value="unblock" /> + <input type="hidden" name="blockee" value="{{.Blockee.Name}}" /> + <button class="ui compact mini button">{{ctx.Locale.Tr "user.block.unblock"}}</button> + </form> + </div> + </div> + {{else}} + <div class="item">{{ctx.Locale.Tr "user.block.list.none"}}</div> + {{end}} + </div> +</div> +<div class="ui small modal" id="block-user-note-modal"> + <div class="header">{{ctx.Locale.Tr "user.block.note.edit"}}</div> + <div class="content"> + <form class="ui form" action="{{$.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="note" /> + <input type="hidden" name="blockee" class="modal-blockee" /> + <div class="field"> + <label>{{ctx.Locale.Tr "user.block.note.title"}}</label> + <input name="note" class="modal-note" /> + <p class="help">{{ctx.Locale.Tr "user.block.note.info"}}</p> + </div> + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button> + <button class="ui primary button">{{ctx.Locale.Tr "save"}}</button> + </div> + </form> + </div> +</div> diff --git a/templates/shared/user/name.tmpl b/templates/shared/user/name.tmpl new file mode 100644 index 0000000..896349f --- /dev/null +++ b/templates/shared/user/name.tmpl @@ -0,0 +1 @@ +<a class="text muted" href="{{.HomeLink}}">{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}</a> diff --git a/templates/shared/user/namelink.tmpl b/templates/shared/user/namelink.tmpl new file mode 100644 index 0000000..a122f4f --- /dev/null +++ b/templates/shared/user/namelink.tmpl @@ -0,0 +1 @@ +<a{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a> diff --git a/templates/shared/user/org_profile_avatar.tmpl b/templates/shared/user/org_profile_avatar.tmpl new file mode 100644 index 0000000..c0abcab --- /dev/null +++ b/templates/shared/user/org_profile_avatar.tmpl @@ -0,0 +1,16 @@ +{{with .ContextUser}} + <div class="ui container"> + <div class="ui vertically grid head"> + <div class="column"> + <div class="ui header tw-flex tw-items-center tw-break-anywhere"> + {{ctx.AvatarUtils.Avatar . 100}} + <span class="text grey"><a class="muted" href="{{.HomeLink}}">{{.DisplayName}}</a></span> + <span class="org-visibility"> + {{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} + {{if .Visibility.IsPrivate}}<div class="ui medium basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} + </span> + </div> + </div> + </div> + </div> +{{end}} diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl new file mode 100644 index 0000000..d3033b4 --- /dev/null +++ b/templates/shared/user/profile_big_avatar.tmpl @@ -0,0 +1,129 @@ +{{if .IsHTMX}} + {{template "base/alert" .}} +{{end}} +<div id="profile-avatar-card" class="ui card" hx-swap="morph"> + <div id="profile-avatar" class="content tw-flex"> + {{if eq .SignedUserID .ContextUser.ID}} + <a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}"> + {{/* the size doesn't take affect (and no need to take affect), image size(width) should be controlled by the parent container since this is not a flex layout*/}} + {{ctx.AvatarUtils.Avatar .ContextUser 256}} + </a> + {{else}} + <span class="image"> + {{ctx.AvatarUtils.Avatar .ContextUser 256}} + </span> + {{end}} + </div> + <div class="content tw-break-anywhere profile-avatar-name"> + {{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}} + <span class="username text center">{{.ContextUser.Name}}{{if .ContextUser.Pronouns}} · {{.ContextUser.Pronouns}}{{end}} {{if .IsAdmin}} + <a class="muted" href="{{AppSubUrl}}/admin/users/{{.ContextUser.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}"> + {{svg "octicon-gear" 18}} + </a> + {{end}}</span> + <div class="tw-mt-2"> + <a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-people" 18 "tw-mr-1"}}{{ctx.Locale.TrN .NumFollowers "user.followers_one" "user.followers_few" .NumFollowers}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{ctx.Locale.TrN .NumFollowing "user.following_one" "user.following_few" .NumFollowing}}</a> + {{if and .EnableFeed (or .IsAdmin (eq .SignedUserID .ContextUser.ID) (not .ContextUser.KeepActivityPrivate))}} + <a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a> + {{end}} + </div> + </div> + <div class="extra content tw-break-anywhere"> + <ul> + {{if .ContextUser.Location}} + <li> + {{svg "octicon-location"}} + <span class="tw-flex-1">{{.ContextUser.Location}}</span> + {{if .ContextUserLocationMapURL}} + <a href="{{.ContextUserLocationMapURL}}" rel="nofollow noreferrer" data-tooltip-content="{{ctx.Locale.Tr "user.show_on_map"}}"> + {{svg "octicon-link-external"}} + </a> + {{end}} + </li> + {{end}} + {{if .ShowUserEmail}} + <li> + {{svg "octicon-mail"}} + <a class="tw-flex-1" href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a> + {{if (eq .SignedUserID .ContextUser.ID)}} + <a href="{{AppSubUrl}}/user/settings#privacy-user-settings"> + <i data-tooltip-content="{{ctx.Locale.Tr "user.email_visibility.limited"}}"> + {{svg "octicon-unlock"}} + </i> + </a> + {{end}} + </li> + {{end}} + {{if .ContextUser.Website}} + <li> + {{svg "octicon-link"}} + <a target="_blank" rel="noopener noreferrer me" href="{{.ContextUser.Website}}">{{.ContextUser.Website}}</a> + </li> + {{end}} + {{if $.RenderedDescription}} + <li> + <div class="render-content markup">{{$.RenderedDescription}}</div> + </li> + {{end}} + {{range .OpenIDs}} + {{if .Show}} + <li> + {{svg "fontawesome-openid"}} + <a target="_blank" rel="noopener noreferrer" href="{{.URI}}">{{.URI}}</a> + </li> + {{end}} + {{end}} + <li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix)}}</span></li> + {{if and .Orgs .HasOrgsVisible}} + <li> + <ul class="user-orgs"> + {{range .Orgs}} + {{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID ctx $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}} + <li> + <a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + </a> + </li> + {{end}} + {{end}} + </ul> + </li> + {{end}} + {{if .Badges}} + <li> + <ul class="user-badges"> + {{range .Badges}} + <li> + <img width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}"> + </li> + {{end}} + </ul> + </li> + {{end}} + {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}} + <li class="follow" hx-target="#profile-avatar-card" hx-indicator="#profile-avatar-card"> + {{if $.IsFollowing}} + <button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}} + </button> + {{else}} + <button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}} + </button> + {{end}} + </li> + <li class="block" hx-target="#profile-avatar-card" hx-indicator="#profile-avatar-card"> + {{if $.IsBlocked}} + <button class="ui basic red button" hx-post="{{.ContextUser.HomeLink}}?action=unblock"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "user.unblock"}} + </button> + {{else}} + <button type="submit" class="ui basic orange button" data-modal-id="block-user" hx-post="{{.ContextUser.HomeLink}}?action=block" hx-confirm="-"> + {{svg "octicon-blocked"}} {{ctx.Locale.Tr "user.block"}} + </button> + {{end}} + </li> + {{end}} + </ul> + </div> +</div> diff --git a/templates/shared/variables/variable_list.tmpl b/templates/shared/variables/variable_list.tmpl new file mode 100644 index 0000000..06c71c0 --- /dev/null +++ b/templates/shared/variables/variable_list.tmpl @@ -0,0 +1,92 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.variables.management"}} + <div class="ui right"> + <button class="ui primary tiny button show-modal" + data-modal="#edit-variable-modal" + data-modal-form.action="{{.Link}}/new" + data-modal-header="{{ctx.Locale.Tr "actions.variables.creation"}}" + data-modal-dialog-variable-name="" + data-modal-dialog-variable-data="" + > + {{ctx.Locale.Tr "actions.variables.creation"}} + </button> + </div> +</h4> +<div class="ui attached segment"> + {{if .Variables}} + <div class="flex-list"> + {{range .Variables}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "octicon-pencil" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{.Name}} + </div> + <div class="flex-item-body"> + {{.Data}} + </div> + </div> + <div class="flex-item-trailing"> + <span class="color-text-light-2"> + {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} + </span> + <button class="btn interact-bg tw-p-2 show-modal" + data-tooltip-content="{{ctx.Locale.Tr "actions.variables.edit"}}" + data-modal="#edit-variable-modal" + data-modal-form.action="{{$.Link}}/{{.ID}}/edit" + data-modal-header="{{ctx.Locale.Tr "actions.variables.edit"}}" + data-modal-dialog-variable-name="{{.Name}}" + data-modal-dialog-variable-data="{{.Data}}" + > + {{svg "octicon-pencil"}} + </button> + <button class="btn interact-bg tw-p-2 link-action" + data-tooltip-content="{{ctx.Locale.Tr "actions.variables.deletion"}}" + data-url="{{$.Link}}/{{.ID}}/delete" + data-modal-confirm="{{ctx.Locale.Tr "actions.variables.deletion.description"}}" + > + {{svg "octicon-trash"}} + </button> + </div> + </div> + {{end}} + </div> + {{else}} + {{ctx.Locale.Tr "actions.variables.none"}} + {{end}} +</div> + +{{/** Edit variable dialog */}} +<div class="ui small modal" id="edit-variable-modal"> + <div class="header"></div> + <form class="ui form form-fetch-action" method="post"> + <div class="content"> + {{.CsrfTokenHtml}} + <div class="field"> + {{ctx.Locale.Tr "actions.variables.description"}} + </div> + <div class="field"> + <label for="dialog-variable-name">{{ctx.Locale.Tr "name"}}</label> + <input autofocus required + name="name" + id="dialog-variable-name" + value="{{.name}}" + pattern="^(?!GITEA_|GITHUB_)[a-zA-Z_][a-zA-Z0-9_]*$" + placeholder="{{ctx.Locale.Tr "secrets.creation.name_placeholder"}}" + > + </div> + <div class="field"> + <label for="dialog-variable-data">{{ctx.Locale.Tr "value"}}</label> + <textarea required + name="data" + id="dialog-variable-data" + placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}" + ></textarea> + </div> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> +</div> + diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl new file mode 100644 index 0000000..3c84f11 --- /dev/null +++ b/templates/shared/webhook/icon.tmpl @@ -0,0 +1,29 @@ +{{$size := 26}} +{{if .Size}} + {{$size = .Size}} +{{end}} +{{if eq .HookType "forgejo"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/forgejo.svg"> +{{else if eq .HookType "gitea"}} + {{svg "gitea-gitea" $size "img"}} +{{else if eq .HookType "gogs"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gogs.ico"> +{{else if eq .HookType "slack"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/slack.png"> +{{else if eq .HookType "discord"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/discord.png"> +{{else if eq .HookType "dingtalk"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/dingtalk.ico"> +{{else if eq .HookType "telegram"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/telegram.png"> +{{else if eq .HookType "msteams"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/msteams.png"> +{{else if eq .HookType "feishu"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/feishu.png"> +{{else if eq .HookType "matrix"}} + {{svg "gitea-matrix" $size "img"}} +{{else if eq .HookType "wechatwork"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/wechatwork.png"> +{{else if eq .HookType "packagist"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/packagist.png"> +{{end}} |