diff options
Diffstat (limited to 'templates/repo/settings')
32 files changed, 2450 insertions, 0 deletions
diff --git a/templates/repo/settings/actions.tmpl b/templates/repo/settings/actions.tmpl new file mode 100644 index 00000000..f38ab5b6 --- /dev/null +++ b/templates/repo/settings/actions.tmpl @@ -0,0 +1,11 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings actions")}} + <div class="repo-setting-content"> + {{if eq .PageType "runners"}} + {{template "shared/actions/runner_list" .}} + {{else if eq .PageType "secrets"}} + {{template "shared/secrets/add_list" .}} + {{else if eq .PageType "variables"}} + {{template "shared/variables/variable_list" .}} + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl new file mode 100644 index 00000000..52c0c2c8 --- /dev/null +++ b/templates/repo/settings/branches.tmpl @@ -0,0 +1,78 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings edit")}} + <div class="repo-setting-content"> + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{ctx.Locale.Tr "repo.settings.archive.branchsettings_unavailable"}} + </div> + {{else}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.default_branch"}} + </h4> + <div class="ui attached segment"> + <p> + {{ctx.Locale.Tr "repo.settings.default_branch_desc"}} + </p> + <form class="tw-flex" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="default_branch"> + {{if not .Repository.IsEmpty}} + <div class="ui dropdown selection search tw-flex-1 tw-mr-2 tw-max-w-96"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <input type="hidden" name="branch" value="{{.Repository.DefaultBranch}}"> + <div class="default text">{{.Repository.DefaultBranch}}</div> + <div class="menu"> + {{range .Branches}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.branches.update_default_branch"}}</button> + {{end}} + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.protected_branch"}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{$.Repository.Link}}/settings/branches/edit">{{ctx.Locale.Tr "repo.settings.branches.add_new_rule"}}</a> + </div> + </h4> + + <div class="ui attached segment"> + <div class="flex-list"> + {{range .ProtectedBranches}} + <div class="flex-item tw-items-center"> + <div class="flex-item-main"> + <div class="flex-item-title"> + <div class="ui basic primary label">{{.RuleName}}</div> + </div> + </div> + <div class="flex-item-trailing"> + <a class="rm ui tiny button" href="{{$.Repository.Link}}/settings/branches/edit?rule_name={{.RuleName}}">{{ctx.Locale.Tr "repo.settings.edit_protected_branch"}}</a> + <button class="ui red tiny button delete-button" data-url="{{$.Repository.Link}}/settings/branches/{{.ID}}/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.protected_branch.delete_rule"}} + </button> + </div> + </div> + {{else}} + <div class="flex-item center aligned"> + {{ctx.Locale.Tr "repo.settings.no_protected_branch"}} + </div> + {{end}} + </div> + </div> + {{end}} + </div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.protected_branch_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.protected_branch_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl new file mode 100644 index 00000000..8028642a --- /dev/null +++ b/templates/repo/settings/collaboration.tmpl @@ -0,0 +1,117 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings collaboration")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.collaboration"}} + </h4> + {{if .Collaborators}} + <div class="ui attached segment"> + <div class="flex-list"> + {{range .Collaborators}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + <a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a> + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .}} + </div> + </div> + <div class="flex-item-trailing"> + <div class="flex-text-block"> + {{svg "octicon-shield-lock"}} + <div class="ui inline dropdown access-mode" data-url="{{$.Link}}/access_mode" data-uid="{{.ID}}" data-last-value="{{printf "%d" .Collaboration.Mode}}"> + <div class="text">{{if eq .Collaboration.Mode 1}}{{ctx.Locale.Tr "repo.settings.collaboration.read"}}{{else if eq .Collaboration.Mode 2}}{{ctx.Locale.Tr "repo.settings.collaboration.write"}}{{else if eq .Collaboration.Mode 3}}{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}{{else}}{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}{{end}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-text="{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}" data-value="3">{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}</div> + <div class="item" data-text="{{ctx.Locale.Tr "repo.settings.collaboration.write"}}" data-value="2">{{ctx.Locale.Tr "repo.settings.collaboration.write"}}</div> + <div class="item" data-text="{{ctx.Locale.Tr "repo.settings.collaboration.read"}}" data-value="1">{{ctx.Locale.Tr "repo.settings.collaboration.read"}}</div> + </div> + </div> + </div> + <button class="ui red tiny button inline delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} + </button> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + <div class="ui bottom attached segment"> + <form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div id="search-user-box" class="ui search input tw-align-middle"> + <input class="prompt" name="collaborator" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" autofocus required> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_collaborator"}}</button> + </form> + </div> + + {{if .RepoOwnerIsOrganization}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.teams"}} + </h4> + {{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}} + {{if .Teams}} + <div class="ui attached segment"> + <div class="flex-list"> + {{range $t, $team := .Teams}} + <div class="flex-item"> + <div class="flex-item-main"> + <a class="flex-item-title text primary" href="{{AppSubUrl}}/org/{{$.OrgName|PathEscape}}/teams/{{.LowerName|PathEscape}}"> + {{.Name}} + </a> + <div class="flex-item-body flex-text-block"> + {{svg "octicon-shield-lock"}} + {{if eq .AccessMode 1}}{{ctx.Locale.Tr "repo.settings.collaboration.read"}}{{else if eq .AccessMode 2}}{{ctx.Locale.Tr "repo.settings.collaboration.write"}}{{else if eq .AccessMode 3}}{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}{{else if eq .AccessMode 4}}{{ctx.Locale.Tr "repo.settings.collaboration.owner"}}{{else}}{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}{{end}} + </div> + {{if or (eq .AccessMode 1) (eq .AccessMode 2)}} + {{$first := true}} + <div class="flex-item-body" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.change_team_permission_tip"}}"> + Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $.Context $unit.Type) ($team.UnitEnabled $.Context $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{ctx.Locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}} + </div> + {{end}} + </div> + {{if $allowedToChangeTeams}} + <div class="flex-item-trailing" {{if .IncludesAllRepositories}} data-tooltip-content="{{ctx.Locale.Tr "repo.settings.delete_team_tip"}}"{{end}}> + <button class="ui red tiny button inline delete-button {{if .IncludesAllRepositories}}disabled{{end}}" data-url="{{$.Link}}/team/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} + </button> + </div> + {{end}} + </div> + {{end}} + </div> + </div> + {{end}} + <div class="ui bottom attached segment"> + {{if $allowedToChangeTeams}} + <form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post"> + {{.CsrfTokenHtml}} + <div id="search-team-box" class="ui search input tw-align-middle" data-org-name="{{.OrgName}}"> + <input class="prompt" name="team" placeholder="{{ctx.Locale.Tr "search.team_kind"}}" autocomplete="off" autofocus required> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_team"}}</button> + </form> + {{else}} + <div class="item"> + {{ctx.Locale.Tr "repo.settings.change_team_access_not_allowed"}} + </div> + {{end}} + </div> + {{end}} + </div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.collaborator_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.collaborator_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl new file mode 100644 index 00000000..4bc3abf6 --- /dev/null +++ b/templates/repo/settings/deploy_keys.tmpl @@ -0,0 +1,86 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.deploy_keys"}} + <div class="ui right"> + {{if not .DisableSSH}} + <button class="ui primary tiny show-panel toggle button" data-panel="#add-deploy-key-panel">{{ctx.Locale.Tr "repo.settings.add_deploy_key"}}</button> + {{else}} + <button class="ui primary tiny button disabled">{{ctx.Locale.Tr "settings.ssh_disabled"}}</button> + {{end}} + </div> + </h4> + <div class="ui attached segment"> + <div class="{{if not .HasError}}tw-hidden{{end}} tw-mb-4" id="add-deploy-key-panel"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + {{ctx.Locale.Tr "repo.settings.deploy_key_desc"}} + </div> + <div class="field {{if .Err_Title}}error{{end}}"> + <label for="ssh-key-title">{{ctx.Locale.Tr "repo.settings.title"}}</label> + <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required> + </div> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="ssh-key-content">{{ctx.Locale.Tr "repo.settings.deploy_key_content"}}</label> + <textarea id="ssh-key-content" name="content" placeholder="{{ctx.Locale.Tr "settings.key_content_ssh_placeholder"}}" required>{{.content}}</textarea> + </div> + <div class="field"> + <div class="ui checkbox {{if .Err_IsWritable}}error{{end}}"> + <input id="ssh-key-is-writable" name="is_writable" type="checkbox" value="1"> + <label for="ssh-key-is-writable"> + {{ctx.Locale.Tr "repo.settings.is_writable"}} + </label> + <small class="tw-pl-[26px]">{{ctx.Locale.Tr "repo.settings.is_writable_info"}}</small> + </div> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.settings.add_deploy_key"}} + </button> + <button class="ui hide-panel button" data-panel="#add-deploy-key-panel"> + {{ctx.Locale.Tr "cancel"}} + </button> + </form> + </div> + {{if .Deploykeys}} + <div class="flex-list"> + {{range .Deploykeys}} + <div class="flex-item"> + <div class="flex-item-leading"> + <span class="text {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.key_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span> + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + {{.Fingerprint}} + </div> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}} - <span>{{ctx.Locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{ctx.Locale.Tr "settings.can_write_info"}} {{end}}</span></p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + {{else}} + {{ctx.Locale.Tr "repo.settings.no_deploy_keys"}} + {{end}} + </div> + </div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.deploy_key_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.deploy_key_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/githook_edit.tmpl b/templates/repo/settings/githook_edit.tmpl new file mode 100644 index 00000000..e20f51b9 --- /dev/null +++ b/templates/repo/settings/githook_edit.tmpl @@ -0,0 +1,27 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings edit githook")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.githooks"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "repo.settings.githook_edit_desc"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + {{with .Hook}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.settings.githook_name"}}</label> + <span class="hook-filename">{{.Name}}</span> + </div> + <div class="field"> + <label for="content">{{ctx.Locale.Tr "repo.settings.githook_content"}}</label> + <textarea id="content" name="content" class="tw-hidden">{{if .IsActive}}{{.Content}}{{else}}{{.Sample}}{{end}}</textarea> + <div class="editor-loading is-loading"></div> + </div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_githook"}}</button> + </div> + {{end}} + </form> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/githooks.tmpl b/templates/repo/settings/githooks.tmpl new file mode 100644 index 00000000..1a603f9f --- /dev/null +++ b/templates/repo/settings/githooks.tmpl @@ -0,0 +1,23 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings githooks")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.githooks"}} + </h4> + <div class="ui attached segment"> + <div class="ui list"> + <div class="item"> + {{ctx.Locale.Tr "repo.settings.githooks_desc"}} + </div> + {{range .Hooks}} + <div class="item truncated-item-container"> + <span class="text {{if .IsActive}}green{{else}}grey{{end}} tw-mr-2">{{svg "octicon-dot-fill" 22}}</span> + <span class="text truncate tw-flex-1 tw-mr-2">{{.Name}}</span> + <a class="muted tw-float-right tw-p-2" href="{{$.RepoLink}}/settings/hooks/git/{{.Name|PathEscape}}"> + {{svg "octicon-pencil"}} + </a> + </div> + {{end}} + </div> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/layout_footer.tmpl b/templates/repo/settings/layout_footer.tmpl new file mode 100644 index 00000000..60cad3ff --- /dev/null +++ b/templates/repo/settings/layout_footer.tmpl @@ -0,0 +1,11 @@ +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} +<div class="page-content"> + <div class="repo-layout-right"> + <div> + {{/* block: repo-setting-content */}} +{{end}} + + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/settings/layout_head.tmpl b/templates/repo/settings/layout_head.tmpl new file mode 100644 index 00000000..efec9bf8 --- /dev/null +++ b/templates/repo/settings/layout_head.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .ctxData}} +<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}"> + {{template "repo/header" .ctxData}} + <div class="ui container flex-container"> + {{template "repo/settings/navbar" .ctxData}} + <div class="flex-container-main"> + {{template "base/alert" .ctxData}} + {{/* block: repo-setting-content */}} + +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} + </div> + </div> +</div> +{{end}} diff --git a/templates/repo/settings/lfs.tmpl b/templates/repo/settings/lfs.tmpl new file mode 100644 index 00000000..6d7aac22 --- /dev/null +++ b/templates/repo/settings/lfs.tmpl @@ -0,0 +1,53 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.lfs_filelist"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <a class="ui tiny button" href="{{.Link}}/locks">{{ctx.Locale.Tr "repo.settings.lfs_locks"}}</a> + <a class="ui primary tiny button" href="{{.Link}}/pointers"> {{ctx.Locale.Tr "repo.settings.lfs_findpointerfiles"}}</a> + </div> + </h4> + <table id="lfs-files-table" class="ui attached segment single line table"> + <tbody> + {{range .LFSFiles}} + <tr> + <td> + <a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui brown button tw-font-mono"> + {{ShortSha .Oid}} + </a> + </td> + <td>{{ctx.Locale.TrSize .Size}}</td> + <td>{{TimeSince .CreatedUnix.AsTime ctx.Locale}}</td> + <td class="right aligned"> + <a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> + <button class="ui basic show-modal icon button red" data-modal="#delete-{{.Oid}}"> + <span class="btn-octicon btn-octicon-danger" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.delete_this_file"}}">{{svg "octicon-trash"}}</span> + </button> + </td> + </tr> + {{else}} + <tr> + <td colspan="4">{{ctx.Locale.Tr "repo.settings.lfs_no_lfs_files"}}</td> + </tr> + {{end}} + </tbody> + </table> + {{template "base/paginate" .}} + {{range .LFSFiles}} + <div class="ui g-modal-confirm modal" id="delete-{{.Oid}}"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.lfs_delete" .Oid}} + </div> + <div class="content"> + <p> + {{ctx.Locale.Tr "repo.settings.lfs_delete_warning"}} + </p> + <form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post"> + {{$.CsrfTokenHtml}} + {{template "base/modal_actions_confirm" (dict "ModalButtonColors" "primary")}} + </form> + </div> + </div> + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_file.tmpl b/templates/repo/settings/lfs_file.tmpl new file mode 100644 index 00000000..5bcd2af5 --- /dev/null +++ b/templates/repo/settings/lfs_file.tmpl @@ -0,0 +1,57 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="user-main-content twelve wide column content repository file list"> + <div class="tab-size-8 non-diff-file-content"> + <h4 class="ui top attached header"> + <a href="{{.LFSFilesLink}}">{{ctx.Locale.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.LFSFile.Oid}}</span> + <div class="ui right"> + {{if .EscapeStatus.Escaped}} + <a class="ui tiny basic button unescape-button tw-hidden">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</a> + <a class="ui tiny basic button escape-button">{{ctx.Locale.Tr "repo.escape_control_characters"}}</a> + {{end}} + <a class="ui primary tiny button" href="{{.LFSFilesLink}}/find?oid={{.LFSFile.Oid}}&size={{.LFSFile.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> + </div> + </h4> + <div class="ui bottom attached table unstackable segment"> + {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} + <div class="file-view{{if .IsMarkup}} markup {{.MarkupType}}{{else if .IsPlainText}} plain-text{{else if .IsTextFile}} code-view{{end}}"> + {{if .IsMarkup}} + {{if .FileContent}}{{.FileContent | SafeHTML}}{{end}} + {{else if .IsPlainText}} + <pre>{{if .FileContent}}{{.FileContent | SafeHTML}}{{end}}</pre> + {{else if not .IsTextFile}} + <div class="view-raw"> + {{if .IsImageFile}} + <img src="{{$.RawFileLink}}"> + {{else if .IsVideoFile}} + <video controls src="{{$.RawFileLink}}"> + <strong>{{ctx.Locale.Tr "repo.video_not_supported_in_browser"}}</strong> + </video> + {{else if .IsAudioFile}} + <audio controls src="{{$.RawFileLink}}"> + <strong>{{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}}</strong> + </audio> + {{else if .IsPDFFile}} + <div class="pdf-content is-loading" data-src="{{$.RawFileLink}}" data-fallback-button-text="{{ctx.Locale.Tr "diff.view_file"}}"></div> + {{else}} + <a href="{{$.RawFileLink}}" rel="nofollow">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> + {{end}} + </div> + {{else if .FileSize}} + <table> + <tbody> + <tr> + {{if .IsFileTooLarge}} + <td><strong>{{ctx.Locale.Tr "repo.file_too_large"}}</strong></td> + {{else}} + <td class="lines-num">{{.LineNums}}</td> + <td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol>{{.FileContent}}</ol></code></pre></td> + {{end}} + </tr> + </tbody> + </table> + {{end}} + </div> + </div> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_file_find.tmpl b/templates/repo/settings/lfs_file_find.tmpl new file mode 100644 index 00000000..809a028b --- /dev/null +++ b/templates/repo/settings/lfs_file_find.tmpl @@ -0,0 +1,46 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="user-main-content twelve wide column content repository file list"> + <div class="tab-size-8 non-diff-file-content"> + <h4 class="ui top attached header"> + <a href="{{.LFSFilesLink}}">{{ctx.Locale.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.Oid}}</span> + </h4> + <table id="lfs-files-find-table" class="ui attached segment single line table"> + <tbody> + {{range .Results}} + <tr> + <td> + {{svg "octicon-file"}} + <a href="{{$.RepoLink}}/src/commit/{{.SHA}}/{{PathEscapeSegments .Name}}" title="{{.Name}}">{{.Name}}</a> + </td> + <td class="message"> + <span class="truncate"> + <a href="{{$.RepoLink}}/commit/{{.SHA}}" title="{{.Summary}}"> + {{.Summary | RenderEmoji $.Context}} + </a> + </span> + </td> + <td> + <span class="text grey">{{svg "octicon-git-branch"}}{{.BranchName}}</span> + </td> + <td> + {{if .ParentHashes}} + {{ctx.Locale.Tr "repo.diff.parent"}} + {{range .ParentHashes}} + <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{.String}}">{{ShortSha .String}}</a> + {{end}} + {{end}} + {{ctx.Locale.Tr "repo.diff.commit"}} + <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{.SHA}}">{{ShortSha .SHA}}</a> + </td> + <td>{{TimeSince .When ctx.Locale}}</td> + </tr> + {{else}} + <tr> + <td colspan="5">{{ctx.Locale.Tr "repo.settings.lfs_lfs_file_no_commits"}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_locks.tmpl b/templates/repo/settings/lfs_locks.tmpl new file mode 100644 index 00000000..9a18f525 --- /dev/null +++ b/templates/repo/settings/lfs_locks.tmpl @@ -0,0 +1,56 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="user-main-content twelve wide column content repository file list"> + <div class="tab-size-8 non-diff-file-content"> + <h4 class="ui top attached header"> + <a href="{{.LFSFilesLink}}">{{ctx.Locale.Tr "repo.settings.lfs"}}</a> / {{ctx.Locale.Tr "repo.settings.lfs_locks"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty" method="post"> + {{$.CsrfTokenHtml}} + <div class="ui fluid action input"> + <input name="path" value="" placeholder="{{ctx.Locale.Tr "repo.settings.lfs_lock_path"}}" autofocus> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.lfs_lock"}}</button> + </div> + </form> + </div> + <table id="lfs-files-locks-table" class="ui attached segment single line table"> + <tbody> + {{range $index, $lock := .LFSLocks}} + <tr> + <td> + {{if index $.Linkable $index}} + {{svg "octicon-file"}} + <a href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments $.Repository.DefaultBranch}}/{{PathEscapeSegments $lock.Path}}" title="{{$lock.Path}}">{{$lock.Path}}</a> + {{else}} + {{svg "octicon-diff"}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.lfs_lock_file_no_exist"}}">{{$lock.Path}}</span> + {{end}} + {{if not (index $.Lockables $index)}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.lfs_noattribute"}}">{{svg "octicon-alert"}}</span> + {{end}} + </td> + <td> + <a href="{{$lock.Owner.HomeLink}}"> + {{ctx.AvatarUtils.Avatar $lock.Owner}} + {{$lock.Owner.DisplayName}} + </a> + </td> + <td>{{TimeSince .Created ctx.Locale}}</td> + <td class="right aligned"> + <form action="{{$.LFSFilesLink}}/locks/{{$lock.ID}}/unlock" method="post"> + {{$.CsrfTokenHtml}} + <button class="ui primary button"><span class="btn-octicon">{{svg "octicon-lock"}}</span>{{ctx.Locale.Tr "repo.settings.lfs_force_unlock"}}</button> + </form> + </td> + </tr> + {{else}} + <tr> + <td colspan="4">{{ctx.Locale.Tr "repo.settings.lfs_locks_no_locks"}}</td> + </tr> + {{end}} + </tbody> + </table> + {{template "base/paginate" .}} + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_pointers.tmpl b/templates/repo/settings/lfs_pointers.tmpl new file mode 100644 index 00000000..a0bb8c46 --- /dev/null +++ b/templates/repo/settings/lfs_pointers.tmpl @@ -0,0 +1,56 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.lfs_pointers.found" .NumPointers .NumAssociated .NumNotAssociated .NumNoExist}} + {{if gt .NumAssociatable 0}} + <div class="ui right"> + <form class="ui form" method="post" action="{{$.Link}}/associate"> + {{.CsrfTokenHtml}} + {{range .Pointers}} + {{if .Associatable}} + <input type="hidden" name="oid" value="{{.Oid}} {{.Size}}"> + {{end}} + {{end}} + <button class="ui primary tiny button">{{ctx.Locale.Tr "repo.settings.lfs_pointers.associateAccessible" $.NumAssociatable}}</button> + </form> + </div> + {{end}} + </h4> + <div class="ui attached segment"> + <table id="lfs-files-table" class="ui fixed single line table"> + <thead> + <tr> + <th class="three wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.sha"}}</th> + <th class="four wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.oid"}}</th> + <th class="two wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.inRepo"}}</th> + <th class="two wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.exists"}}</th> + <th class="two wide" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.lfs_pointers.accessible"}}">{{ctx.Locale.Tr "repo.settings.lfs_pointers.accessible"}}</th> + <th class="three wide"></th> + </tr> + </thead> + <tbody> + {{range .Pointers}} + <tr> + <td> + <a href="{{$.RepoLink}}/raw/blob/{{.SHA}}" rel="nofollow" target="_blank" title="{{.SHA}}" class="ui button tw-font-mono"> + {{ShortSha .SHA}} + </a> + </td> + <td> + <a {{if and .Exists .InRepo}}href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank"{{end}} title="{{.Oid}}" class="ui brown button tw-font-mono"> + {{ShortSha .Oid}} + </a> + </td> + <td>{{if .InRepo}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if .Exists}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if .Accessible}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td class="tw-text-right"> + <a class="ui primary button" href="{{$.LFSFilesLink}}/find?oid={{.Oid}}&size={{.Size}}&sha={{.SHA}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> + </td> + </tr> + {{end}} + </tbody> + </table> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl new file mode 100644 index 00000000..df5ba3ab --- /dev/null +++ b/templates/repo/settings/navbar.tmpl @@ -0,0 +1,72 @@ +<div class="flex-container-nav"> + <div class="ui fluid vertical menu"> + <div class="header item">{{ctx.Locale.Tr "repo.settings"}}</div> + <a class="{{if .PageIsSettingsOptions}}active {{end}}item" href="{{.RepoLink}}/settings"> + {{ctx.Locale.Tr "repo.settings.options"}} + </a> + <details class="item toggleable-item" {{if .PageIsRepoSettingsUnits}}open{{end}}> + <summary class="item{{if .PageIsRepoSettingsUnits}} active{{end}}">{{ctx.Locale.Tr "repo.settings.units.units"}}</summary> + <div class="menu"> + <a class="item" href="{{.RepoLink}}/settings/units#overview"> + {{ctx.Locale.Tr "repo.settings.units.overview"}} + </a> + <a class="item" href="{{.RepoLink}}/settings/units#issues"> + {{ctx.Locale.Tr "repo.issues"}} + </a> + <a class="item" href="{{.RepoLink}}/settings/units#pulls"> + {{ctx.Locale.Tr "repo.pulls"}} + </a> + <a class="item" href="{{.RepoLink}}/settings/units#wiki"> + {{ctx.Locale.Tr "repo.wiki"}} + </a> + </div> + </details> + <a class="{{if .PageIsSettingsCollaboration}}active {{end}}item" href="{{.RepoLink}}/settings/collaboration"> + {{ctx.Locale.Tr "repo.settings.collaboration"}} + </a> + {{if not DisableWebhooks}} + <a class="{{if .PageIsSettingsHooks}}active {{end}}item" href="{{.RepoLink}}/settings/hooks"> + {{ctx.Locale.Tr "repo.settings.hooks"}} + </a> + {{end}} + {{if .Repository.UnitEnabled $.Context $.UnitTypeCode}} + {{if not .Repository.IsEmpty}} + <a class="{{if .PageIsSettingsBranches}}active {{end}}item" href="{{.RepoLink}}/settings/branches"> + {{ctx.Locale.Tr "repo.settings.branches"}} + </a> + {{end}} + <a class="{{if .PageIsSettingsTags}}active {{end}}item" href="{{.RepoLink}}/settings/tags"> + {{ctx.Locale.Tr "repo.settings.tags"}} + </a> + {{if .SignedUser.CanEditGitHook}} + <a class="{{if .PageIsSettingsGitHooks}}active {{end}}item" href="{{.RepoLink}}/settings/hooks/git"> + {{ctx.Locale.Tr "repo.settings.githooks"}} + </a> + {{end}} + <a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{.RepoLink}}/settings/keys"> + {{ctx.Locale.Tr "repo.settings.deploy_keys"}} + </a> + {{if .LFSStartServer}} + <a class="{{if .PageIsSettingsLFS}}active {{end}}item" href="{{.RepoLink}}/settings/lfs"> + {{ctx.Locale.Tr "repo.settings.lfs"}} + </a> + {{end}} + {{end}} + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} + <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables}}open{{end}}> + <summary>{{ctx.Locale.Tr "actions.actions"}}</summary> + <div class="menu"> + <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{.RepoLink}}/settings/actions/runners"> + {{ctx.Locale.Tr "actions.runners"}} + </a> + <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{.RepoLink}}/settings/actions/secrets"> + {{ctx.Locale.Tr "secrets.secrets"}} + </a> + <a class="{{if .PageIsSharedSettingsVariables}}active {{end}}item" href="{{.RepoLink}}/settings/actions/variables"> + {{ctx.Locale.Tr "actions.variables"}} + </a> + </div> + </details> + {{end}} + </div> +</div> diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl new file mode 100644 index 00000000..affb7dad --- /dev/null +++ b/templates/repo/settings/options.tmpl @@ -0,0 +1,782 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}} + <div class="user-main-content twelve wide column"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.basic_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="update"> + <div class="required field {{if .Err_RepoName}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.repo_size"}}</label> + <span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString ctx.Locale}}"{{end}}>{{ctx.Locale.TrSize .Repository.Size}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.template"}}</label> + <div class="ui checkbox"> + <input name="template" type="checkbox" {{if .Repository.IsTemplate}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template_helper"}}</label> + </div> + </div> + {{if not .Repository.IsFork}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox" {{if and (not .Repository.IsPrivate) (gt .Repository.NumStars 0)}}data-tooltip-content="{{ctx.Locale.Tr "repo.stars_remove_warning"}}"{{end}}> + {{if .IsAdmin}} + <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}> + {{else}} + <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} disabled{{end}}> + {{if and .Repository.IsPrivate $.ForcePrivate}}<input type="hidden" name="private" value="{{.Repository.IsPrivate}}">{{end}} + {{end}} + <label>{{ctx.Locale.Tr "repo.visibility_helper"}} {{if .Repository.NumForks}}<span class="text red">{{ctx.Locale.Tr "repo.visibility_fork_helper"}}</span>{{end}}</label> + </div> + </div> + {{end}} + <div class="field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" rows="2" maxlength="2048">{{.Repository.Description}}</textarea> + </div> + <div class="field {{if .Err_Website}}error{{end}}"> + <label for="website">{{ctx.Locale.Tr "repo.settings.site"}}</label> + <input id="website" name="website" type="url" maxlength="1024" value="{{.Repository.Website}}"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + + <div class="divider"></div> + <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label> + <input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button> + <button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button> + </div> + </form> + </div> + + {{if FederationEnabled}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.federation_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="federation"> + <div class="field {{if .Err_FollowingRepos}}error{{end}}"> + <p>{{ctx.Locale.Tr "repo.settings.federation_apapiurl"}}</p> + <p><b>{{.RepositoryAPActorID}}</b></p> + <div class="divider"></div> + <label for="following_repos">{{ctx.Locale.Tr "repo.settings.federation_following_repos"}}</label> + <input id="following_repos" name="following_repos" value="{{.FollowingRepos}}"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + </div> + {{end}} + + {{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}} + {{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}} + {{$showMirrorSettings := and (.Repository.UnitEnabled $.Context $.UnitTypeCode) (or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors)}} + {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} + {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} + {{$existingPushMirror := or .Repository.IsMirror .PushMirrors}} + {{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}} + {{$isWorkingPullMirror := .PullMirror}} + + {{if $showMirrorSettings}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.mirror_settings"}} + </h4> + <div class="ui attached segment"> + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{ctx.Locale.Tr "repo.settings.archive.mirrors_unavailable"}} + </div> + {{else}} + {{if $newMirrorsEntirelyEnabled}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pushing-to-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br> + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section"}}</a><br> + {{else if $onlyNewPushMirrorsEnabled}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br> + {{else if $onlyNewPullMirrorsEnabled}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br> + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} + {{if $existingPushMirror}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}} + {{end}} + {{else}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}<br> + {{end}} + + {{if .Repository.IsMirror}} + <table class="ui table"> + <thead> + <tr> + <th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th> + <th></th> + </tr> + </thead> + {{if $modifyBrokenPullMirror}} + {{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}} + <tbody> + <tr> + <td colspan="4"> + <div class="text red tw-py-4">{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}</div> + </td> + </tr> + </tbody> + {{else if $isWorkingPullMirror}} + <tbody> + <tr> + <td>{{.PullMirror.RemoteAddress}}</td> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td> + <td>{{DateTime "full" .PullMirror.UpdatedUnix}}</td> + <td class="right aligned"> + <form method="post" class="tw-inline-block"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="mirror-sync"> + <button class="ui primary tiny button inline">{{ctx.Locale.Tr "repo.settings.sync_mirror"}}</button> + </form> + </td> + </tr> + <tr> + <td colspan="4"> + <form class="ui form" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="mirror"> + <div class="inline field {{if .Err_EnablePrune}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.mirror_prune"}}</label> + <div class="ui checkbox"> + <input id="enable_prune" name="enable_prune" type="checkbox" {{if .PullMirror.EnablePrune}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.mirror_prune_desc"}}</label> + </div> + </div> + <div class="inline field {{if .Err_Interval}}error{{end}}"> + <label for="interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> + <input id="interval" name="interval" value="{{.PullMirror.Interval}}"> + </div> + {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName}} + <div class="field {{if .Err_MirrorAddress}}error{{end}}"> + <label for="mirror_address">{{ctx.Locale.Tr "repo.mirror_address"}}</label> + <input id="mirror_address" name="mirror_address" value="{{$address.Address}}" required> + <p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p> + </div> + <details class="ui optional field" {{if or .Err_Auth $address.Username}}open{{end}}> + <summary class="tw-p-1"> + {{ctx.Locale.Tr "repo.need_auth"}} + </summary> + <div class="tw-p-1"> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="mirror_username">{{ctx.Locale.Tr "username"}}</label> + <input id="mirror_username" name="mirror_username" value="{{$address.Username}}" {{if not .mirror_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="mirror_password">{{ctx.Locale.Tr "password"}}</label> + <input id="mirror_password" name="mirror_password" type="password" placeholder="{{if $address.Password}}{{ctx.Locale.Tr "repo.mirror_password_placeholder"}}{{else}}{{ctx.Locale.Tr "repo.mirror_password_blank_placeholder"}}{{end}}" value="" {{if not .mirror_password}}data-need-clear="true"{{end}} autocomplete="off"> + </div> + <p class="help">{{ctx.Locale.Tr "repo.mirror_password_help"}}</p> + </div> + </details> + + {{if .LFSStartServer}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.mirror_lfs"}}</label> + <div class="ui checkbox"> + <input id="mirror_lfs" name="mirror_lfs" type="checkbox" {{if .PullMirror.LFS}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.mirror_lfs_desc"}}</label> + </div> + </div> + <div class="field {{if .Err_LFSEndpoint}}error{{end}}"> + <label for="mirror_lfs_endpoint">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}</label> + <input id="mirror_lfs_endpoint" name="mirror_lfs_endpoint" value="{{.PullMirror.LFSEndpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}"> + <p class="help">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery"}}</p> + </div> + {{end}} + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_mirror_settings"}}</button> + </div> + </form> + </td> + </tr> + </tbody> + {{end}}{{/* end if: $modifyBrokenPullMirror / $isWorkingPullMirror */}} + </table> + {{end}}{{/* end if .Repository.IsMirror */}} + + <table class="ui table"> + <thead> + <tr> + <th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.pushed_repository"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th> + <th></th> + </tr> + </thead> + <tbody> + {{range .PushMirrors}} + <tr> + <td class="tw-break-anywhere">{{.RemoteAddress}}</td> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td> + <td>{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td> + <td class="right aligned"> + <button + class="ui tiny button show-modal" + data-modal="#push-mirror-edit-modal" + data-tooltip-content="{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}" + data-modal-push-mirror-edit-id="{{.ID}}" + data-modal-push-mirror-edit-interval="{{.Interval}}" + data-modal-push-mirror-edit-address="{{.RemoteAddress}}" + > + {{svg "octicon-pencil" 14}} + </button> + <form method="post" class="tw-inline-block"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-sync"> + <input type="hidden" name="push_mirror_id" value="{{.ID}}"> + <button class="ui primary tiny button" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.sync_mirror"}}">{{svg "octicon-sync" 14}}</button> + </form> + <form method="post" class="tw-inline-block"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-remove"> + <input type="hidden" name="push_mirror_id" value="{{.ID}}"> + <button class="ui basic red tiny button" data-tooltip-content="{{ctx.Locale.Tr "remove"}}">{{svg "octicon-trash" 14}}</button> + </form> + </td> + </tr> + {{else}} + <tr> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}</td> + </tr> + {{end}} + {{if (not .DisableNewPushMirrors)}} + <tr> + <td colspan="4"> + <form class="ui form" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-add"> + <div class="field {{if .Err_PushMirrorAddress}}error{{end}}"> + <label for="push_mirror_address">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.remote_url"}}</label> + <input id="push_mirror_address" name="push_mirror_address" value="{{.push_mirror_address}}" required> + <p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p> + </div> + <details class="ui optional field" {{if or .Err_PushMirrorAuth .push_mirror_username}}open{{end}}> + <summary class="tw-p-1"> + {{ctx.Locale.Tr "repo.need_auth"}} + </summary> + <div class="tw-p-1"> + <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> + <label for="push_mirror_username">{{ctx.Locale.Tr "username"}}</label> + <input id="push_mirror_username" name="push_mirror_username" value="{{.push_mirror_username}}"> + </div> + <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> + <label for="push_mirror_password">{{ctx.Locale.Tr "password"}}</label> + <input id="push_mirror_password" name="push_mirror_password" type="password" value="{{.push_mirror_password}}" autocomplete="off"> + </div> + </div> + </details> + <div class="field"> + <div class="ui checkbox"> + <input id="push_mirror_sync_on_commit" name="push_mirror_sync_on_commit" type="checkbox" {{if .push_mirror_sync_on_commit}}checked{{end}}> + <label for="push_mirror_sync_on_commit">{{ctx.Locale.Tr "repo.mirror_sync_on_commit"}}</label> + </div> + </div> + <div class="inline field {{if .Err_PushMirrorInterval}}error{{end}}"> + <label for="push_mirror_interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> + <input id="push_mirror_interval" name="push_mirror_interval" value="{{if .push_mirror_interval}}{{.push_mirror_interval}}{{else}}{{.DefaultMirrorInterval}}{{end}}"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.add"}}</button> + </div> + </form> + </td> + </tr> + {{end}} + </tbody> + </table> + {{end}} + </div> + {{end}} + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.signing_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="signing"> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.trust_model"}}</label><br> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" id="trust_model_default" name="trust_model" {{if eq .Repository.TrustModel.String "default"}}checked="checked"{{end}} value="default"> + <label for="trust_model_default">{{ctx.Locale.Tr "repo.settings.trust_model.default"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.default.desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" id="trust_model_collaborator" name="trust_model" {{if eq .Repository.TrustModel.String "collaborator"}}checked="checked"{{end}} value="collaborator"> + <label for="trust_model_collaborator">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.long"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" name="trust_model" id="trust_model_committer" {{if eq .Repository.TrustModel.String "committer"}}checked="checked"{{end}} value="committer"> + <label for="trust_model_committer">{{ctx.Locale.Tr "repo.settings.trust_model.committer.long"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.committer.desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" name="trust_model" id="trust_model_collaboratorcommitter" {{if eq .Repository.TrustModel.String "collaboratorcommitter"}}checked="checked"{{end}} value="collaboratorcommitter"> + <label for="trust_model_collaboratorcommitter">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.long"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}</p> + </div> + </div> + </div> + + <div class="divider"></div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + </div> + + {{if .IsAdmin}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.admin_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="admin"> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_health_check" type="checkbox" {{if .Repository.IsFsckEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.admin_enable_health_check"}}</label> + </div> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + + <div class="divider"></div> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="admin_index"> + {{if .CodeIndexerEnabled}} + <h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_code_indexer"}}</h4> + <div class="inline fields"> + <label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label> + <span class="field"> + {{if .CodeIndexerStatus}} + <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.CodeIndexerStatus.CommitSha}}"> + <span class="shortsha">{{ShortSha .CodeIndexerStatus.CommitSha}}</span> + </a> + {{else}} + <span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span> + {{end}} + </span> + <div class="field"> + <button class="ui primary button" name="request_reindex_type" value="code">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button> + </div> + </div> + {{end}} + <h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_stats_indexer"}}</h4> + <div class="inline fields"> + {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} + <label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label> + {{end}} + <span class="field"> + {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} + <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.StatsIndexerStatus.CommitSha}}"> + <span class="shortsha">{{ShortSha .StatsIndexerStatus.CommitSha}}</span> + </a> + {{else}} + <span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span> + {{end}} + </span> + <div class="field"> + <button class="ui primary button" name="request_reindex_type" value="stats">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button> + </div> + </div> + </form> + </div> + {{end}} + + {{if .Permission.IsOwner}} + <h4 class="ui top attached error header"> + {{ctx.Locale.Tr "repo.settings.danger_zone"}} + </h4> + <div class="ui attached error danger segment"> + <div class="flex-list"> + {{if .Repository.IsMirror}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#convert-mirror-repo-modal">{{ctx.Locale.Tr "repo.settings.convert"}}</button> + </div> + </div> + {{end}} + {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_fork_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#convert-fork-repo-modal">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</button> + </div> + </div> + {{end}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.transfer.title"}}</div> + <div class="flex-item-body"> + {{if .RepoTransfer}} + {{ctx.Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}} + {{else}} + {{ctx.Locale.Tr "repo.settings.transfer_desc"}} + {{end}} + </div> + </div> + <div class="flex-item-trailing"> + {{if .RepoTransfer}} + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="cancel_transfer"> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_abort"}}</button> + </form> + {{else}} + <button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{ctx.Locale.Tr "repo.settings.transfer.button"}}</button> + {{end}} + </div> + </div> + {{if .Permission.CanRead $.UnitTypeWiki}} + {{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_desc" .DefaultWikiBranchName}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#rename-wiki-branch-modal">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}</button> + </div> + </div> + {{end}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_delete_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#delete-wiki-modal">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</button> + </div> + </div> + {{end}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.delete"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.delete_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{ctx.Locale.Tr "repo.settings.delete"}}</button> + </div> + </div> + {{if not .Repository.IsMirror}} + <div class="flex-item tw-items-center"> + <div class="flex-item-main"> + {{if .Repository.IsArchived}} + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.unarchive.header"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.unarchive.text"}}</div> + {{else}} + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.archive.header"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.archive.text"}}</div> + {{end}} + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#archive-repo-modal"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.button"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.button"}} + {{end}} + </button> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} + +{{if .Permission.IsOwner}} + {{if .Repository.IsMirror}} + <div class="ui small modal" id="convert-mirror-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.convert"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.convert_notices_1"}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="convert"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required maxlength="100"> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_confirm"}}</button> + </div> + </form> + </div> + </div> + {{end}} + {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + <div class="ui small modal" id="convert-fork-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.convert_fork"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.convert_fork_notices_1"}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="convert_fork"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_fork_confirm"}}</button> + </div> + </form> + </div> + </div> + {{end}} + <div class="ui small modal" id="transfer-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.transfer.modal.title"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.transfer_notices_1"}} <br> + {{ctx.Locale.Tr "repo.settings.transfer_notices_2"}} <br> + {{ctx.Locale.Tr "repo.settings.transfer_notices_3"}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="transfer"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + <div class="required field"> + <label for="new_owner_name">{{ctx.Locale.Tr "repo.settings.transfer_owner"}}</label> + <input id="new_owner_name" name="new_owner_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_perform"}}</button> + </div> + </form> + </div> + </div> + + <div class="ui small modal" id="delete-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.delete"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br> + {{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName}} + {{if .Repository.NumForks}}<br> + {{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}} + {{end}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="delete"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label for="repo_name_to_delete">{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input id="repo_name_to_delete" name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button> + </div> + </form> + </div> + </div> + + {{if .Repository.UnitEnabled $.Context $.UnitTypeWiki}} + <div class="ui small modal" id="delete-wiki-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.wiki_delete"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br> + {{ctx.Locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="delete-wiki"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_delete"}}</button> + </div> + </form> + </div> + </div> + {{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}} + <div class="ui small modal" id="rename-wiki-branch-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}} + </div> + <div class="content"> + <div class="ui warning message"> + <ul> + <li>{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_notices_1"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_notices_2" .Repository.Name}}</li> + </ul> + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="rename-wiki-branch"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_branch_rename"}}</button> + </div> + </form> + </div> + </div> + {{end}} + {{end}} + + {{if not .Repository.IsMirror}} + <div class="ui g-modal-confirm modal" id="archive-repo-modal"> + <div class="header"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.header"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.header"}} + {{end}} + </div> + <div class="content"> + <div class="ui warning message"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.text"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.text"}} + {{end}} + </div> + <form action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="{{if .Repository.IsArchived}}unarchive{{else}}archive{{end}}"> + <input type="hidden" name="repo_id" value="{{.Repository.ID}}"> + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.button"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.button"}} + {{end}} + </button> + </div> + </form> + </div> + </div> + {{end}} +{{end}} + +{{template "repo/settings/push_mirror_sync_modal" .}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl new file mode 100644 index 00000000..a991e68e --- /dev/null +++ b/templates/repo/settings/protected_branch.tmpl @@ -0,0 +1,279 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings branches")}} + <div class="repo-setting-content"> + <form class="ui form" action="{{.Link}}" method="post"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}} + </h4> + <div class="ui attached segment branch-protection"> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.protect_patterns"}}</h5> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern"}}</label> + <input name="rule_name" type="text" value="{{.Rule.RuleName}}"> + <input name="rule_id" type="hidden" value="{{.Rule.ID}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern_desc"}}</p> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_protected_file_patterns"}}</label> + <input name="protected_file_patterns" type="text" value="{{.Rule.ProtectedFilePatterns}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_protected_file_patterns_desc"}}</p> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_unprotected_file_patterns"}}</label> + <input name="unprotected_file_patterns" type="text" value="{{.Rule.UnprotectedFilePatterns}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_unprotected_file_patterns_desc"}}</p> + </div> + + {{.CsrfTokenHtml}} + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_push"}}</h5> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_push" type="radio" value="none" class="toggle-target-disabled" data-target="#whitelist_box" {{if not .Rule.CanPush}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_disable_push"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_disable_push_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_push" type="radio" value="all" class="toggle-target-disabled" data-target="#whitelist_box" {{if and (.Rule.CanPush) (not .Rule.EnableWhitelist)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_enable_push"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_enable_push_desc"}}</p> + </div> + </div> + <div class="grouped fields"> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_push" type="radio" value="whitelist" class="toggle-target-enabled" data-target="#whitelist_box" {{if and (.Rule.CanPush) (.Rule.EnableWhitelist)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_committers"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_whitelist_committers_desc"}}</p> + </div> + </div> + <div id="whitelist_box" class="grouped fields {{if not .Rule.EnableWhitelist}}disabled{{end}}"> + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="whitelist_users" value="{{.whitelist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="whitelist_teams" value="{{.whitelist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + <div class="checkbox-sub-item field"> + <div class="ui checkbox"> + <input type="checkbox" name="whitelist_deploy_keys" {{if .Rule.WhitelistDeployKeys}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_deploy_keys"}}</label> + </div> + </div> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="require_signed_commits" type="checkbox" {{if .Rule.RequireSignedCommits}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.require_signed_commits"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.require_signed_commits_desc"}}</p> + </div> + </div> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_pull_request_approvals"}}</h5> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_required_approvals"}}</label> + <input name="required_approvals" type="number" value="{{.Rule.RequiredApprovals}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_required_approvals_desc"}}</p> + </div> + <div class="grouped fields"> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_approvals_whitelist" type="checkbox" class="toggle-target-enabled" data-target="#approvals_whitelist_box" {{if .Rule.EnableApprovalsWhitelist}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_enabled"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_enabled_desc"}}</p> + </div> + </div> + <div id="approvals_whitelist_box" class="grouped fields {{if not .Rule.EnableApprovalsWhitelist}}disabled{{end}}"> + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="approvals_whitelist_users" value="{{.approvals_whitelist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="approvals_whitelist_teams" value="{{.approvals_whitelist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input id="dismiss_stale_approvals" name="dismiss_stale_approvals" type="checkbox" {{if .Rule.DismissStaleApprovals}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.dismiss_stale_approvals"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.dismiss_stale_approvals_desc"}}</p> + </div> + </div> + <div id="ignore_stale_approvals_box" class="field {{if .Rule.DismissStaleApprovals}}disabled{{end}}"> + <div class="ui checkbox"> + <input id="ignore_stale_approvals" name="ignore_stale_approvals" type="checkbox" {{if .Rule.IgnoreStaleApprovals}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.ignore_stale_approvals"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.ignore_stale_approvals_desc"}}</p> + </div> + </div> + <div class="grouped fields"> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_status_check" type="checkbox" class="toggle-target-enabled" data-target="#statuscheck_contexts_box" {{if .Rule.EnableStatusCheck}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_check_status_contexts"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_check_status_contexts_desc"}}</p> + </div> + </div> + <div id="statuscheck_contexts_box" class="checkbox-sub-item field {{if not .Rule.EnableStatusCheck}}disabled{{end}}"> + <label>{{ctx.Locale.Tr "repo.settings.protect_status_check_patterns"}}</label> + <textarea id="status_check_contexts" name="status_check_contexts" rows="3">{{.status_check_contexts}}</textarea> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_status_check_patterns_desc"}}</p> + <table class="ui celled table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "repo.settings.protect_check_status_contexts_list"}}</th> + </tr> + </thead> + <tbody> + {{range $.recent_status_checks}} + <tr> + <td> + <span>{{.}}</span> + <span class="status-check-matched-mark tw-hidden" data-status-check="{{.}}">{{ctx.Locale.Tr "repo.settings.protect_status_check_matched"}}</span> + </td> + </tr> + {{else}} + <tr><td>-</td></tr> + {{end}} + </tbody> + </table> + </div> + </div> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_pull_request_merge"}}</h5> + <div class="grouped fields"> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_merge_whitelist" type="radio" value="false" class="toggle-target-disabled" data-target="#merge_whitelist_box" {{if not .Rule.EnableMergeWhitelist}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_enable_merge"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_enable_merge_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_merge_whitelist" type="radio" value="true" class="toggle-target-enabled" data-target="#merge_whitelist_box" {{if .Rule.EnableMergeWhitelist}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_committers"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_committers_desc"}}</p> + </div> + </div> + <div id="merge_whitelist_box" class="grouped fields {{if not .Rule.EnableMergeWhitelist}}disabled{{end}}"> + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="merge_whitelist_users" value="{{.merge_whitelist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="merge_whitelist_teams" value="{{.merge_whitelist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="block_on_rejected_reviews" type="checkbox" {{if .Rule.BlockOnRejectedReviews}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.block_rejected_reviews"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.block_rejected_reviews_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="block_on_official_review_requests" type="checkbox" {{if .Rule.BlockOnOfficialReviewRequests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.block_on_official_review_requests"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.block_on_official_review_requests_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="block_on_outdated_branch" type="checkbox" {{if .Rule.BlockOnOutdatedBranch}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.block_outdated_branch"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.block_outdated_branch_desc"}}</p> + </div> + </div> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_pull_request_enforcement"}}</h5> + <div class="field"> + <div class="ui checkbox"> + <input name="apply_to_admins" type="checkbox" {{if .Rule.ApplyToAdmins}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.enforce_on_admins"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.enforce_on_admins_desc"}}</p> + </div> + </div> + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.protected_branch.save_rule"}}</button> + </div> + </div> + </form> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/push_mirror_sync_modal.tmpl b/templates/repo/settings/push_mirror_sync_modal.tmpl new file mode 100644 index 00000000..e8dad61a --- /dev/null +++ b/templates/repo/settings/push_mirror_sync_modal.tmpl @@ -0,0 +1,32 @@ +<div class="ui small modal" id="push-mirror-edit-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}} + </div> + <div class="content"> + <form class="ui form ignore-dirty" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-update"> + <input type="hidden" name="push_mirror_id" id="push-mirror-edit-id"> + <div class="field"> + <label for="name">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label> + <div class="ui small input"> + <input id="push-mirror-edit-address" readonly> + </div> + </div> + <div class="inline field"> + <label for="push-mirror-edit-interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> + <input id="push-mirror-edit-interval" name="push_mirror_interval" autofocus> + </div> + <div class="actions"> + <button class="ui small basic cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "cancel"}} + </button> + <button class="ui primary small approve button"> + {{svg "fontawesome-save"}} + {{ctx.Locale.Tr "save"}} + </button> + </div> + </form> + </div> +</div> diff --git a/templates/repo/settings/runner_edit.tmpl b/templates/repo/settings/runner_edit.tmpl new file mode 100644 index 00000000..8b76aead --- /dev/null +++ b/templates/repo/settings/runner_edit.tmpl @@ -0,0 +1,5 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings runners")}} + <div class="repo-setting-content"> + {{template "shared/actions/runner_edit" .}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/secrets.tmpl b/templates/repo/settings/secrets.tmpl new file mode 100644 index 00000000..0b89639e --- /dev/null +++ b/templates/repo/settings/secrets.tmpl @@ -0,0 +1,5 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings")}} + <div class="repo-setting-content"> + {{template "shared/secrets/add_list" .}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl new file mode 100644 index 00000000..c9efb7b6 --- /dev/null +++ b/templates/repo/settings/tags.tmpl @@ -0,0 +1,126 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings edit")}} + <div class="repo-setting-content"> + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{ctx.Locale.Tr "repo.settings.archive.tagsettings_unavailable"}} + </div> + {{else}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.tags.protection"}} + </h4> + + <div class="ui attached segment"> + <div class="ui grid"> + <div class="sixteen wide column"> + <div class="ui segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.tags.protection.pattern"}}</label> + <div id="search-tag-box" class="ui search"> + <div class="ui input"> + <input class="prompt" name="name_pattern" autocomplete="off" value="{{.name_pattern}}" placeholder="v*" autofocus required> + </div> + <div class="help">{{ctx.Locale.Tr "repo.settings.tags.protection.pattern.description"}}</div> + </div> + </div> + <div class="whitelist field"> + <label>{{ctx.Locale.Tr "repo.settings.tags.protection.allowed.users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="allowlist_users" value="{{.allowlist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="whitelist field"> + <label>{{ctx.Locale.Tr "repo.settings.tags.protection.allowed.teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="allowlist_teams" value="{{.allowlist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + <div class="field"> + {{if .PageIsEditProtectedTag}} + <button class="ui primary button"> + {{ctx.Locale.Tr "save"}} + </button> + <a class="ui primary button" href="{{$.RepoLink}}/settings/tags"> + {{ctx.Locale.Tr "cancel"}} + </a> + {{else}} + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.settings.tags.protection.create"}} + </button> + {{end}} + </div> + </form> + </div> + </div> + + <div class="sixteen wide column"> + <table class="ui single line table"> + <thead> + <th>{{ctx.Locale.Tr "repo.settings.tags.protection.pattern"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.tags.protection.allowed"}}</th> + <th></th> + </thead> + <tbody> + {{range .ProtectedTags}} + <tr> + <td><pre>{{.NamePattern}}</pre></td> + <td> + {{if or .AllowlistUserIDs (and $.Owner.IsOrganization .AllowlistTeamIDs)}} + {{$userIDs := .AllowlistUserIDs}} + {{range $.Users}} + {{if SliceUtils.Contains $userIDs .ID}} + <a class="ui basic label" href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 26}} {{.GetDisplayName}}</a> + {{end}} + {{end}} + {{if $.Owner.IsOrganization}} + {{$teamIDs := .AllowlistTeamIDs}} + {{range $.Teams}} + {{if SliceUtils.Contains $teamIDs .ID}} + <a class="ui basic label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a> + {{end}} + {{end}} + {{end}} + {{else}} + {{ctx.Locale.Tr "repo.settings.tags.protection.allowed.noone"}} + {{end}} + </td> + <td class="right aligned"> + <a class="ui tiny primary button" href="{{$.RepoLink}}/settings/tags/{{.ID}}">{{ctx.Locale.Tr "edit"}}</a> + <form class="tw-inline-block" action="{{$.RepoLink}}/settings/tags/delete" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{.ID}}"> + <button class="ui tiny red button">{{ctx.Locale.Tr "remove"}}</button> + </form> + </td> + </tr> + {{else}} + <tr class="center aligned"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr> + {{end}} + </tbody> + </table> + </div> + </div> + </div> + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/units.tmpl b/templates/repo/settings/units.tmpl new file mode 100644 index 00000000..66ed0359 --- /dev/null +++ b/templates/repo/settings/units.tmpl @@ -0,0 +1,13 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}} +<div class="user-main-content twelve wide column"> + <form class="ui form" method="post" action="{{.RepoLink}}/settings/units"> + {{.CsrfTokenHtml}} + {{template "repo/settings/units/overview" .}} + {{template "repo/settings/units/issues" .}} + {{if not .IsMirror}} + {{template "repo/settings/units/pulls" .}} + {{end}} + {{template "repo/settings/units/wiki" .}} + </form> +</div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/units/issues.tmpl b/templates/repo/settings/units/issues.tmpl new file mode 100644 index 00000000..b4217ddf --- /dev/null +++ b/templates/repo/settings/units/issues.tmpl @@ -0,0 +1,102 @@ +<h4 class="ui top attached header" id="issues"> + {{ctx.Locale.Tr "repo.issues"}} +</h4> +<div class="ui attached segment"> + {{$isIssuesEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeIssues) (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}} + {{$isIssuesGlobalDisabled := .UnitTypeIssues.UnitGlobalDisabled}} + {{$isExternalTrackerGlobalDisabled := .UnitTypeExternalTracker.UnitGlobalDisabled}} + {{$isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.issues"}}</label> + <div class="ui checkbox{{if $isIssuesAndExternalGlobalDisabled}} disabled{{end}}"{{if $isIssuesAndExternalGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if $isIssuesEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.issues_desc"}}</label> + </div> + </div> + <div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box"> + <div class="field"> + <div class="ui radio checkbox{{if $isIssuesGlobalDisabled}} disabled{{end}}"{{if $isIssuesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_internal_issue_tracker"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}disabled{{end}}" id="internal_issue_box"> + {{if .Repository.CanEnableTimetracker}} + <div class="field"> + <div class="ui checkbox"> + <input name="enable_timetracker" class="enable-system" data-target="#only_contributors" type="checkbox" {{if .Repository.IsTimetrackerEnabled $.Context}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.enable_timetracker"}}</label> + </div> + </div> + <div class="field {{if not (.Repository.IsTimetrackerEnabled $.Context)}}disabled{{end}}" id="only_contributors"> + <div class="ui checkbox"> + <input name="allow_only_contributors_to_track_time" type="checkbox" {{if .Repository.AllowOnlyContributorsToTrackTime $.Context}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.allow_only_contributors_to_track_time"}}</label> + </div> + </div> + {{end}} + <div class="field"> + <div class="ui checkbox"> + <input name="enable_issue_dependencies" type="checkbox" {{if (.Repository.IsDependenciesEnabled $.Context)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.issues.dependency.setting"}}</label> + </div> + </div> + <div class="ui checkbox"> + <input name="enable_close_issues_via_commit_in_any_branch" type="checkbox" {{if .Repository.CloseIssuesViaCommitInAnyBranch}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.admin_enable_close_issues_via_commit_in_any_branch"}}</label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox{{if $isExternalTrackerGlobalDisabled}} disabled{{end}}"{{if $isExternalTrackerGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_external_issue_tracker"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}disabled{{end}}" id="external_issue_box"> + <div class="field"> + <label for="external_tracker_url">{{ctx.Locale.Tr "repo.settings.external_tracker_url"}}</label> + <input id="external_tracker_url" name="external_tracker_url" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerURL}}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.external_tracker_url_desc"}}</p> + </div> + <div class="field"> + <label for="tracker_url_format">{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}</label> + <input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="https://github.com/{user}/{repo}/issues/{index}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc"}}</p> + </div> + <div class="inline fields"> + <label for="issue_style">{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}</label> + <div class="field"> + <div class="ui radio checkbox"> + {{$externalTracker := (.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker)}} + {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} + <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="numeric" {{if eq $externalTrackerStyle "numeric"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.numeric"}} <span class="ui light grey text">#1234</span></label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="alphanumeric" {{if eq $externalTrackerStyle "alphanumeric"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.alphanumeric"}} <span class="ui light grey text">ABC-123 , DEFG-234</span></label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="regexp" {{if eq $externalTrackerStyle "regexp"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp"}} <span class="ui light grey text">(ISSUE-\d+) , ISSUE-(\d+)</span></label> + </div> + </div> + </div> + <div class="field {{if ne $externalTrackerStyle "regexp"}}disabled{{end}}" id="tracker-issue-style-regex-box"> + <label for="external_tracker_regexp_pattern">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}</label> + <input id="external_tracker_regexp_pattern" name="external_tracker_regexp_pattern" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerRegexpPattern}}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc"}}</p> + </div> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/units/overview.tmpl b/templates/repo/settings/units/overview.tmpl new file mode 100644 index 00000000..a851c66d --- /dev/null +++ b/templates/repo/settings/units/overview.tmpl @@ -0,0 +1,62 @@ +<h4 class="ui top attached header" id="overview"> + {{ctx.Locale.Tr "repo.settings.units.overview"}} +</h4> +<div class="ui attached segment"> + {{$isCodeEnabled := .Repository.UnitEnabled $.Context $.UnitTypeCode}} + {{$isCodeGlobalDisabled := .UnitTypeCode.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.code"}}</label> + <div class="ui checkbox{{if $isCodeGlobalDisabled}} disabled{{end}}"{{if $isCodeGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_code" type="checkbox"{{if $isCodeEnabled}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.code.desc"}}</label> + </div> + </div> + + {{$isProjectsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeProjects}} + {{$isProjectsGlobalDisabled := .UnitTypeProjects.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.projects"}}</label> + <div class="ui checkbox{{if $isProjectsGlobalDisabled}} disabled{{end}}"{{if $isProjectsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_projects" type="checkbox" {{if $isProjectsEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.projects_desc"}}</label> + </div> + </div> + + {{$isReleasesEnabled := .Repository.UnitEnabled $.Context $.UnitTypeReleases}} + {{$isReleasesGlobalDisabled := .UnitTypeReleases.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.releases"}}</label> + <div class="ui checkbox{{if $isReleasesGlobalDisabled}} disabled{{end}}"{{if $isReleasesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_releases" type="checkbox" {{if $isReleasesEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.releases_desc"}}</label> + </div> + </div> + + {{$isPackagesEnabled := .Repository.UnitEnabled $.Context $.UnitTypePackages}} + {{$isPackagesGlobalDisabled := .UnitTypePackages.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.packages"}}</label> + <div class="ui checkbox{{if $isPackagesGlobalDisabled}} disabled{{end}}"{{if $isPackagesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_packages" type="checkbox" {{if $isPackagesEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.packages_desc"}}</label> + </div> + </div> + + {{if .EnableActions}} + {{$isActionsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeActions}} + {{$isActionsGlobalDisabled := .UnitTypeActions.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "actions.actions"}}</label> + <div class="ui checkbox{{if $isActionsGlobalDisabled}} disabled{{end}}"{{if $isActionsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_actions" type="checkbox" {{if $isActionsEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.actions_desc"}}</label> + </div> + </div> + {{end}} + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/units/pulls.tmpl b/templates/repo/settings/units/pulls.tmpl new file mode 100644 index 00000000..4e9c53e0 --- /dev/null +++ b/templates/repo/settings/units/pulls.tmpl @@ -0,0 +1,132 @@ +<h4 class="ui top attached header" id="pulls"> + {{ctx.Locale.Tr "repo.pulls"}} +</h4> +<div class="ui attached segment"> + {{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}} + {{$pullRequestGlobalDisabled := .UnitTypePullRequests.UnitGlobalDisabled}} + {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.pulls"}}</label> + <div class="ui checkbox{{if $pullRequestGlobalDisabled}} disabled{{end}}"{{if $pullRequestGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if $pullRequestEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls_desc"}}</label> + </div> + </div> + <div class="field{{if not $pullRequestEnabled}} disabled{{end}}" id="pull_box"> + <div class="field"> + <p> + {{ctx.Locale.Tr "repo.settings.merge_style_desc"}} + </p> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_rebase" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebase)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_rebase_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_squash" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowSquash)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_fast_forward_only" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowFastForwardOnly)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowManualMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.merge_manually"}}</label> + </div> + </div> + + <div class="field"> + <p> + {{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}} + </p> + <div class="ui dropdown selection"> + <select name="pulls_default_merge_style"> + <option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</option> + <option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option> + <option value="rebase-merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</option> + <option value="squash" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</option> + <option value="fast-forward-only" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</option> + </select>{{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="default text"> + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}} + {{ctx.Locale.Tr "repo.pulls.merge_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}} + {{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}} + {{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}} + {{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}} + {{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}} + {{end}} + </div> + <div class="menu"> + <div class="item" data-value="merge">{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</div> + <div class="item" data-value="rebase">{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</div> + <div class="item" data-value="rebase-merge">{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div> + <div class="item" data-value="squash">{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</div> + <div class="item" data-value="fast-forward-only">{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</div> + </div> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="default_allow_maintainer_edit" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultAllowMaintainerEdit)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label> + </div> + </div> + </div> + + <div class="divider"></div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/units/wiki.tmpl b/templates/repo/settings/units/wiki.tmpl new file mode 100644 index 00000000..23df294b --- /dev/null +++ b/templates/repo/settings/units/wiki.tmpl @@ -0,0 +1,51 @@ +<h4 class="ui top attached header" id="wiki"> + {{ctx.Locale.Tr "repo.wiki"}} +</h4> +<div class="ui attached segment"> + {{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}} + {{$isWikiGlobalDisabled := .UnitTypeWiki.UnitGlobalDisabled}} + {{$isExternalWikiGlobalDisabled := .UnitTypeExternalWiki.UnitGlobalDisabled}} + {{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.wiki"}}</label> + <div class="ui checkbox{{if $isBothWikiGlobalDisabled}} disabled{{end}}"{{if $isBothWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if $isWikiEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.wiki_desc"}}</label> + </div> + </div> + <div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box"> + <div class="field"> + <div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_wiki" type="radio" value="false" data-context="#globally_writeable_checkbox" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_internal_wiki"}}</label> + </div> + </div> + {{if (not .Repository.IsPrivate)}} + <div class="field {{if (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}disabled{{end}}" id="globally_writeable_checkbox"> + <div class="field tw-pl-4"> + <div class="ui checkbox"> + <input name="globally_writeable_wiki" type="checkbox" {{if .Permission.IsGloballyWriteable $.UnitTypeWiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.wiki_globally_editable"}}</label> + </div> + </div> + </div> + {{end}} + <div class="field"> + <div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_wiki" type="radio" value="true" data-context="#globally_writeable_checkbox" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_external_wiki"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}disabled{{end}}" id="external_wiki_box"> + <label for="external_wiki_url">{{ctx.Locale.Tr "repo.settings.external_wiki_url"}}</label> + <input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}</p> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/webhook/base.tmpl b/templates/repo/settings/webhook/base.tmpl new file mode 100644 index 00000000..d5247224 --- /dev/null +++ b/templates/repo/settings/webhook/base.tmpl @@ -0,0 +1,5 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings webhooks")}} + <div class="repo-setting-content"> + {{template "repo/settings/webhook/list" .}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/webhook/base_list.tmpl b/templates/repo/settings/webhook/base_list.tmpl new file mode 100644 index 00000000..36e75a7e --- /dev/null +++ b/templates/repo/settings/webhook/base_list.tmpl @@ -0,0 +1,26 @@ +<h4 class="ui top attached header"> + {{.Title}} + <div class="ui right"> + <div class="ui jump dropdown"> + <div class="ui primary tiny button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</div> + {{template "repo/settings/webhook/link_menu" .}} + </div> + </div> +</h4> +<div class="ui attached segment"> + <div class="ui list"> + <div class="item"> + {{.Description}} + </div> + {{range .Webhooks}} + <div class="item truncated-item-container"> + <span class="text {{if eq .LastStatus 1}}green{{else if eq .LastStatus 2}}red{{else}}grey{{end}} tw-mr-2">{{svg "octicon-dot-fill" 22}}</span> + <div class="text truncate tw-flex-1 tw-mr-2"> + <a title="{{.URL}}" href="{{$.BaseLink}}/{{.ID}}">{{.URL}}</a> + </div> + <a class="muted tw-p-2" href="{{$.BaseLink}}/{{.ID}}">{{svg "octicon-pencil"}}</a> + <a class="delete-button tw-p-2" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}}</a> + </div> + {{end}} + </div> +</div> diff --git a/templates/repo/settings/webhook/delete_modal.tmpl b/templates/repo/settings/webhook/delete_modal.tmpl new file mode 100644 index 00000000..9955ed3a --- /dev/null +++ b/templates/repo/settings/webhook/delete_modal.tmpl @@ -0,0 +1,10 @@ +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.webhook_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl new file mode 100644 index 00000000..8ee1446a --- /dev/null +++ b/templates/repo/settings/webhook/history.tmpl @@ -0,0 +1,90 @@ +{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}} +{{if .PageIsSettingsHooksEdit}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.recent_deliveries"}} + {{if .Permission.IsAdmin}} + <div class="ui right"> + <!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button --> + <span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}"> + <button class="ui teal tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}"> + <span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span> + </button> + </span> + </div> + {{end}} + </h4> + <div class="ui attached segment"> + <div class="ui list"> + {{range .History}} + <div class="item"> + <div class="flex-text-block tw-justify-between"> + <div class="flex-text-inline"> + {{if .IsSucceed}} + <span class="text green">{{svg "octicon-check"}}</span> + {{else if not .IsDelivered}} + <span class="text orange">{{svg "octicon-stopwatch"}}</span> + {{else}} + <span class="text red">{{svg "octicon-alert"}}</span> + {{end}} + <a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a> + </div> + <span class="text grey"> + {{TimeSince .Delivered.AsTime ctx.Locale}} + </span> + </div> + <div class="info tw-hidden" id="info-{{.ID}}"> + <div class="ui top attached tabular menu"> + <a class="item active" data-tab="request-{{.ID}}">{{ctx.Locale.Tr "repo.settings.webhook.request"}}</a> + <a class="item" data-tab="response-{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.webhook.response"}} + {{if .ResponseInfo}} + {{if .IsSucceed}} + <span class="ui green label">{{.ResponseInfo.Status}}</span> + {{else}} + <span class="ui red label">{{.ResponseInfo.Status}}</span> + {{end}} + {{else}} + <span class="ui label">-</span> + {{end}} + </a> + {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}} + <div class="right menu"> + <form class="item" action="{{$.Link}}/replay/{{.UUID}}" method="post"> + {{$.CsrfTokenHtml}} + <span data-tooltip-content="{{if $.Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description_disabled"}}{{end}}"> + <button class="ui tiny button{{if not $.Webhook.IsActive}} disabled{{end}}">{{svg "octicon-sync"}}</button> + </span> + </form> + </div> + {{end}} + </div> + <div class="ui bottom attached tab segment active" data-tab="request-{{.ID}}"> + {{if .RequestInfo}} + <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5> + <pre class="webhook-info"><strong>Request URL:</strong> {{.RequestInfo.URL}} +<strong>Request method:</strong> {{if .RequestInfo.HTTPMethod}}{{.RequestInfo.HTTPMethod}}{{else}}POST{{end}} +{{range $key, $val := .RequestInfo.Headers}}<strong>{{$key}}:</strong> {{$val}} +{{end}}</pre> + <h5>{{ctx.Locale.Tr "repo.settings.webhook.payload"}}</h5> + <pre class="webhook-info"><code class="json">{{or .RequestInfo.Body .PayloadContent}}</code></pre> + {{else}} + - + {{end}} + </div> + <div class="ui bottom attached tab segment" data-tab="response-{{.ID}}"> + {{if .ResponseInfo}} + <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5> + <pre class="webhook-info">{{range $key, $val := .ResponseInfo.Headers}}<strong>{{$key}}:</strong> {{$val}} +{{end}}</pre> + <h5>{{ctx.Locale.Tr "repo.settings.webhook.body"}}</h5> + <pre class="webhook-info"><code>{{.ResponseInfo.Body}}</code></pre> + {{else}} + - + {{end}} + </div> + </div> + </div> + {{end}} + </div> + </div> +{{end}} diff --git a/templates/repo/settings/webhook/link_menu.tmpl b/templates/repo/settings/webhook/link_menu.tmpl new file mode 100644 index 00000000..2edc5af4 --- /dev/null +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -0,0 +1,12 @@ +{{$size := 20}} +{{if .Size}} + {{$size = .Size}} +{{end}} +<div class="menu"> + {{range .WebhookList}} + <a class="item" href="{{$.BaseLinkNew}}/{{.Type}}/new"> + {{.Icon $size}} + {{ctx.Locale.Tr (print "repo.settings.web_hook_name_" .Type)}} + </a> + {{end}} +</div> diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl new file mode 100644 index 00000000..b24159fc --- /dev/null +++ b/templates/repo/settings/webhook/list.tmpl @@ -0,0 +1,4 @@ + +{{template "repo/settings/webhook/base_list" .}} + +{{template "repo/settings/webhook/delete_modal" .}} diff --git a/templates/repo/settings/webhook/new.tmpl b/templates/repo/settings/webhook/new.tmpl new file mode 100644 index 00000000..b04a4421 --- /dev/null +++ b/templates/repo/settings/webhook/new.tmpl @@ -0,0 +1,7 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings new webhook")}} + <div class="repo-setting-content"> + {{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}} + {{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}} + {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}} + </div> +{{template "repo/settings/layout_footer" .}} |