diff options
Diffstat (limited to 'templates')
283 files changed, 7261 insertions, 3498 deletions
diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index 660f0d0881..781f514af4 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -15,7 +15,14 @@ </div> <div class="required inline field {{if .Err_Name}}error{{end}}"> <label for="auth_name">{{ctx.Locale.Tr "admin.auths.auth_name"}}</label> - <input id="auth_name" name="name" value="{{.Source.Name}}" autofocus required> + <input id="auth_name" name="name" value="{{.Source.Name}}" required> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label ><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label> + <input name="two_factor_policy" type="checkbox" value="skip" {{if eq .Source.TwoFactorPolicy "skip"}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p> + </div> </div> <!-- LDAP and DLDAP --> @@ -159,13 +166,6 @@ </div> </div> {{end}} - <div class="optional field"> - <div class="ui checkbox"> - <label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label> - <input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if $cfg.SkipLocalTwoFA}}checked{{end}}> - <p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p> - </div> - </div> <div class="inline field"> <div class="ui checkbox"> <label for="allow_deactivate_all"><strong>{{ctx.Locale.Tr "admin.auths.allow_deactivate_all"}}</strong></label> @@ -227,13 +227,6 @@ <input id="allowed_domains" name="allowed_domains" value="{{$cfg.AllowedDomains}}"> <p class="help">{{ctx.Locale.Tr "admin.auths.allowed_domains_helper"}}</p> </div> - <div class="optional field"> - <div class="ui checkbox"> - <label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label> - <input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if $cfg.SkipLocalTwoFA}}checked{{end}}> - <p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p> - </div> - </div> {{end}} <!-- PAM --> @@ -247,13 +240,6 @@ <label for="pam_email_domain">{{ctx.Locale.Tr "admin.auths.pam_email_domain"}}</label> <input id="pam_email_domain" name="pam_email_domain" value="{{$cfg.EmailDomain}}"> </div> - <div class="optional field"> - <div class="ui checkbox"> - <label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label> - <input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if $cfg.SkipLocalTwoFA}}checked{{end}}> - <p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p> - </div> - </div> {{end}} <!-- OAuth2 --> @@ -288,13 +274,6 @@ <label for="open_id_connect_auto_discovery_url">{{ctx.Locale.Tr "admin.auths.openIdConnectAutoDiscoveryURL"}}</label> <input id="open_id_connect_auto_discovery_url" name="open_id_connect_auto_discovery_url" value="{{$cfg.OpenIDConnectAutoDiscoveryURL}}"> </div> - <div class="optional field"> - <div class="ui checkbox"> - <label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label> - <input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if $cfg.SkipLocalTwoFA}}checked{{end}}> - <p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p> - </div> - </div> <div class="oauth2_use_custom_url inline field"> <div class="ui checkbox"> <label><strong>{{ctx.Locale.Tr "admin.auths.oauth2_use_custom_url"}}</strong></label> @@ -429,7 +408,10 @@ <div class="field"> <button class="ui primary button">{{ctx.Locale.Tr "admin.auths.update"}}</button> - <button class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.Source.ID}}">{{ctx.Locale.Tr "admin.auths.delete"}}</button> + <button class="ui red button link-action" data-url="{{$.Link}}/delete?id={{.Source.ID}}" + data-modal-confirm-header="{{ctx.Locale.Tr "admin.auths.delete_auth_title"}}" + data-modal-confirm-content="{{ctx.Locale.Tr "admin.auths.delete_auth_desc"}}" + >{{ctx.Locale.Tr "admin.auths.delete"}}</button> </div> </form> </div> @@ -445,16 +427,4 @@ <p class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p> </div> </div> - -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "admin.auths.delete_auth_title"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "admin.auths.delete_auth_desc"}}</p> - </div> - {{template "base/modal_actions_confirm" .}} -</div> - {{template "admin/layout_footer" .}} diff --git a/templates/admin/auth/list.tmpl b/templates/admin/auth/list.tmpl index 7931014b1a..a1e72b742f 100644 --- a/templates/admin/auth/list.tmpl +++ b/templates/admin/auth/list.tmpl @@ -30,6 +30,8 @@ <td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> <td><a href="{{AppSubUrl}}/-/admin/auths/{{.ID}}">{{svg "octicon-pencil"}}</a></td> </tr> + {{else}} + <tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "no_results_found"}}</td></tr> {{end}} </tbody> </table> diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 29a5e1b473..806347c720 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -69,10 +69,6 @@ {{if not .SSH.StartBuiltinServer}} <dt>{{ctx.Locale.Tr "admin.config.ssh_root_path"}}</dt> <dd>{{.SSH.RootPath}}</dd> - <dt>{{ctx.Locale.Tr "admin.config.ssh_key_test_path"}}</dt> - <dd>{{.SSH.KeyTestPath}}</dd> - <dt>{{ctx.Locale.Tr "admin.config.ssh_keygen_path"}}</dt> - <dd>{{.SSH.KeygenPath}}</dd> <dt>{{ctx.Locale.Tr "admin.config.ssh_minimum_key_size_check"}}</dt> <dd>{{svg (Iif .SSH.MinimumKeySizeCheck "octicon-check" "octicon-x")}}</dd> {{if .SSH.MinimumKeySizeCheck}} @@ -148,7 +144,7 @@ <dt>{{ctx.Locale.Tr "admin.config.enable_openid_signin"}}</dt> <dd>{{svg (Iif .Service.EnableOpenIDSignIn "octicon-check" "octicon-x")}}</dd> <dt>{{ctx.Locale.Tr "admin.config.require_sign_in_view"}}</dt> - <dd>{{svg (Iif .Service.RequireSignInView "octicon-check" "octicon-x")}}</dd> + <dd>{{svg (Iif .Service.RequireSignInViewStrict "octicon-check" "octicon-x")}}</dd> <dt>{{ctx.Locale.Tr "admin.config.mail_notify"}}</dt> <dd>{{svg (Iif .Service.EnableNotifyMail "octicon-check" "octicon-x")}}</dd> <dt>{{ctx.Locale.Tr "admin.config.enable_captcha"}}</dt> diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index af2349d288..2426a43b15 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -15,57 +15,57 @@ <tbody> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.delete_inactive_accounts"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="delete_inactive_accounts">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="delete_inactive_accounts">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.delete_repo_archives"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="delete_repo_archives">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="delete_repo_archives">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.delete_missing_repos"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="delete_missing_repos">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="delete_missing_repos">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.git_gc_repos"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="git_gc_repos">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="git_gc_repos">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> {{if and (not .SSH.Disabled) (not .SSH.StartBuiltinServer)}} <tr> <td>{{ctx.Locale.Tr "admin.dashboard.resync_all_sshkeys"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="resync_all_sshkeys">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="resync_all_sshkeys">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.resync_all_sshprincipals"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="resync_all_sshprincipals">{{svg "octicon-play" 16}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="resync_all_sshprincipals">{{svg "octicon-play" 16}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> {{end}} <tr> <td>{{ctx.Locale.Tr "admin.dashboard.resync_all_hooks"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="resync_all_hooks">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="resync_all_hooks">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.reinit_missing_repos"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="reinit_missing_repos">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="reinit_missing_repos">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.sync_external_users"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="sync_external_users">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="sync_external_users">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.repo_health_check"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="repo_health_check">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="repo_health_check">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.delete_generated_repository_avatars"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="delete_generated_repository_avatars">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="delete_generated_repository_avatars">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.sync_repo_branches"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="sync_repo_branches">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="sync_repo_branches">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> <tr> <td>{{ctx.Locale.Tr "admin.dashboard.sync_repo_tags"}}</td> - <td class="text right"><button type="submit" class="ui primary button" name="op" value="sync_repo_tags">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> + <td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="sync_repo_tags">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td> </tr> </tbody> </table> diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl index 0dc1fb9d03..b4335aeeec 100644 --- a/templates/admin/emails/list.tmpl +++ b/templates/admin/emails/list.tmpl @@ -67,6 +67,8 @@ >{{svg "octicon-trash"}}</a> </td> </tr> + {{else}} + <tr><td class="tw-text-center" colspan="6">{{ctx.Locale.Tr "no_results_found"}}</td></tr> {{end}} </tbody> </table> diff --git a/templates/admin/hooks.tmpl b/templates/admin/hooks.tmpl index c77d27dbd0..d5fdef6850 100644 --- a/templates/admin/hooks.tmpl +++ b/templates/admin/hooks.tmpl @@ -1,9 +1,6 @@ {{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin hooks")}} <div class="admin-setting-content"> - {{template "repo/settings/webhook/base_list" .SystemWebhooks}} {{template "repo/settings/webhook/base_list" .DefaultWebhooks}} - - {{template "repo/settings/webhook/delete_modal" .}} </div> {{template "admin/layout_footer" .}} diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl index 4116357d1d..72584ec799 100644 --- a/templates/admin/navbar.tmpl +++ b/templates/admin/navbar.tmpl @@ -95,7 +95,7 @@ <a class="{{if .PageIsAdminNotices}}active {{end}}item" href="{{AppSubUrl}}/-/admin/notices"> {{ctx.Locale.Tr "admin.notices"}} </a> - <details class="item toggleable-item" {{if or .PageIsAdminMonitorStats .PageIsAdminMonitorCron .PageIsAdminMonitorQueue .PageIsAdminMonitorStacktrace}}open{{end}}> + <details class="item toggleable-item" {{if or .PageIsAdminMonitorStats .PageIsAdminMonitorCron .PageIsAdminMonitorQueue .PageIsAdminMonitorTrace}}open{{end}}> <summary>{{ctx.Locale.Tr "admin.monitor"}}</summary> <div class="menu"> <a class="{{if .PageIsAdminMonitorStats}}active {{end}}item" href="{{AppSubUrl}}/-/admin/monitor/stats"> @@ -107,8 +107,8 @@ <a class="{{if .PageIsAdminMonitorQueue}}active {{end}}item" href="{{AppSubUrl}}/-/admin/monitor/queue"> {{ctx.Locale.Tr "admin.monitor.queues"}} </a> - <a class="{{if .PageIsAdminMonitorStacktrace}}active {{end}}item" href="{{AppSubUrl}}/-/admin/monitor/stacktrace"> - {{ctx.Locale.Tr "admin.monitor.stacktrace"}} + <a class="{{if .PageIsAdminMonitorTrace}}active {{end}}item" href="{{AppSubUrl}}/-/admin/monitor/stacktrace"> + {{ctx.Locale.Tr "admin.monitor.trace"}} </a> </div> </details> diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl index fd475d7157..a4c9dc53fb 100644 --- a/templates/admin/notice.tmpl +++ b/templates/admin/notice.tmpl @@ -24,6 +24,8 @@ <td nowrap>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> <td class="view-detail"><a href="#">{{svg "octicon-note" 16}}</a></td> </tr> + {{else}} + <tr><td class="tw-text-center" colspan="6">{{ctx.Locale.Tr "no_results_found"}}</td></tr> {{end}} </tbody> {{if .Notices}} diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl index d5e09939c5..137c42b45d 100644 --- a/templates/admin/org/list.tmpl +++ b/templates/admin/org/list.tmpl @@ -66,6 +66,8 @@ <td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> <td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td> </tr> + {{else}} + <tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "no_results_found"}}</td></tr> {{end}} </tbody> </table> diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index 08c11442bc..4817f2681b 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -72,8 +72,15 @@ </td> <td>{{FileSize .CalculateBlobSize}}</td> <td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td> - <td><a class="delete-button" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.Version.ID}}" data-name="{{.Package.Name}}" data-data-version="{{.Version.Version}}">{{svg "octicon-trash"}}</a></td> + <td> + <a class="text red show-modal" href data-modal="#admin-package-delete-modal" + data-modal-form.action="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}&id={{.Version.ID}}" + data-modal-package-name="{{.Package.Name}}" data-modal-package-version="{{.Version.Version}}" + >{{svg "octicon-trash"}}</a> + </td> </tr> + {{else}} + <tr><td class="tw-text-center" colspan="10">{{ctx.Locale.Tr "no_results_found"}}</td></tr> {{end}} </tbody> </table> @@ -82,15 +89,13 @@ {{template "base/paginate" .}} </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "packages.settings.delete"}} - </div> +<form class="ui small modal form-fetch-action" method="post" id="admin-package-delete-modal"> + {{.CsrfTokenHtml}} + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "packages.settings.delete"}}</div> <div class="content"> - {{ctx.Locale.Tr "packages.settings.delete.notice" (`<span class="name"></span>`|SafeHTML) (`<span class="dataVersion"></span>`|SafeHTML)}} + {{ctx.Locale.Tr "packages.settings.delete.notice" (HTMLFormat `<span class="%s"></span>` "package-name") (HTMLFormat `<span class="%s"></span>` "package-version")}} </div> {{template "base/modal_actions_confirm" .}} -</div> +</form> {{template "admin/layout_footer" .}} diff --git a/templates/admin/perftrace.tmpl b/templates/admin/perftrace.tmpl new file mode 100644 index 0000000000..2e09f14e46 --- /dev/null +++ b/templates/admin/perftrace.tmpl @@ -0,0 +1,13 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}} + +<div class="admin-setting-content"> + {{template "admin/trace_tabs" .}} + + {{range $record := .PerfTraceRecords}} + <div class="ui segment tw-w-full tw-overflow-auto"> + <pre class="tw-whitespace-pre">{{$record.Content}}</pre> + </div> + {{end}} +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl index 08fd893e76..2ad2de3a1d 100644 --- a/templates/admin/repo/list.tmpl +++ b/templates/admin/repo/list.tmpl @@ -7,7 +7,7 @@ </div> </h4> <div class="ui attached segment"> - {{template "shared/repo_search" .}} + {{template "shared/repo/search" .}} </div> <div class="ui attached table segment"> <table class="ui very basic striped table unstackable"> @@ -84,8 +84,15 @@ <td>{{FileSize .LFSSize}}</td> <td>{{DateUtils.AbsoluteShort .UpdatedUnix}}</td> <td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td> - <td><a class="delete-button" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.ID}}" data-name="{{.Name}}">{{svg "octicon-trash"}}</a></td> + <td> + <a class="text red show-modal" href data-modal="#admin-repo-delete-modal" + data-modal-form.action="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}&id={{.ID}}" + data-modal-repo-name="{{.Name}}" + >{{svg "octicon-trash"}}</a> + </td> </tr> + {{else}} + <tr><td class="tw-text-center" colspan="12">{{ctx.Locale.Tr "no_results_found"}}</td></tr> {{end}} </tbody> </table> @@ -94,17 +101,15 @@ {{template "base/paginate" .}} </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.settings.delete"}} - </div> +<form class="ui small modal form-fetch-action" id="admin-repo-delete-modal" method="post"> + {{.CsrfTokenHtml}} + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.settings.delete"}}</div> <div class="content"> <p>{{ctx.Locale.Tr "repo.settings.delete_desc"}}</p> - {{ctx.Locale.Tr "repo.settings.delete_notices_2" (`<span class="name"></span>`|SafeHTML)}}<br> + {{ctx.Locale.Tr "repo.settings.delete_notices_2" (HTMLFormat `<span class="%s"></span>` "repo-name")}}<br> {{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}}<br> </div> {{template "base/modal_actions_confirm" .}} -</div> +</form> {{template "admin/layout_footer" .}} diff --git a/templates/admin/stacktrace-row.tmpl b/templates/admin/stacktrace-row.tmpl index 97c361ff90..db7ed81c79 100644 --- a/templates/admin/stacktrace-row.tmpl +++ b/templates/admin/stacktrace-row.tmpl @@ -17,7 +17,10 @@ </div> <div> {{if or (eq .Process.Type "request") (eq .Process.Type "normal")}} - <a class="delete-button icon" href="" data-url="{{.root.Link}}/cancel/{{.Process.PID}}" data-id="{{.Process.PID}}" data-name="{{.Process.Description}}">{{svg "octicon-trash" 16 "text-red"}}</a> + <a class="link-action" data-url="{{.root.Link}}/cancel/{{.Process.PID}}" + data-modal-confirm-header="{{ctx.Locale.Tr "admin.monitor.process.cancel"}}" + data-modal-confirm-content="{{ctx.Locale.Tr "admin.monitor.process.cancel_desc"}}" + >{{svg "octicon-trash" 16 "text-red"}}</a> {{end}} </div> </div> diff --git a/templates/admin/stacktrace.tmpl b/templates/admin/stacktrace.tmpl index ce03d80555..c5dde6b30c 100644 --- a/templates/admin/stacktrace.tmpl +++ b/templates/admin/stacktrace.tmpl @@ -1,22 +1,7 @@ {{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}} <div class="admin-setting-content"> - <div class="tw-flex tw-items-center"> - <div class="tw-flex-1"> - <div class="ui compact small menu"> - <a class="{{if eq .ShowGoroutineList "process"}}active {{end}}item" href="?show=process">{{ctx.Locale.Tr "admin.monitor.process"}}</a> - <a class="{{if eq .ShowGoroutineList "stacktrace"}}active {{end}}item" href="?show=stacktrace">{{ctx.Locale.Tr "admin.monitor.stacktrace"}}</a> - </div> - </div> - <form target="_blank" action="{{AppSubUrl}}/-/admin/monitor/diagnosis" class="ui form"> - <div class="ui inline field"> - <button class="ui primary small button">{{ctx.Locale.Tr "admin.monitor.download_diagnosis_report"}}</button> - <input name="seconds" size="3" maxlength="3" value="10"> {{ctx.Locale.Tr "tool.raw_seconds"}} - </div> - </form> - </div> - - <div class="divider"></div> + {{template "admin/trace_tabs" .}} <h4 class="ui top attached header"> {{printf "%d Goroutines" .GoroutineCount}}{{/* Goroutine is non-translatable*/}} @@ -34,15 +19,4 @@ {{end}} </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{ctx.Locale.Tr "admin.monitor.process.cancel"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "admin.monitor.process.cancel_notices" (`<span class="name"></span>`|SafeHTML)}}</p> - <p>{{ctx.Locale.Tr "admin.monitor.process.cancel_desc"}}</p> - </div> - {{template "base/modal_actions_confirm" .}} -</div> - {{template "admin/layout_footer" .}} diff --git a/templates/admin/trace_tabs.tmpl b/templates/admin/trace_tabs.tmpl new file mode 100644 index 0000000000..5066c9c41b --- /dev/null +++ b/templates/admin/trace_tabs.tmpl @@ -0,0 +1,19 @@ +<div class="flex-text-block"> + <div class="tw-flex-1"> + <div class="ui compact small menu"> + {{if .ShowAdminPerformanceTraceTab}} + <a class="item {{Iif .PageIsAdminMonitorPerfTrace "active"}}" href="{{AppSubUrl}}/-/admin/monitor/perftrace">{{ctx.Locale.Tr "admin.monitor.performance_logs"}}</a> + {{end}} + <a class="item {{Iif (eq .ShowGoroutineList "process") "active"}}" href="{{AppSubUrl}}/-/admin/monitor/stacktrace?show=process">{{ctx.Locale.Tr "admin.monitor.process"}}</a> + <a class="item {{Iif (eq .ShowGoroutineList "stacktrace") "active"}}" href="{{AppSubUrl}}/-/admin/monitor/stacktrace?show=stacktrace">{{ctx.Locale.Tr "admin.monitor.stacktrace"}}</a> + </div> + </div> + <form target="_blank" action="{{AppSubUrl}}/-/admin/monitor/diagnosis" class="ui form"> + <div class="ui inline field"> + <button class="ui primary small button">{{ctx.Locale.Tr "admin.monitor.download_diagnosis_report"}}</button> + <input name="seconds" size="3" maxlength="3" value="10"> {{ctx.Locale.Tr "tool.raw_seconds"}} + </div> + </form> +</div> + +<div class="divider"></div> diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index d591a645d8..879b5cb550 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -9,7 +9,7 @@ {{.CsrfTokenHtml}} <div class="field {{if .Err_UserName}}error{{end}}"> <label for="user_name">{{ctx.Locale.Tr "username"}}</label> - <input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal}}disabled{{end}} maxlength="40"> + <input id="user_name" name="user_name" value="{{.User.Name}}" {{if not .User.IsLocal}}disabled{{end}} maxlength="40"> </div> <!-- Types and name --> <div class="inline required field {{if .Err_LoginType}}error{{end}}"> @@ -55,7 +55,7 @@ <div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}tw-hidden{{end}}"> <label for="login_name">{{ctx.Locale.Tr "admin.users.auth_login_name"}}</label> - <input id="login_name" name="login_name" value="{{.User.LoginName}}" autofocus> + <input id="login_name" name="login_name" value="{{.User.LoginName}}"> </div> <div class="field {{if .Err_FullName}}error{{end}}"> <label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label> @@ -63,7 +63,7 @@ </div> <div class="required field {{if .Err_Email}}error{{end}}"> <label for="email">{{ctx.Locale.Tr "email"}}</label> - <input id="email" name="email" type="email" value="{{.User.Email}}" autofocus required> + <input id="email" name="email" type="email" value="{{.User.Email}}" required> </div> <div class="local field {{if .Err_Password}}error{{end}} {{if not (or (.User.IsLocal) (.User.IsOAuth2))}}tw-hidden{{end}}"> <label for="password">{{ctx.Locale.Tr "password"}}</label> @@ -195,8 +195,7 @@ </div> <div class="inline field tw-pl-4"> - <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"> + {{template "shared/avatar_upload_crop" dict "LabelText" (ctx.Locale.Tr "settings.choose_new_avatar")}} </div> <div class="field"> diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl index 7e4c8854f5..eb3f6cd720 100644 --- a/templates/admin/user/list.tmpl +++ b/templates/admin/user/list.tmpl @@ -109,6 +109,8 @@ </div> </td> </tr> + {{else}} + <tr class="no-results-row"><td class="tw-text-center" colspan="9">{{ctx.Locale.Tr "no_results_found"}}</td></tr> {{end}} </tbody> </table> diff --git a/templates/admin/user/view.tmpl b/templates/admin/user/view.tmpl index 21943a8382..67f9148e64 100644 --- a/templates/admin/user/view.tmpl +++ b/templates/admin/user/view.tmpl @@ -15,10 +15,7 @@ </div> <div class="tw-flex-1"> <h4 class="ui top attached header"> - {{ctx.Locale.Tr "admin.emails"}} - <div class="ui right"> - {{.EmailsTotal}} - </div> + {{ctx.Locale.Tr "admin.emails"}} ({{ctx.Locale.Tr "admin.total" .EmailsTotal}}) </h4> <div class="ui attached segment"> {{template "admin/user/view_emails" .}} @@ -26,19 +23,13 @@ </div> </div> <h4 class="ui top attached header"> - {{ctx.Locale.Tr "admin.repositories"}} - <div class="ui right"> - {{.ReposTotal}} - </div> + {{ctx.Locale.Tr "admin.repositories"}} ({{ctx.Locale.Tr "admin.total" .ReposTotal}}) </h4> <div class="ui attached segment"> - {{template "explore/repo_list" .}} + {{template "shared/repo/list" .}} </div> <h4 class="ui top attached header"> - {{ctx.Locale.Tr "settings.organization"}} - <div class="ui right"> - {{.OrgsTotal}} - </div> + {{ctx.Locale.Tr "settings.organization"}} ({{ctx.Locale.Tr "admin.total" .OrgsTotal}}) </h4> <div class="ui attached segment"> {{template "explore/user_list" .}} diff --git a/templates/admin/user/view_details.tmpl b/templates/admin/user/view_details.tmpl index be2f32b5ec..db61bc9359 100644 --- a/templates/admin/user/view_details.tmpl +++ b/templates/admin/user/view_details.tmpl @@ -9,30 +9,25 @@ {{if .User.IsAdmin}} <span class="ui basic label">{{ctx.Locale.Tr "admin.users.admin"}}</span> {{end}} + {{if .User.IsTypeBot}} + <span class="ui basic label">{{ctx.Locale.Tr "admin.users.bot"}}</span> + {{end}} </div> <div class="flex-item-body"> <b>{{ctx.Locale.Tr "admin.users.auth_source"}}:</b> - {{if eq .LoginSource.ID 0}} - {{ctx.Locale.Tr "admin.users.local"}} - {{else}} - {{.LoginSource.Name}} - {{end}} + {{Iif (eq .LoginSource.ID 0) (ctx.Locale.Tr "admin.users.local") .LoginSource.Name}} </div> <div class="flex-item-body"> <b>{{ctx.Locale.Tr "admin.users.activated"}}:</b> - {{if .User.IsActive}} - {{svg "octicon-check"}} - {{else}} - {{svg "octicon-x"}} - {{end}} + {{svg (Iif .User.IsActive "octicon-check" "octicon-x")}} + </div> + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "admin.users.prohibit_login"}}:</b> + {{svg (Iif .User.ProhibitLogin "octicon-check" "octicon-x")}} </div> <div class="flex-item-body"> <b>{{ctx.Locale.Tr "admin.users.restricted"}}:</b> - {{if .User.IsRestricted}} - {{svg "octicon-check"}} - {{else}} - {{svg "octicon-x"}} - {{end}} + {{svg (Iif .User.IsRestricted "octicon-check" "octicon-x")}} </div> <div class="flex-item-body"> <b>{{ctx.Locale.Tr "settings.visibility"}}:</b> @@ -42,11 +37,7 @@ </div> <div class="flex-item-body"> <b>{{ctx.Locale.Tr "admin.users.2fa"}}:</b> - {{if .TwoFactorEnabled}} - <span class="text green">{{svg "octicon-check"}}</span> - {{else}} - {{svg "octicon-x"}} - {{end}} + {{svg (Iif .TwoFactorEnabled "octicon-check" "octicon-x")}} </div> {{if .User.Language}} <div class="flex-item-body"> diff --git a/templates/admin/user/view_emails.tmpl b/templates/admin/user/view_emails.tmpl index 22ce305a88..7e77206f1c 100644 --- a/templates/admin/user/view_emails.tmpl +++ b/templates/admin/user/view_emails.tmpl @@ -3,7 +3,7 @@ <div class="flex-item"> <div class="flex-item-main"> <div class="flex-text-block"> - {{.Email}} + <a href="mailto:{{.Email}}">{{.Email}}</a> {{if .IsPrimary}} <div class="ui primary label">{{ctx.Locale.Tr "settings.primary"}}</div> {{end}} diff --git a/templates/base/alert.tmpl b/templates/base/alert.tmpl index 760d3bfa2c..5ebe191771 100644 --- a/templates/base/alert.tmpl +++ b/templates/base/alert.tmpl @@ -1,20 +1,25 @@ -{{if .Flash.ErrorMsg}} +{{- if .Flash.ErrorMsg -}} <div class="ui negative message flash-message flash-error"> <p>{{.Flash.ErrorMsg | SanitizeHTML}}</p> </div> -{{end}} -{{if .Flash.SuccessMsg}} +{{- end -}} +{{- if .Flash.SuccessMsg -}} <div class="ui positive message flash-message flash-success"> <p>{{.Flash.SuccessMsg | SanitizeHTML}}</p> </div> -{{end}} -{{if .Flash.InfoMsg}} +{{- end -}} +{{- if .Flash.InfoMsg -}} <div class="ui info message flash-message flash-info"> <p>{{.Flash.InfoMsg | SanitizeHTML}}</p> </div> -{{end}} -{{if .Flash.WarningMsg}} +{{- end -}} +{{- if .Flash.WarningMsg -}} <div class="ui warning message flash-message flash-warning"> <p>{{.Flash.WarningMsg | SanitizeHTML}}</p> </div> -{{end}} +{{- end -}} +{{- if .ShowTwoFactorRequiredMessage -}} +<div class="ui negative message flash-message flash-error"> + <p><a href="{{AppSubUrl}}/user/settings/security/two_factor/enroll">{{ctx.Locale.Tr "auth.twofa_required"}}</a></p> +</div> +{{- end -}} diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl index fed426a469..3af66e7369 100644 --- a/templates/base/footer.tmpl +++ b/templates/base/footer.tmpl @@ -5,16 +5,10 @@ <div> {{end}} - {{template "custom/body_inner_post" .}} - + {{template "custom/body_inner_post" .}} </div> - {{template "custom/body_outer_post" .}} - {{template "base/footer_content" .}} - - <script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script> - {{template "custom/footer" .}} </body> </html> diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 174267fd2f..e9526818e3 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -19,12 +19,6 @@ <link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml"> <link rel="alternate icon" href="{{AssetUrlPrefix}}/img/favicon.png" type="image/png"> {{template "base/head_script" .}} - <noscript> - <style> - .dropdown:hover > .menu { display: block; } - .ui.secondary.menu .dropdown.item > .menu { margin-top: 0; } - </style> - </noscript> {{template "base/head_opengraph" .}} {{template "base/head_style" .}} {{template "custom/header" .}} diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index bf0e7e632b..b721779c95 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -1,8 +1,3 @@ -{{$notificationUnreadCount := 0}} -{{if and .IsSigned .NotificationUnreadCount}} - {{$notificationUnreadCount = call .NotificationUnreadCount}} -{{end}} - <nav id="navbar" aria-label="{{ctx.Locale.Tr "aria.navbar"}}"> <div class="navbar-left"> <!-- the logo --> @@ -12,22 +7,7 @@ <!-- mobile right menu, it must be here because in mobile view, each item is a flex column, the first item is a full row column --> <div class="ui secondary menu navbar-mobile-right only-mobile"> - {{if and .IsSigned EnableTimetracking .ActiveStopwatch}} - <a id="mobile-stopwatch-icon" class="active-stopwatch item" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}"> - <div class="tw-relative"> - {{svg "octicon-stopwatch"}} - <span class="header-stopwatch-dot"></span> - </div> - </a> - {{end}} - {{if .IsSigned}} - <a id="mobile-notifications-icon" class="item" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}" aria-label="{{ctx.Locale.Tr "notifications"}}"> - <div class="tw-relative"> - {{svg "octicon-bell"}} - <span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span> - </div> - </a> - {{end}} + {{template "base/head_navbar_icons" dict "PageGlobalData" .PageGlobalData}} <button class="item ui icon mini button tw-m-0" id="navbar-expand-toggle" aria-label="{{ctx.Locale.Tr "home.nav_menu"}}">{{svg "octicon-three-bars"}}</button> </div> @@ -70,7 +50,7 @@ <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> </span> <div class="menu user-menu"> - <div class="ui header"> + <div class="header"> {{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> </div> @@ -82,22 +62,7 @@ </div><!-- end content avatar menu --> </div><!-- end dropdown avatar menu --> {{else if .IsSigned}} - {{if and EnableTimetracking .ActiveStopwatch}} - <a class="item not-mobile active-stopwatch" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}"> - <div class="tw-relative"> - {{svg "octicon-stopwatch"}} - <span class="header-stopwatch-dot"></span> - </div> - </a> - {{end}} - - <a class="item not-mobile" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}" aria-label="{{ctx.Locale.Tr "notifications"}}"> - <div class="tw-relative"> - {{svg "octicon-bell"}} - <span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span> - </div> - </a> - + {{template "base/head_navbar_icons" dict "ItemExtraClass" "not-mobile" "PageGlobalData" .PageGlobalData}} <div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "create_new"}}"> <span class="text"> {{svg "octicon-plus"}} @@ -127,10 +92,8 @@ <span class="only-mobile">{{.SignedUser.Name}}</span> <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> </span> - {{/* do not localize it, here it needs the fixed length (width) to make UI comfortable */}} - {{if .IsAdmin}}<span class="navbar-profile-admin">admin</span>{{end}} <div class="menu user-menu"> - <div class="ui header"> + <div class="header"> {{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> </div> @@ -157,14 +120,6 @@ {{svg "octicon-question"}} {{ctx.Locale.Tr "help"}} </a> - {{if .IsAdmin}} - <div class="divider"></div> - <a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/-/admin"> - {{svg "octicon-server"}} - {{ctx.Locale.Tr "admin_panel"}} - </a> - {{end}} - <div class="divider"></div> <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout"> {{svg "octicon-sign-out"}} @@ -175,24 +130,27 @@ {{else}} {{if .ShowRegistrationButton}} <a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up"> - {{svg "octicon-person"}} {{ctx.Locale.Tr "register"}} + {{svg "octicon-person"}} + <span class="tw-ml-1">{{ctx.Locale.Tr "register"}}</span> </a> {{end}} <a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login{{if not .PageIsSignIn}}?redirect_to={{.CurrentURL}}{{end}}"> - {{svg "octicon-sign-in"}} {{ctx.Locale.Tr "sign_in"}} + {{svg "octicon-sign-in"}} + <span class="tw-ml-1">{{ctx.Locale.Tr "sign_in"}}</span> </a> {{end}} </div><!-- end full right menu --> - {{if and .IsSigned EnableTimetracking .ActiveStopwatch}} + {{$activeStopwatch := and .PageGlobalData (call .PageGlobalData.GetActiveStopwatch)}} + {{if $activeStopwatch}} <div class="active-stopwatch-popup tippy-target"> <div class="tw-flex tw-items-center tw-gap-2 tw-p-3"> - <a class="stopwatch-link tw-flex tw-items-center tw-gap-2 muted" href="{{.ActiveStopwatch.IssueLink}}"> + <a class="stopwatch-link tw-flex tw-items-center tw-gap-2 muted" href="{{$activeStopwatch.IssueLink}}"> {{svg "octicon-issue-opened" 16}} - <span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span> + <span class="stopwatch-issue">{{$activeStopwatch.RepoSlug}}#{{$activeStopwatch.IssueIndex}}</span> </a> <div class="tw-flex tw-gap-1"> - <form class="stopwatch-commit form-fetch-action" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/toggle"> + <form class="stopwatch-commit form-fetch-action" method="post" action="{{$activeStopwatch.IssueLink}}/times/stopwatch/stop"> {{.CsrfTokenHtml}} <button type="submit" @@ -200,7 +158,7 @@ data-tooltip-content="{{ctx.Locale.Tr "repo.issues.stop_tracking"}}" >{{svg "octicon-square-fill"}}</button> </form> - <form class="stopwatch-cancel form-fetch-action" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/cancel"> + <form class="stopwatch-cancel form-fetch-action" method="post" action="{{$activeStopwatch.IssueLink}}/times/stopwatch/cancel"> {{.CsrfTokenHtml}} <button type="submit" diff --git a/templates/base/head_navbar_icons.tmpl b/templates/base/head_navbar_icons.tmpl new file mode 100644 index 0000000000..e3bdd27992 --- /dev/null +++ b/templates/base/head_navbar_icons.tmpl @@ -0,0 +1,25 @@ +{{- $itemExtraClass := .ItemExtraClass -}} +{{- $data := .PageGlobalData -}} +{{if and $data $data.IsSigned}}{{/* data may not exist, for example: rendering 503 page before the PageGlobalData middleware */}} + {{- $activeStopwatch := call $data.GetActiveStopwatch -}} + {{- $notificationUnreadCount := call $data.GetNotificationUnreadCount -}} + {{if $activeStopwatch}} + <a class="item active-stopwatch {{$itemExtraClass}}" href="{{$activeStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{$activeStopwatch.Seconds}}"> + <div class="tw-relative"> + {{svg "octicon-stopwatch"}} + <span class="header-stopwatch-dot"></span> + </div> + </a> + {{end}} + <a class="item {{$itemExtraClass}}" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}"> + <div class="tw-relative"> + {{svg "octicon-bell"}} + <span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span> + </div> + </a> + {{if $data.IsSiteAdmin}} + <a class="item {{$itemExtraClass}}" href="{{AppSubUrl}}/-/admin" data-tooltip-content="{{ctx.Locale.Tr "admin_panel"}}"> + {{svg "octicon-server"}} + </a> + {{end}} +{{end}} diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index 7c931e7404..f6648b59d8 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -46,4 +46,4 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. {{/* in case some pages don't render the pageData, we make sure it is an object to prevent null access */}} window.config.pageData = window.config.pageData || {}; </script> -<script src="{{AssetUrlPrefix}}/js/webcomponents.js?v={{AssetVersion}}"></script> +<script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script> diff --git a/templates/base/paginate.tmpl b/templates/base/paginate.tmpl index 9a7a6322f7..f6c1785ccf 100644 --- a/templates/base/paginate.tmpl +++ b/templates/base/paginate.tmpl @@ -2,32 +2,42 @@ {{$paginationLink := $.Link}} {{if eq $paginationLink AppSubUrl}}{{$paginationLink = print $paginationLink "/"}}{{end}} {{with .Page.Paginater}} - {{if gt .TotalPages 1}} + {{if or (eq .TotalPages -1) (gt .TotalPages 1)}} + {{$showFirstLast := gt .TotalPages 1}} <div class="center page buttons"> <div class="ui borderless pagination menu"> + {{if $showFirstLast}} <a class="{{if .IsFirst}}disabled{{end}} item navigation" {{if not .IsFirst}}href="{{$paginationLink}}{{if $paginationParams}}?{{$paginationParams}}{{end}}"{{end}}> {{svg "gitea-double-chevron-left" 16 "tw-mr-1"}} <span class="navigation_label">{{ctx.Locale.Tr "admin.first_page"}}</span> </a> + {{end}} + <a class="{{if not .HasPrevious}}disabled{{end}} item navigation" {{if .HasPrevious}}href="{{$paginationLink}}?page={{.Previous}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}> {{svg "octicon-chevron-left" 16 "tw-mr-1"}} <span class="navigation_label">{{ctx.Locale.Tr "repo.issues.previous"}}</span> </a> - {{range .Pages}} + {{$pages := .Pages}} + {{$pagesLen := len $pages}} + {{range $pages}} {{if eq .Num -1}} <a class="disabled item">...</a> {{else}} - <a class="{{if .IsCurrent}}active {{end}}item tw-content-center" {{if not .IsCurrent}}href="{{$paginationLink}}?page={{.Num}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}>{{.Num}}</a> + {{/* do not highlight the current page if there is only one page */}} + <a class="{{if and .IsCurrent (gt $pagesLen 1)}}active {{end}}item" {{if not .IsCurrent}}href="{{$paginationLink}}?page={{.Num}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}>{{.Num}}</a> {{end}} {{end}} <a class="{{if not .HasNext}}disabled{{end}} item navigation" {{if .HasNext}}href="{{$paginationLink}}?page={{.Next}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}> <span class="navigation_label">{{ctx.Locale.Tr "repo.issues.next"}}</span> {{svg "octicon-chevron-right" 16 "tw-ml-1"}} </a> + + {{if $showFirstLast}} <a class="{{if .IsLast}}disabled{{end}} item navigation" {{if not .IsLast}}href="{{$paginationLink}}?page={{.TotalPages}}{{if $paginationParams}}&{{$paginationParams}}{{end}}"{{end}}> <span class="navigation_label">{{ctx.Locale.Tr "admin.last_page"}}</span> {{svg "gitea-double-chevron-right" 16 "tw-ml-1"}} </a> + {{end}} </div> </div> {{end}} diff --git a/templates/devtest/badge-actions-svg.tmpl b/templates/devtest/badge-actions-svg.tmpl new file mode 100644 index 0000000000..5be4fb3131 --- /dev/null +++ b/templates/devtest/badge-actions-svg.tmpl @@ -0,0 +1,25 @@ +{{template "devtest/devtest-header"}} +<div class="page-content devtest ui container"> + <div> + <h1>Actions SVG</h1> + <form class="tw-my-3"> + <div class="tw-mb-2"> + {{range $fontName := .BadgeFontFamilyNames}} + <label><input name="font" type="radio" value="{{$fontName}}" {{Iif (eq $.SelectedFontFamilyName $fontName) "checked"}}>{{$fontName}}</label> + {{end}} + </div> + <div class="tw-mb-2"> + {{range $style := .BadgeStyles}} + <label><input name="style" type="radio" value="{{$style}}" {{Iif (eq $.SelectedStyle $style) "checked"}}>{{$style}}</label> + {{end}} + </div> + <button>submit</button> + </form> + <div class="flex-text-block tw-flex-wrap"> + {{range $badgeSVG := .BadgeSVGs}} + <div>{{$badgeSVG}}</div> + {{end}} + </div> + </div> +</div> +{{template "devtest/devtest-footer"}} diff --git a/templates/devtest/commit-sign-badge.tmpl b/templates/devtest/badge-commit-sign.tmpl index a6677c4495..a6677c4495 100644 --- a/templates/devtest/commit-sign-badge.tmpl +++ b/templates/devtest/badge-commit-sign.tmpl diff --git a/templates/devtest/flex-list.tmpl b/templates/devtest/flex-list.tmpl index 11d71d56a9..0db84b0c59 100644 --- a/templates/devtest/flex-list.tmpl +++ b/templates/devtest/flex-list.tmpl @@ -68,7 +68,7 @@ <a class="text primary" href="{{$.Link}}"> gitea-org / gitea </a> - <span data-tooltip-content="{{ctx.Locale.Tr "repo.fork"}}">{{svg "octicon-repo-forked"}}</span> + <span class="flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.fork"}}">{{svg "octicon-repo-forked"}}</span> </div> <div class="flex-item-trailing"> <a class="muted" href="{{$.Link}}"> diff --git a/templates/devtest/fomantic-dropdown.tmpl b/templates/devtest/fomantic-dropdown.tmpl index d41a161e86..a10dc890ce 100644 --- a/templates/devtest/fomantic-dropdown.tmpl +++ b/templates/devtest/fomantic-dropdown.tmpl @@ -75,12 +75,12 @@ <h2>Selection</h2> <div> {{/* the "selection" class is optional, it will be added by JS automatically */}} - <select class="ui dropdown selection ellipsis-items-nowrap"> + <select class="ui dropdown selection ellipsis-text-items"> <option>a</option> <option>abcdefuvwxyz</option> <option>loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong</option> </select> - <select class="ui dropdown ellipsis-items-nowrap tw-max-w-[8em]"> + <select class="ui dropdown ellipsis-text-items tw-max-w-[8em]"> <option>loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong</option> <option>abcdefuvwxyz</option> <option>a</option> diff --git a/templates/devtest/fomantic-modal.tmpl b/templates/devtest/fomantic-modal.tmpl index 2fbe2bd97d..838c6893a4 100644 --- a/templates/devtest/fomantic-modal.tmpl +++ b/templates/devtest/fomantic-modal.tmpl @@ -49,6 +49,16 @@ </form> </div> + <div id="test-modal-form-5" class="ui mini modal"> + <div class="header">Form dialog (layout 5)</div> + <div class="content"> + <form method="post"> + <div class="ui input tw-w-full"><input name="user_input"></div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> + </div> + </div> + <div class="ui g-modal-confirm modal" id="test-modal-default"> <div class="header">{{svg "octicon-file"}} Default dialog <span>title</span></div> <div class="content"> diff --git a/templates/devtest/gitea-ui.tmpl b/templates/devtest/gitea-ui.tmpl index 5b40268761..7a435cc433 100644 --- a/templates/devtest/gitea-ui.tmpl +++ b/templates/devtest/gitea-ui.tmpl @@ -9,16 +9,16 @@ <a class="silenced" href="#">silenced</a> </div> <h1>Button</h1> - <div> - Style: - <label><input type="checkbox" name="button-style-compact" value="compact">compact</label> - <label><input type="radio" name="button-style-size" value="">(normal)</label> - <label><input type="radio" name="button-style-size" value="tiny">tiny</label> - <label><input type="radio" name="button-style-size" value="mini">mini</label> + ".ui.button" styles: + <div class="flex-text-block tw-gap-4"> + <label class="gt-checkbox"><input type="radio" name="button-style-size" value="">(normal)</label> + <label class="gt-checkbox"><input type="radio" name="button-style-size" value="small">small</label> + <label class="gt-checkbox"><input type="radio" name="button-style-size" value="tiny">tiny</label> + <label class="gt-checkbox"><input type="radio" name="button-style-size" value="mini">mini</label> </div> - <div> - State: - <label><input type="checkbox" name="button-state-disabled" value="disabled">disabled</label> + <div class="flex-text-block tw-gap-4"> + <label class="gt-checkbox"><input type="checkbox" name="button-style-compact" value="compact">compact</label> + <label class="gt-checkbox"><input type="checkbox" name="button-state-disabled" value="disabled">disabled</label> </div> <div id="devtest-button-samples"> <ul class="button-sample-groups"> diff --git a/templates/devtest/markup-render.tmpl b/templates/devtest/markup-render.tmpl new file mode 100644 index 0000000000..69d29d7829 --- /dev/null +++ b/templates/devtest/markup-render.tmpl @@ -0,0 +1,71 @@ +{{template "devtest/devtest-header"}} +<div class="page-content devtest ui container"> + {{$longCode := "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}} + <div class="tw-flex"> + <div class="tw-w-[50%] tw-p-4"> + <div class="markup render-content"> + Inline <code>code</code> content + </div> + + <div class="divider"></div> + + <div class="markup render-content"> + <p>content before</p> + <pre><code>Very long line with no code block or container: {{$longCode}}</code></pre> + <p>content after</p> + </div> + + <div class="divider"></div> + + <div class="markup render-content"> + <p>content before</p> + <div class="code-block-container code-overflow-wrap"> + <pre class="code-block"><code>Very long line with wrap: {{$longCode}}</code></pre> + </div> + <p>content after</p> + </div> + + <div class="divider"></div> + + <div class="markup render-content"> + <p>content before</p> + <div class="code-block-container code-overflow-scroll"> + <pre class="code-block"><code>Short line in scroll container</code></pre> + </div> + <div class="code-block-container code-overflow-scroll"> + <pre class="code-block"><code>Very long line with scroll: {{$longCode}}</code></pre> + </div> + <p>content after</p> + </div> + </div> + + <div class="tw-w-[50%] tw-p-4"> + <div class="markup render-content"> + <p>content before</p> + <div class="code-block-container"> + <pre class="code-block"><code class="language-math"> + \lim\limits_{n\rightarrow\infty}{\left(1+\frac{1}{n}\right)^n} + </code></pre> + </div> + <p>content after</p> + </div> + + <div class="divider"></div> + + <div class="markup render-content"> + <p>content before</p> + <div class="code-block-container"> + <pre class="code-block"><code class="language-mermaid is-loading"> + graph LR + A[Square Rect] -- Link text --> B((Circle)) + A --> C(Round Rect) + B --> D{Rhombus} + C --> D + </code></pre> + </div> + <p>content after</p> + </div> + </div> + </div> +</div> +{{template "devtest/devtest-footer"}} diff --git a/templates/devtest/repo-action-view.tmpl b/templates/devtest/repo-action-view.tmpl index 9c6bdf13da..677eccc062 100644 --- a/templates/devtest/repo-action-view.tmpl +++ b/templates/devtest/repo-action-view.tmpl @@ -1,8 +1,13 @@ {{template "base/head" .}} <div class="page-content"> + <div class="tw-flex tw-justify-center tw-items-center tw-gap-5"> + <a href="/devtest/repo-action-view/10/100">Run:CanCancel</a> + <a href="/devtest/repo-action-view/20/200">Run:CanApprove</a> + <a href="/devtest/repo-action-view/30/300">Run:CanRerun</a> + </div> {{template "repo/actions/view_component" (dict - "RunIndex" 1 - "JobIndex" 2 + "RunIndex" (or .RunID 10) + "JobIndex" (or .JobID 100) "ActionsURL" (print AppSubUrl "/devtest/actions-mock") )}} </div> diff --git a/templates/explore/repos.tmpl b/templates/explore/repos.tmpl index 53742bf0d9..68da398306 100644 --- a/templates/explore/repos.tmpl +++ b/templates/explore/repos.tmpl @@ -2,8 +2,8 @@ <div role="main" aria-label="{{.Title}}" class="page-content explore repositories"> {{template "explore/navbar" .}} <div class="ui container"> - {{template "shared/repo_search" .}} - {{template "explore/repo_list" .}} + {{template "shared/repo/search" .}} + {{template "shared/repo/list" .}} {{template "base/paginate" .}} </div> </div> diff --git a/templates/home.tmpl b/templates/home.tmpl index 116dc487dc..cc9da82605 100644 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -4,10 +4,10 @@ <div class="center"> <img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}"> <div class="hero"> - <h1 class="ui icon header title"> + <h1 class="ui icon header title tw-text-balance"> {{AppName}} </h1> - <h2>{{ctx.Locale.Tr "startpage.app_desc"}}</h2> + <h2 class="tw-text-balance">{{ctx.Locale.Tr "startpage.app_desc"}}</h2> </div> </div> </div> @@ -16,7 +16,7 @@ <h1 class="hero ui icon header"> {{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}} </h1> - <p class="large"> + <p class="large tw-text-balance"> {{ctx.Locale.Tr "startpage.install_desc" "https://docs.gitea.com/installation/install-from-binary" "https://github.com/go-gitea/gitea/tree/master/docker" "https://docs.gitea.com/installation/install-from-package"}} </p> </div> @@ -24,7 +24,7 @@ <h1 class="hero ui icon header"> {{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}} </h1> - <p class="large"> + <p class="large tw-text-balance"> {{ctx.Locale.Tr "startpage.platform_desc" "https://go.dev/"}} </p> </div> @@ -34,7 +34,7 @@ <h1 class="hero ui icon header"> {{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}} </h1> - <p class="large"> + <p class="large tw-text-balance"> {{ctx.Locale.Tr "startpage.lightweight_desc"}} </p> </div> @@ -42,7 +42,7 @@ <h1 class="hero ui icon header"> {{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}} </h1> - <p class="large"> + <p class="large tw-text-balance"> {{ctx.Locale.Tr "startpage.license_desc" "https://code.gitea.io/gitea" "code.gitea.io/gitea" "https://github.com/go-gitea/gitea"}} </p> </div> diff --git a/templates/install.tmpl b/templates/install.tmpl index 6c4cc7df01..0aec52f27b 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content install"> <div class="ui grid install-config-container"> - <div class="sixteen wide center aligned centered column"> + <div class="sixteen wide tw-text-center centered column"> <h3 class="ui top attached header"> {{ctx.Locale.Tr "install.title"}} </h3> @@ -351,5 +351,4 @@ </div> </div> </div> -<img class="tw-hidden" src="{{AssetUrlPrefix}}/img/loading.png"> {{template "base/footer" .}} diff --git a/templates/org/create.tmpl b/templates/org/create.tmpl index 004cd9be80..2d6dca5440 100644 --- a/templates/org/create.tmpl +++ b/templates/org/create.tmpl @@ -1,55 +1,51 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content organization new org"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + {{template "base/alert" .}} + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "new_org"}} + </h3> + <div class="ui attached segment"> + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "new_org"}} - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_OrgName}}error{{end}}"> - <label for="org_name">{{ctx.Locale.Tr "org.org_name_holder"}}</label> - <input id="org_name" name="org_name" value="{{.org_name}}" autofocus required maxlength="40"> - <span class="help">{{ctx.Locale.Tr "org.org_name_helper"}}</span> - </div> + <div class="inline required field {{if .Err_OrgName}}error{{end}}"> + <label for="org_name">{{ctx.Locale.Tr "org.org_name_holder"}}</label> + <input id="org_name" name="org_name" value="{{.org_name}}" autofocus required maxlength="40"> + <span class="help">{{ctx.Locale.Tr "org.org_name_helper"}}</span> + </div> - <div class="inline field {{if .Err_OrgVisibility}}error{{end}}"> - <span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label></span> - <div class="inline-grouped-list"> - <div class="ui radio checkbox"> - <input class="enable-system-radio" name="visibility" type="radio" value="0" {{if .DefaultOrgVisibilityMode.IsPublic}}checked{{end}}> - <label>{{ctx.Locale.Tr "org.settings.visibility.public"}}</label> - </div> - <div class="ui radio checkbox"> - <input class="enable-system-radio" name="visibility" type="radio" value="1" {{if .DefaultOrgVisibilityMode.IsLimited}}checked{{end}}> - <label>{{ctx.Locale.Tr "org.settings.visibility.limited"}}</label> - </div> - <div class="ui radio checkbox"> - <input class="enable-system-radio" name="visibility" type="radio" value="2" {{if .DefaultOrgVisibilityMode.IsPrivate}}checked{{end}}> - <label>{{ctx.Locale.Tr "org.settings.visibility.private"}}</label> - </div> + <div class="inline field required {{if .Err_OrgVisibility}}error{{end}}"> + <label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label> + <div class="inline-right"> + <div class="ui radio checkbox"> + <input class="enable-system-radio" name="visibility" type="radio" value="0" {{if .visibility.IsPublic}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.visibility.public"}}</label> </div> - </div> - - <div class="inline field" id="permission_box"> - <label>{{ctx.Locale.Tr "org.settings.permission"}}</label> - <div class="inline-grouped-list"> - <div class="ui checkbox"> - <input type="checkbox" name="repo_admin_change_team_access" checked> - <label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label> - </div> + <div class="ui radio checkbox"> + <input class="enable-system-radio" name="visibility" type="radio" value="1" {{if .visibility.IsLimited}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.visibility.limited"}}</label> + </div> + <div class="ui radio checkbox"> + <input class="enable-system-radio" name="visibility" type="radio" value="2" {{if .visibility.IsPrivate}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.visibility.private"}}</label> </div> </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "org.create_org"}} - </button> + <div class="inline field" id="permission_box"> + <label>{{ctx.Locale.Tr "org.settings.permission"}}</label> + <div class="ui checkbox"> + <input type="checkbox" name="repo_admin_change_team_access" {{if .repo_admin_change_team_access}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label> </div> </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "org.create_org"}} + </button> + </div> </form> </div> </div> diff --git a/templates/org/header.tmpl b/templates/org/header.tmpl index 80519361fd..90798b5d7c 100644 --- a/templates/org/header.tmpl +++ b/templates/org/header.tmpl @@ -18,7 +18,7 @@ {{end}} </span> </div> - {{if .RenderedDescription}}<div class="render-content markup tw-break-anywhere">{{.RenderedDescription}}</div>{{end}} + {{if .RenderedDescription}}<div class="render-content markup">{{.RenderedDescription}}</div>{{end}} <div class="text light meta tw-mt-1"> {{if .Org.Location}}<div class="flex-text-block">{{svg "octicon-location"}} <span>{{.Org.Location}}</span></div>{{end}} {{if .Org.Website}}<div class="flex-text-block">{{svg "octicon-link"}} <a class="muted" target="_blank" rel="noopener noreferrer me" href="{{.Org.Website}}">{{.Org.Website}}</a></div>{{end}} diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index db750692bf..3cde3554c9 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -6,20 +6,20 @@ <div class="ui mobile reversed stackable grid"> <div class="ui {{if .ShowMemberAndTeamTab}}eleven wide{{end}} column"> {{if .ProfileReadmeContent}} - <div id="readme_profile" class="markup" data-profile-view-as-member="{{.IsViewingOrgAsMember}}">{{.ProfileReadmeContent}}</div> + <div id="readme_profile" class="render-content markup" data-profile-view-as-member="{{.IsViewingOrgAsMember}}">{{.ProfileReadmeContent}}</div> {{end}} - {{template "shared/repo_search" .}} - {{template "explore/repo_list" .}} + {{template "shared/repo/search" .}} + {{template "shared/repo/list" .}} {{template "base/paginate" .}} </div> {{if .ShowMemberAndTeamTab}} <div class="ui five wide column"> {{if .CanCreateOrgRepo}} - <div class="center aligned tw-mb-4"> - <a class="ui primary button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{ctx.Locale.Tr "new_repo"}}</a> + <div class="tw-flex tw-flex-wrap tw-justify-center tw-gap-x-1 tw-gap-y-2 tw-mb-4"> + <a class="ui primary button tw-grow" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{ctx.Locale.Tr "new_repo"}}</a> {{if not .DisableNewPullMirrors}} - <a class="ui primary button" href="{{AppSubUrl}}/repo/migrate?org={{.Org.ID}}&mirror=1">{{ctx.Locale.Tr "new_migrate"}}</a> + <a class="ui primary button tw-grow" href="{{AppSubUrl}}/repo/migrate?org={{.Org.ID}}&mirror=1">{{ctx.Locale.Tr "new_migrate"}}</a> {{end}} </div> <div class="divider"></div> @@ -32,7 +32,6 @@ <span class="text">{{svg "octicon-eye"}} {{ctx.Locale.Tr "org.view_as_role" $viewAsRole}}</span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> - {{/* TODO: does it really need to use CurrentURL with query parameters? Why not construct a new link with clear parameters */}} <a href="?view_as=public" class="item {{if not .IsViewingOrgAsMember}}selected{{end}}"> {{svg "octicon-check" 14 (Iif (not .IsViewingOrgAsMember) "" "tw-invisible")}} {{ctx.Locale.Tr "settings.visibility.public"}} </a> diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 4388dc9520..2d0f4bc423 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -73,7 +73,7 @@ {{ctx.Locale.Tr "org.members.leave"}} </div> <div class="content"> - <p>{{ctx.Locale.Tr "org.members.leave.detail" (`<span class="dataOrganizationName"></span>`|SafeHTML)}}</p> + <p>{{ctx.Locale.Tr "org.members.leave.detail" (HTMLFormat `<span class="%s"></span>` "dataOrganizationName")}}</p> </div> {{template "base/modal_actions_confirm" .}} </div> @@ -82,7 +82,7 @@ {{ctx.Locale.Tr "org.members.remove"}} </div> <div class="content"> - <p>{{ctx.Locale.Tr "org.members.remove.detail" (`<span class="name"></span>`|SafeHTML) (`<span class="dataOrganizationName"></span>`|SafeHTML)}}</p> + <p>{{ctx.Locale.Tr "org.members.remove.detail" (HTMLFormat `<span class="%s"></span>` "name") (HTMLFormat `<span class="%s"></span>` "dataOrganizationName")}}</p> </div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/org/menu.tmpl b/templates/org/menu.tmpl index 4a8aee68a7..d876dabb44 100644 --- a/templates/org/menu.tmpl +++ b/templates/org/menu.tmpl @@ -44,6 +44,11 @@ {{end}} </a> {{end}} + {{if and EnableTimetracking .IsOrganizationOwner}} + <a class="{{if $.PageIsOrgTimes}}active{{end}} item" href="{{$.OrgLink}}/worktime"> + {{svg "octicon-clock"}} {{ctx.Locale.Tr "org.worktime"}} + </a> + {{end}} {{if .IsOrganizationOwner}} <span class="item-flex-space"></span> <a class="{{if .PageIsOrgSettings}}active {{end}}item" href="{{.OrgLink}}/settings"> diff --git a/templates/org/projects/new.tmpl b/templates/org/projects/new.tmpl index fc52130f68..c021c5a0fe 100644 --- a/templates/org/projects/new.tmpl +++ b/templates/org/projects/new.tmpl @@ -1,9 +1,24 @@ {{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content organization projects edit-project new"> - {{template "shared/user/org_profile_avatar" .}} +{{if .ContextUser.IsOrganization}} +<div role="main" aria-label="{{.Title}}" class="page-content organization projects"> + {{template "org/header" .}} <div class="ui container"> - {{template "user/overview/header" .}} - {{template "projects/new" .}} + {{template "projects/new" .}} </div> </div> +{{else}} +<div role="main" aria-label="{{.Title}}" class="page-content user profile"> + <div class="ui container"> + <div class="ui stackable grid"> + <div class="ui four wide column"> + {{template "shared/user/profile_big_avatar" .}} + </div> + <div class="ui twelve wide column tw-mb-4"> + {{template "user/overview/header" .}} + {{template "projects/new" .}} + </div> + </div> + </div> +</div> +{{end}} {{template "base/footer" .}} diff --git a/templates/org/projects/view.tmpl b/templates/org/projects/view.tmpl index bd74114fe2..1bfbc8d8b4 100644 --- a/templates/org/projects/view.tmpl +++ b/templates/org/projects/view.tmpl @@ -8,8 +8,6 @@ {{template "user/overview/header" .}} </div> {{end}} - <div class="ui container fluid padded"> - {{template "projects/view" .}} - </div> + {{template "projects/view" .}} </div> {{template "base/footer" .}} diff --git a/templates/org/settings/delete.tmpl b/templates/org/settings/delete.tmpl deleted file mode 100644 index e1ef471e34..0000000000 --- a/templates/org/settings/delete.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings delete")}} - - <div class="org-setting-content"> - <h4 class="ui top attached error header"> - {{ctx.Locale.Tr "org.settings.delete_account"}} - </h4> - <div class="ui attached error segment"> - <div class="ui red message"> - <p class="text left">{{svg "octicon-alert"}} {{ctx.Locale.Tr "org.settings.delete_prompt"}}</p> - </div> - <form class="ui form ignore-dirty" id="delete-form" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <div class="inline required field {{if .Err_OrgName}}error{{end}}"> - <label for="org_name">{{ctx.Locale.Tr "org.org_name_holder"}}</label> - <input id="org_name" name="org_name" value="" autocomplete="off" autofocus required> - </div> - <button class="ui red button delete-button" data-type="form" data-form="#delete-form"> - {{ctx.Locale.Tr "org.settings.confirm_delete_account"}} - </button> - </form> - </div> - </div> - -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "org.settings.delete_org_title"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "org.settings.delete_org_desc"}}</p> - </div> - {{template "base/modal_actions_confirm" .}} -</div> - -{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/hooks.tmpl b/templates/org/settings/hooks.tmpl index 9f307968f8..b05e22fe20 100644 --- a/templates/org/settings/hooks.tmpl +++ b/templates/org/settings/hooks.tmpl @@ -1,5 +1,5 @@ {{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings webhooks")}} <div class="org-setting-content"> - {{template "repo/settings/webhook/list" .}} + {{template "repo/settings/webhook/base_list" .}} </div> {{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl index ce792f667c..58475de7e7 100644 --- a/templates/org/settings/navbar.tmpl +++ b/templates/org/settings/navbar.tmpl @@ -41,8 +41,5 @@ </div> </details> {{end}} - <a class="{{if .PageIsSettingsDelete}}active {{end}}item" href="{{.OrgLink}}/settings/delete"> - {{ctx.Locale.Tr "org.settings.delete"}} - </a> </div> </div> diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index 3b817d068b..d94bb4c62b 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -1,103 +1,97 @@ {{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings options")}} - <div class="org-setting-content"> - <h4 class="ui top attached header"> - {{ctx.Locale.Tr "org.settings.options"}} - </h4> - <div class="ui attached segment"> - <form class="ui form" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <div class="required field {{if .Err_Name}}error{{end}}"> - <label for="org_name">{{ctx.Locale.Tr "org.org_name_holder"}} - <span class="text red tw-hidden" id="org-name-change-prompt"> - <br>{{ctx.Locale.Tr "org.settings.change_orgname_prompt"}}<br>{{ctx.Locale.Tr "org.settings.change_orgname_redirect_prompt"}} - </span> - </label> - <input id="org_name" name="name" value="{{.Org.Name}}" data-org-name="{{.Org.Name}}" autofocus required maxlength="40"> - </div> - <div class="field {{if .Err_FullName}}error{{end}}"> - <label for="full_name">{{ctx.Locale.Tr "org.org_full_name_holder"}}</label> - <input id="full_name" name="full_name" value="{{.Org.FullName}}" maxlength="100"> - </div> - <div class="field {{if .Err_Email}}error{{end}}"> - <label for="email">{{ctx.Locale.Tr "org.settings.email"}}</label> - <input id="email" name="email" type="email" value="{{.Org.Email}}" maxlength="255"> - </div> - <div class="field {{if .Err_Description}}error{{end}}"> - {{/* it is rendered as markdown, but the length is limited, so at the moment we do not use the markdown editor here */}} - <label for="description">{{ctx.Locale.Tr "org.org_desc"}}</label> - <textarea id="description" name="description" rows="2" maxlength="255">{{.Org.Description}}</textarea> - </div> - <div class="field {{if .Err_Website}}error{{end}}"> - <label for="website">{{ctx.Locale.Tr "org.settings.website"}}</label> - <input id="website" name="website" type="url" value="{{.Org.Website}}" maxlength="255"> - </div> - <div class="field"> - <label for="location">{{ctx.Locale.Tr "org.settings.location"}}</label> - <input id="location" name="location" value="{{.Org.Location}}" maxlength="50"> - </div> - <div class="divider"></div> - <div class="field" id="visibility_box"> - <label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label> - <div class="field"> - <div class="ui radio checkbox"> - <input class="enable-system-radio" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}> - <label>{{ctx.Locale.Tr "org.settings.visibility.public"}}</label> - </div> - </div> - <div class="field"> - <div class="ui radio checkbox"> - <input class="enable-system-radio" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}> - <label>{{ctx.Locale.Tr "org.settings.visibility.limited"}}</label> - </div> - </div> - <div class="field"> - <div class="ui radio checkbox"> - <input class="enable-system-radio" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}> - <label>{{ctx.Locale.Tr "org.settings.visibility.private"}}</label> - </div> - </div> - </div> +<div class="ui segments org-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "org.settings.options"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_FullName}}error{{end}}"> + <label for="full_name">{{ctx.Locale.Tr "org.org_full_name_holder"}}</label> + <input id="full_name" name="full_name" value="{{.Org.FullName}}" maxlength="100"> + </div> + <div class="field {{if .Err_Email}}error{{end}}"> + <label for="email">{{ctx.Locale.Tr "org.settings.email"}}</label> + <input id="email" name="email" type="email" value="{{.Org.Email}}" maxlength="255"> + </div> + <div class="field {{if .Err_Description}}error{{end}}"> + {{/* it is rendered as markdown, but the length is limited, so at the moment we do not use the markdown editor here */}} + <label for="description">{{ctx.Locale.Tr "org.org_desc"}}</label> + <textarea id="description" name="description" rows="2" maxlength="255">{{.Org.Description}}</textarea> + </div> + <div class="field {{if .Err_Website}}error{{end}}"> + <label for="website">{{ctx.Locale.Tr "org.settings.website"}}</label> + <input id="website" name="website" type="url" value="{{.Org.Website}}" maxlength="255"> + </div> + <div class="field"> + <label for="location">{{ctx.Locale.Tr "org.settings.location"}}</label> + <input id="location" name="location" value="{{.Org.Location}}" maxlength="50"> + </div> - <div class="field" id="permission_box"> - <label>{{ctx.Locale.Tr "org.settings.permission"}}</label> - <div class="field"> - <div class="ui checkbox"> - <input type="checkbox" name="repo_admin_change_team_access" {{if .RepoAdminChangeTeamAccess}}checked{{end}}> - <label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label> - </div> - </div> - </div> + <div class="divider"></div> + <div class="field" id="visibility_box"> + <label for="visibility">{{ctx.Locale.Tr "org.settings.visibility"}}</label> + <div class="field"> + <div class="ui radio checkbox"> + <input class="enable-system-radio" name="visibility" type="radio" value="0" {{if eq .CurrentVisibility 0}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.visibility.public"}}</label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input class="enable-system-radio" name="visibility" type="radio" value="1" {{if eq .CurrentVisibility 1}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.visibility.limited"}}</label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input class="enable-system-radio" name="visibility" type="radio" value="2" {{if eq .CurrentVisibility 2}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.visibility.private"}}</label> + </div> + </div> + </div> - {{if .SignedUser.IsAdmin}} - <div class="divider"></div> + <div class="field" id="permission_box"> + <label>{{ctx.Locale.Tr "org.settings.permission"}}</label> + <div class="field"> + <div class="ui checkbox"> + <input type="checkbox" name="repo_admin_change_team_access" {{if .RepoAdminChangeTeamAccess}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.settings.repoadminchangeteam"}}</label> + </div> + </div> + </div> - <div class="inline field {{if .Err_MaxRepoCreation}}error{{end}}"> - <label for="max_repo_creation">{{ctx.Locale.Tr "admin.users.max_repo_creation"}}</label> - <input id="max_repo_creation" name="max_repo_creation" type="number" min="-1" value="{{.Org.MaxRepoCreation}}"> - <p class="help">{{ctx.Locale.Tr "admin.users.max_repo_creation_desc"}}</p> - </div> - {{end}} + {{if .SignedUser.IsAdmin}} + <div class="divider"></div> - <div class="field"> - <button class="ui primary button">{{ctx.Locale.Tr "org.settings.update_settings"}}</button> - </div> - </form> + <div class="inline field {{if .Err_MaxRepoCreation}}error{{end}}"> + <label for="max_repo_creation">{{ctx.Locale.Tr "admin.users.max_repo_creation"}}</label> + <input id="max_repo_creation" name="max_repo_creation" type="number" min="-1" value="{{.Org.MaxRepoCreation}}"> + <p class="help">{{ctx.Locale.Tr "admin.users.max_repo_creation_desc"}}</p> + </div> + {{end}} - <div class="divider"></div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "org.settings.update_settings"}}</button> + </div> + </form> - <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="divider"></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> + <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + <div class="inline field"> + {{template "shared/avatar_upload_crop" dict "LabelText" (ctx.Locale.Tr "settings.choose_new_avatar")}} + </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> +</div> + +{{template "org/settings/options_dangerzone" .}} + {{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/options_dangerzone.tmpl b/templates/org/settings/options_dangerzone.tmpl new file mode 100644 index 0000000000..01cf3fd405 --- /dev/null +++ b/templates/org/settings/options_dangerzone.tmpl @@ -0,0 +1,93 @@ +<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"> + <div class="flex-item tw-items-center"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "org.settings.rename"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "org.settings.rename_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#rename-org-modal">{{ctx.Locale.Tr "org.settings.rename"}}</button> + </div> + </div> + + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "org.settings.delete_account"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "org.settings.delete_prompt"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#delete-org-modal">{{ctx.Locale.Tr "org.settings.delete_account"}}</button> + </div> + </div> + </div> +</div> + +<div class="ui small modal" id="rename-org-modal"> + <div class="header"> + {{ctx.Locale.Tr "org.settings.rename"}} + </div> + <div class="content"> + <ul class="ui warning message"> + <li>{{ctx.Locale.Tr "org.settings.rename_notices_1"}}</li> + <li>{{ctx.Locale.Tr "org.settings.rename_notices_2"}}</li> + </ul> + <form class="ui form form-fetch-action" action="{{.Link}}/rename" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label> + {{ctx.Locale.Tr "org.settings.name_confirm"}} + <span class="text red">{{.Org.Name}}</span> + </label> + </div> + <div class="required field"> + <label for="org_name_to_rename">{{ctx.Locale.Tr "org.org_name_holder"}}</label> + <input id="org_name_to_rename" name="org_name" required> + </div> + + <div class="required field"> + <label>{{ctx.Locale.Tr "org.settings.rename_new_org_name"}}</label> + <input name="new_org_name" required> + </div> + + <div class="actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "org.settings.rename"}}</button> + </div> + </form> + </div> +</div> + +<div class="ui small modal" id="delete-org-modal"> + <div class="header"> + {{ctx.Locale.Tr "org.settings.delete_account"}} + </div> + <div class="content"> + <ul class="ui warning message"> + <li>{{ctx.Locale.Tr "org.settings.delete_notices_1"}}</li> + <li>{{ctx.Locale.Tr "org.settings.delete_notices_2" .Org.Name}}</li> + <li>{{ctx.Locale.Tr "org.settings.delete_notices_3" .Org.Name}}</li> + <li>{{ctx.Locale.Tr "org.settings.delete_notices_4" .Org.Name}}</li> + </ul> + <form class="ui form form-fetch-action" action="{{.Link}}/delete" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label> + {{ctx.Locale.Tr "org.settings.name_confirm"}} + <span class="text red">{{.Org.Name}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "org.org_name_holder"}}</label> + <input name="org_name" required> + </div> + + <div class="actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "org.settings.delete_account"}}</button> + </div> + </form> + </div> +</div> diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index 5433f01530..4bc063f90c 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -81,7 +81,7 @@ {{ctx.Locale.Tr "org.members.remove"}} </div> <div class="content"> - <p>{{ctx.Locale.Tr "org.members.remove.detail" (`<span class="name"></span>`|SafeHTML) (`<span class="dataTeamName"></span>`|SafeHTML)}}</p> + <p>{{ctx.Locale.Tr "org.members.remove.detail" (HTMLFormat `<span class="%s"></span>` "name") (HTMLFormat `<span class="%s"></span>` "dataTeamName")}}</p> </div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl index 410a3c4b62..67529ddfba 100644 --- a/templates/org/team/new.tmpl +++ b/templates/org/team/new.tmpl @@ -56,7 +56,7 @@ <br> <div class="field"> <div class="ui radio checkbox"> - <input type="radio" name="permission" value="read" {{if or .PageIsOrgTeamsNew (eq .Team.AccessMode 1) (eq .Team.AccessMode 2)}}checked{{end}}> + <input type="radio" name="permission" value="read" {{if or .PageIsOrgTeamsNew (eq .Team.AccessMode 0) (eq .Team.AccessMode 1) (eq .Team.AccessMode 2)}}checked{{end}}> <label>{{ctx.Locale.Tr "org.teams.general_access"}}</label> <span class="help">{{ctx.Locale.Tr "org.teams.general_access_helper"}}</span> </div> @@ -77,11 +77,11 @@ <thead> <tr> <th>{{ctx.Locale.Tr "units.unit"}}</th> - <th class="center aligned">{{ctx.Locale.Tr "org.teams.none_access"}} + <th class="tw-text-center">{{ctx.Locale.Tr "org.teams.none_access"}} <span class="tw-align-middle" data-tooltip-content="{{ctx.Locale.Tr "org.teams.none_access_helper"}}">{{svg "octicon-question" 16 "tw-ml-1"}}</span></th> - <th class="center aligned">{{ctx.Locale.Tr "org.teams.read_access"}} + <th class="tw-text-center">{{ctx.Locale.Tr "org.teams.read_access"}} <span class="tw-align-middle" data-tooltip-content="{{ctx.Locale.Tr "org.teams.read_access_helper"}}">{{svg "octicon-question" 16 "tw-ml-1"}}</span></th> - <th class="center aligned">{{ctx.Locale.Tr "org.teams.write_access"}} + <th class="tw-text-center">{{ctx.Locale.Tr "org.teams.write_access"}} <span class="tw-align-middle" data-tooltip-content="{{ctx.Locale.Tr "org.teams.write_access_helper"}}">{{svg "octicon-question" 16 "tw-ml-1"}}</span></th> </tr> </thead> @@ -97,17 +97,17 @@ </div> </div> </td> - <td class="center aligned"> + <td class="tw-text-center"> <div class="ui radio checkbox"> <input type="radio" name="unit_{{$unit.Type.Value}}" value="0"{{if or ($unit.Type.UnitGlobalDisabled) (eq ($.Team.UnitAccessMode ctx $unit.Type) 0)}} checked{{end}} title="{{ctx.Locale.Tr "org.teams.none_access"}}"> </div> </td> - <td class="center aligned"> + <td class="tw-text-center"> <div class="ui radio checkbox"> <input type="radio" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode ctx $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}} title="{{ctx.Locale.Tr "org.teams.read_access"}}"> </div> </td> - <td class="center aligned"> + <td class="tw-text-center"> <div class="ui radio checkbox"> <input type="radio" name="unit_{{$unit.Type.Value}}" value="2"{{if (ge ($.Team.UnitAccessMode ctx $unit.Type) 2)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}} title="{{ctx.Locale.Tr "org.teams.write_access"}}"> </div> diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl index 92c3d724ba..4f4667ca8b 100644 --- a/templates/org/team/repositories.tmpl +++ b/templates/org/team/repositories.tmpl @@ -9,7 +9,7 @@ {{template "org/team/navbar" .}} {{$canAddRemove := and $.IsOrganizationOwner (not $.Team.IncludesAllRepositories)}} {{if $canAddRemove}} - <div class="ui attached segment tw-flex tw-flex-wrap tw-gap-2"> + <div class="ui top attached segment tw-flex tw-flex-wrap tw-gap-2"> <form class="ui form ignore-dirty tw-flex-1 tw-flex" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/add" method="post"> {{.CsrfTokenHtml}} <div id="search-repo-box" data-uid="{{.Org.ID}}" class="ui search"> diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index c4acd8da24..6dd5cb3eeb 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -42,10 +42,12 @@ <li>{{ctx.Locale.Tr "org.teams.can_create_org_repo"}}</li> {{end}} </ul> - {{if (eq .Team.AccessMode 2)}} + {{/* the AccessMode should be either none or admin/owner, the real permissions are provided by each team unit */}} + {{if false}}{{/*(eq .Team.AccessMode 2)*/}} <h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3> {{ctx.Locale.Tr "org.teams.write_permission_desc"}} {{else if (eq .Team.AccessMode 3)}} + {{/* FIXME: here might not right, see "FIXME: TEAM-UNIT-PERMISSION", new units might not have correct admin permission*/}} <h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3> {{ctx.Locale.Tr "org.teams.admin_permission_desc"}} {{else}} @@ -88,7 +90,7 @@ {{ctx.Locale.Tr "org.teams.leave"}} </div> <div class="content"> - <p>{{ctx.Locale.Tr "org.teams.leave.detail" (`<span class="name"></span>`|SafeHTML)}}</p> + <p>{{ctx.Locale.Tr "org.teams.leave.detail" (HTMLFormat `<span class="%s"></span>` "name")}}</p> </div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 53c909ee9c..cdd2789128 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -4,7 +4,7 @@ <div class="ui container"> {{template "base/alert" .}} {{if .IsOrganizationOwner}} - <div class="text right"> + <div class="flex-text-block tw-justify-end"> <a class="ui primary button" href="{{.OrgLink}}/teams/new">{{svg "octicon-plus"}} {{ctx.Locale.Tr "org.create_new_team"}}</a> </div> <div class="divider"></div> @@ -49,7 +49,7 @@ {{ctx.Locale.Tr "org.teams.leave"}} </div> <div class="content"> - <p>{{ctx.Locale.Tr "org.teams.leave.detail" (`<span class="name"></span>`|SafeHTML)}}</p> + <p>{{ctx.Locale.Tr "org.teams.leave.detail" (HTMLFormat `<span class="%s"></span>` "name")}}</p> </div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/org/worktime.tmpl b/templates/org/worktime.tmpl new file mode 100644 index 0000000000..5d99998129 --- /dev/null +++ b/templates/org/worktime.tmpl @@ -0,0 +1,40 @@ +{{template "base/head" .}} +<div class="page-content organization times"> + {{template "org/header" .}} + <div class="ui container"> + <div class="ui grid"> + <div class="three wide column"> + <form class="ui form" method="get"> + <input type="hidden" name="by" value="{{$.WorktimeBy}}"> + <div class="field"> + <label>{{ctx.Locale.Tr "org.worktime.date_range_start"}}</label> + <input type="date" name="from" value="{{.RangeFrom}}"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "org.worktime.date_range_end"}}</label> + <input type="date" name="to" value="{{.RangeTo}}"> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "org.worktime.query"}}</button> + </form> + </div> + <div class="thirteen wide column"> + <div class="ui column"> + <div class="ui compact small menu"> + {{$queryParams := QueryBuild "from" .RangeFrom "to" .RangeTo}} + <a class="{{Iif .WorktimeByRepos "active"}} item" href="{{$.Org.OrganisationLink}}/worktime?by=repos&{{$queryParams}}">{{svg "octicon-repo"}} {{ctx.Locale.Tr "org.worktime.by_repositories"}}</a> + <a class="{{Iif .WorktimeByMilestones "active"}} item" href="{{$.Org.OrganisationLink}}/worktime?by=milestones&{{$queryParams}}">{{svg "octicon-milestone"}} {{ctx.Locale.Tr "org.worktime.by_milestones"}}</a> + <a class="{{Iif .WorktimeByMembers "active"}} item" href="{{$.Org.OrganisationLink}}/worktime?by=members&{{$queryParams}}">{{svg "octicon-people"}} {{ctx.Locale.Tr "org.worktime.by_members"}}</a> + </div> + </div> + {{if .WorktimeByRepos}} + {{template "org/worktime/table_repos" dict "Org" .Org "WorktimeSumResult" .WorktimeSumResult}} + {{else if .WorktimeByMilestones}} + {{template "org/worktime/table_milestones" dict "Org" .Org "WorktimeSumResult" .WorktimeSumResult}} + {{else if .WorktimeByMembers}} + {{template "org/worktime/table_members" dict "Org" .Org "WorktimeSumResult" .WorktimeSumResult}} + {{end}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/worktime/table_members.tmpl b/templates/org/worktime/table_members.tmpl new file mode 100644 index 0000000000..a59d1941d8 --- /dev/null +++ b/templates/org/worktime/table_members.tmpl @@ -0,0 +1,16 @@ +<table class="ui table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "org.members.member"}}</th> + <th>{{ctx.Locale.Tr "org.worktime.time"}}</th> + </tr> + </thead> + <tbody> + {{range $.WorktimeSumResult}} + <tr> + <td>{{svg "octicon-person"}} <a href="{{AppSubUrl}}/{{PathEscape .UserName}}">{{.UserName}}</a></td> + <td>{{svg "octicon-clock"}} {{.SumTime | Sec2Hour}}</td> + </tr> + {{end}} + </tbody> +</table> diff --git a/templates/org/worktime/table_milestones.tmpl b/templates/org/worktime/table_milestones.tmpl new file mode 100644 index 0000000000..6ef9289e56 --- /dev/null +++ b/templates/org/worktime/table_milestones.tmpl @@ -0,0 +1,28 @@ +<table class="ui table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "repository"}}</th> + <th>{{ctx.Locale.Tr "repo.milestone"}}</th> + <th>{{ctx.Locale.Tr "org.worktime.time"}}</th> + </tr> + </thead> + <tbody> + {{range $.WorktimeSumResult}} + <tr> + <td> + {{if not .HideRepoName}} + {{svg "octicon-repo"}} <a href="{{$.Org.HomeLink}}/{{PathEscape .RepoName}}/issues">{{.RepoName}}</a> + {{end}} + </td> + <td> + {{if .MilestoneName}} + {{svg "octicon-milestone"}} <a href="{{$.Org.HomeLink}}/{{PathEscape .RepoName}}/milestone/{{.MilestoneID}}">{{.MilestoneName}}</a> + {{else}} + - + {{end}} + </td> + <td>{{svg "octicon-clock"}} {{.SumTime | Sec2Hour}}</td> + </tr> + {{end}} + </tbody> +</table> diff --git a/templates/org/worktime/table_repos.tmpl b/templates/org/worktime/table_repos.tmpl new file mode 100644 index 0000000000..eaa085df0c --- /dev/null +++ b/templates/org/worktime/table_repos.tmpl @@ -0,0 +1,16 @@ +<table class="ui table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "repository"}}</th> + <th>{{ctx.Locale.Tr "org.worktime.time"}}</th> + </tr> + </thead> + <tbody> + {{range $.WorktimeSumResult}} + <tr> + <td>{{svg "octicon-repo"}} <a href="{{$.Org.HomeLink}}/{{PathEscape .RepoName}}/issues">{{.RepoName}}</a></td> + <td>{{svg "octicon-clock"}} {{.SumTime | Sec2Hour}}</td> + </tr> + {{end}} + </tbody> +</table> diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl index 04732d276a..1a1335aaa6 100644 --- a/templates/package/content/container.tmpl +++ b/templates/package/content/container.tmpl @@ -16,7 +16,17 @@ </div> <div class="field"> <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.container.digest"}}</label> - <div class="markup"><pre class="code-block"><code>{{range .PackageDescriptor.Files}}{{if eq .File.LowerName "manifest.json"}}{{.Properties.GetByName "container.digest"}}{{end}}{{end}}</code></pre></div> + <div class="markup"> + <div class="code-block-container code-overflow-scroll"> + <pre class="code-block"><code> + {{- range .PackageDescriptor.Files -}} + {{- if eq .File.LowerName "manifest.json" -}} + {{- .Properties.GetByName "container.digest" -}}{{"\n"}} + {{- end -}} + {{- end -}} + </code></pre> + </div> + </div> </div> <div class="field"> <label>{{ctx.Locale.Tr "packages.registry.documentation" "Container" "https://docs.gitea.com/usage/packages/container/"}}</label> @@ -24,7 +34,7 @@ </div> </div> {{if .PackageDescriptor.Metadata.Manifests}} - <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.multi_arch"}}</h4> + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.images"}}</h4> <div class="ui attached segment"> <table class="ui very basic compact table"> <thead> @@ -39,7 +49,11 @@ {{/* "unknown/unknown" is attestation-manifest, so we should skip it */}} {{if ne .Platform "unknown/unknown"}} <tr> - <td><a class="tw-font-mono" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{StringUtils.TrimPrefix .Digest "sha256:" | ShortSha}}</a></td> + <td> + <a class="tw-font-mono" href="{{$.PackageDescriptor.PackageWebLink}}/{{$.PackageDescriptor.Version.LowerVersion}}/{{PathEscape .Digest}}"> + {{StringUtils.TrimPrefix .Digest "sha256:" | ShortSha}} + </a> + </td> <td>{{.Platform}}</td> <td>{{FileSize .Size}}</td> </tr> @@ -55,12 +69,24 @@ {{.PackageDescriptor.Metadata.Description}} </div> {{end}} - {{if .PackageDescriptor.Metadata.ImageLayers}} - <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.layers"}}</h4> + + {{/* a container manifest may contain sub manifests, so here we try to display some information of the sub manifest, + not perfect, just better than before */}} + {{$imageMetadata := .ContainerImageMetadata}} + {{if $imageMetadata.ImageLayers}} + <h4 class="ui top attached header flex-text-block"> + {{ctx.Locale.Tr "packages.container.layers"}} + {{/* only show the platform if the image metadata is not the package's, which means that it is a sub manifest */}} + {{if ne .ContainerImageMetadata .PackageDescriptor.Metadata}} + <span class="tw-text-sm flex-text-inline" title="{{ctx.Locale.Tr "packages.container.details.platform"}}"> + ({{svg "octicon-cpu" 12}} {{.ContainerImageMetadata.Platform}}) + </span> + {{end}} + </h4> <div class="ui attached segment tw-break-anywhere"> - <table class="ui very basic compact table"> + <table class="ui very basic compact table tw-font-mono"> <tbody> - {{range .PackageDescriptor.Metadata.ImageLayers}} + {{range $imageMetadata.ImageLayers}} <tr> <td>{{.}}</td> </tr> @@ -69,10 +95,10 @@ </table> </div> {{end}} - {{if .PackageDescriptor.Metadata.Labels}} + {{if $imageMetadata.Labels}} <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.labels"}}</h4> <div class="ui attached segment"> - <table class="ui very basic compact table"> + <table class="ui very basic compact table tw-font-mono"> <thead> <tr> <th>{{ctx.Locale.Tr "packages.container.labels.key"}}</th> @@ -80,9 +106,9 @@ </tr> </thead> <tbody> - {{range $key, $value := .PackageDescriptor.Metadata.Labels}} + {{range $key, $value := $imageMetadata.Labels}} <tr> - <td class="top aligned">{{$key}}</td> + <td class="tw-align-top">{{$key}}</td> <td class="tw-break-anywhere">{{$value}}</td> </tr> {{end}} diff --git a/templates/package/content/maven.tmpl b/templates/package/content/maven.tmpl index f56595a830..e98fc53692 100644 --- a/templates/package/content/maven.tmpl +++ b/templates/package/content/maven.tmpl @@ -11,7 +11,7 @@ <div class="markup"><pre class="code-block"><code><repositories> <repository> <id>gitea</id> - <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> </repository> </repositories> diff --git a/templates/package/content/pypi.tmpl b/templates/package/content/pypi.tmpl index 2a22a6ed71..2625c160fe 100644 --- a/templates/package/content/pypi.tmpl +++ b/templates/package/content/pypi.tmpl @@ -4,7 +4,7 @@ <div class="ui form"> <div class="field"> <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.pypi.install"}}</label> - <div class="markup"><pre class="code-block"><code>pip install --index-url <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/pypi/simple/"></origin-url> {{.PackageDescriptor.Package.Name}}</code></pre></div> + <div class="markup"><pre class="code-block"><code>pip install --index-url <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/pypi/simple/"></origin-url> --extra-index-url https://pypi.org/ {{.PackageDescriptor.Package.Name}}</code></pre></div> </div> <div class="field"> <label>{{ctx.Locale.Tr "packages.registry.documentation" "PyPI" "https://docs.gitea.com/usage/packages/pypi/"}}</label> diff --git a/templates/package/shared/view.tmpl b/templates/package/shared/view.tmpl new file mode 100644 index 0000000000..52673accf9 --- /dev/null +++ b/templates/package/shared/view.tmpl @@ -0,0 +1,107 @@ +<div class="issue-title-header"> + {{$packageVersionLink := print $.PackageDescriptor.PackageWebLink "/" (PathEscape .PackageDescriptor.Version.LowerVersion)}} + <h1>{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</h1> + <div> + {{$timeStr := DateUtils.TimeSince .PackageDescriptor.Version.CreatedUnix}} + {{if .HasRepositoryAccess}} + {{ctx.Locale.Tr "packages.published_by_in" $timeStr .PackageDescriptor.Creator.HomeLink .PackageDescriptor.Creator.GetDisplayName .PackageDescriptor.Repository.Link .PackageDescriptor.Repository.FullName}} + {{else}} + {{ctx.Locale.Tr "packages.published_by" $timeStr .PackageDescriptor.Creator.HomeLink .PackageDescriptor.Creator.GetDisplayName}} + {{end}} + </div> +</div> +<div class="packages-content"> + <div class="packages-content-left"> + {{template "package/content/alpine" .}} + {{template "package/content/arch" .}} + {{template "package/content/cargo" .}} + {{template "package/content/chef" .}} + {{template "package/content/composer" .}} + {{template "package/content/conan" .}} + {{template "package/content/conda" .}} + {{template "package/content/container" .}} + {{template "package/content/cran" .}} + {{template "package/content/debian" .}} + {{template "package/content/generic" .}} + {{template "package/content/go" .}} + {{template "package/content/helm" .}} + {{template "package/content/maven" .}} + {{template "package/content/npm" .}} + {{template "package/content/nuget" .}} + {{template "package/content/pub" .}} + {{template "package/content/pypi" .}} + {{template "package/content/rpm" .}} + {{template "package/content/rubygems" .}} + {{template "package/content/swift" .}} + {{template "package/content/vagrant" .}} + </div> + <div class="ui segment packages-content-right"> + <strong>{{ctx.Locale.Tr "packages.details"}}</strong> + <div class="ui relaxed list flex-items-block"> + <div class="item">{{svg .PackageDescriptor.Package.Type.SVGName}} {{.PackageDescriptor.Package.Type.Name}}</div> + {{if .HasRepositoryAccess}} + <div class="item">{{svg "octicon-repo"}} <a href="{{.PackageDescriptor.Repository.Link}}">{{.PackageDescriptor.Repository.FullName}}</a></div> + {{end}} + <div class="item">{{svg "octicon-calendar"}} {{DateUtils.TimeSince .PackageDescriptor.Version.CreatedUnix}}</div> + <div class="item">{{svg "octicon-download"}} {{.PackageDescriptor.Version.DownloadCount}}</div> + {{template "package/metadata/alpine" .}} + {{template "package/metadata/arch" .}} + {{template "package/metadata/cargo" .}} + {{template "package/metadata/chef" .}} + {{template "package/metadata/composer" .}} + {{template "package/metadata/conan" .}} + {{template "package/metadata/conda" .}} + {{template "package/metadata/container" .}} + {{template "package/metadata/cran" .}} + {{template "package/metadata/debian" .}} + {{template "package/metadata/generic" .}} + {{template "package/metadata/helm" .}} + {{template "package/metadata/maven" .}} + {{template "package/metadata/npm" .}} + {{template "package/metadata/nuget" .}} + {{template "package/metadata/pub" .}} + {{template "package/metadata/pypi" .}} + {{template "package/metadata/rpm" .}} + {{template "package/metadata/rubygems" .}} + {{template "package/metadata/swift" .}} + {{template "package/metadata/vagrant" .}} + {{if not (and (eq .PackageDescriptor.Package.Type "container") .PackageDescriptor.Metadata.Manifests)}} + <div class="item">{{svg "octicon-database"}} {{FileSize .PackageDescriptor.CalculateBlobSize}}</div> + {{end}} + </div> + {{if not (eq .PackageDescriptor.Package.Type "container")}} + <div class="divider"></div> + <strong>{{ctx.Locale.Tr "packages.assets"}} ({{len .PackageDescriptor.Files}})</strong> + <div class="ui relaxed list"> + {{range .PackageDescriptor.Files}} + <div class="item"> + <a href="{{$packageVersionLink}}/files/{{.File.ID}}">{{.File.Name}}</a> + <span class="text small tw-whitespace-nowrap">{{FileSize .Blob.Size}}</span> + </div> + {{end}} + </div> + {{end}} + <div class="divider"></div> + <strong>{{ctx.Locale.Tr "packages.versions"}} ({{.TotalVersionCount}})</strong> + <a class="tw-float-right" href="{{$.PackageDescriptor.PackageWebLink}}/versions">{{ctx.Locale.Tr "packages.versions.view_all"}}</a> + <div class="ui relaxed list"> + {{range .LatestVersions}} + <div class="item tw-flex"> + <a class="tw-flex-1 gt-ellipsis" title="{{.Version}}" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .LowerVersion}}">{{.Version}}</a> + <span class="text small">{{DateUtils.AbsoluteShort .CreatedUnix}}</span> + </div> + {{end}} + </div> + {{if or .CanWritePackages .HasRepositoryAccess}} + <div class="divider"></div> + <div class="ui relaxed list flex-items-block"> + {{if .HasRepositoryAccess}} + <div class="item">{{svg "octicon-issue-opened"}} <a href="{{.PackageDescriptor.Repository.Link}}/issues">{{ctx.Locale.Tr "repo.issues"}}</a></div> + {{end}} + {{if .CanWritePackages}} + <div class="item">{{svg "octicon-tools"}} <a href="{{$packageVersionLink}}/settings">{{ctx.Locale.Tr "repo.settings"}}</a></div> + {{end}} + </div> + {{end}} + </div> +</div> diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl index 9e92207466..9067f44296 100644 --- a/templates/package/view.tmpl +++ b/templates/package/view.tmpl @@ -1,114 +1,24 @@ {{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content repository packages"> - {{template "shared/user/org_profile_avatar" .}} +{{if .ContextUser.IsOrganization}} +<div role="main" aria-label="{{.Title}}" class="page-content organization packages"> + {{template "org/header" .}} <div class="ui container"> - {{template "user/overview/header" .}} - <div class="issue-title-header"> - <h1>{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</h1> - <div> - {{$timeStr := DateUtils.TimeSince .PackageDescriptor.Version.CreatedUnix}} - {{if .HasRepositoryAccess}} - {{ctx.Locale.Tr "packages.published_by_in" $timeStr .PackageDescriptor.Creator.HomeLink .PackageDescriptor.Creator.GetDisplayName .PackageDescriptor.Repository.Link .PackageDescriptor.Repository.FullName}} - {{else}} - {{ctx.Locale.Tr "packages.published_by" $timeStr .PackageDescriptor.Creator.HomeLink .PackageDescriptor.Creator.GetDisplayName}} - {{end}} - </div> - </div> - <div class="issue-content"> - <div class="issue-content-left"> - {{template "package/content/alpine" .}} - {{template "package/content/arch" .}} - {{template "package/content/cargo" .}} - {{template "package/content/chef" .}} - {{template "package/content/composer" .}} - {{template "package/content/conan" .}} - {{template "package/content/conda" .}} - {{template "package/content/container" .}} - {{template "package/content/cran" .}} - {{template "package/content/debian" .}} - {{template "package/content/generic" .}} - {{template "package/content/go" .}} - {{template "package/content/helm" .}} - {{template "package/content/maven" .}} - {{template "package/content/npm" .}} - {{template "package/content/nuget" .}} - {{template "package/content/pub" .}} - {{template "package/content/pypi" .}} - {{template "package/content/rpm" .}} - {{template "package/content/rubygems" .}} - {{template "package/content/swift" .}} - {{template "package/content/vagrant" .}} + {{template "package/shared/view" .}} + </div> +</div> +{{else}} +<div role="main" aria-label="{{.Title}}" class="page-content user profile packages"> + <div class="ui container"> + <div class="ui stackable grid"> + <div class="ui four wide column"> + {{template "shared/user/profile_big_avatar" .}} </div> - <div class="issue-content-right ui segment"> - <strong>{{ctx.Locale.Tr "packages.details"}}</strong> - <div class="ui relaxed list flex-items-block"> - <div class="item">{{svg .PackageDescriptor.Package.Type.SVGName}} {{.PackageDescriptor.Package.Type.Name}}</div> - {{if .HasRepositoryAccess}} - <div class="item">{{svg "octicon-repo"}} <a href="{{.PackageDescriptor.Repository.Link}}">{{.PackageDescriptor.Repository.FullName}}</a></div> - {{end}} - <div class="item">{{svg "octicon-calendar"}} {{DateUtils.TimeSince .PackageDescriptor.Version.CreatedUnix}}</div> - <div class="item">{{svg "octicon-download"}} {{.PackageDescriptor.Version.DownloadCount}}</div> - {{template "package/metadata/alpine" .}} - {{template "package/metadata/arch" .}} - {{template "package/metadata/cargo" .}} - {{template "package/metadata/chef" .}} - {{template "package/metadata/composer" .}} - {{template "package/metadata/conan" .}} - {{template "package/metadata/conda" .}} - {{template "package/metadata/container" .}} - {{template "package/metadata/cran" .}} - {{template "package/metadata/debian" .}} - {{template "package/metadata/generic" .}} - {{template "package/metadata/helm" .}} - {{template "package/metadata/maven" .}} - {{template "package/metadata/npm" .}} - {{template "package/metadata/nuget" .}} - {{template "package/metadata/pub" .}} - {{template "package/metadata/pypi" .}} - {{template "package/metadata/rpm" .}} - {{template "package/metadata/rubygems" .}} - {{template "package/metadata/swift" .}} - {{template "package/metadata/vagrant" .}} - {{if not (and (eq .PackageDescriptor.Package.Type "container") .PackageDescriptor.Metadata.Manifests)}} - <div class="item">{{svg "octicon-database"}} {{FileSize .PackageDescriptor.CalculateBlobSize}}</div> - {{end}} - </div> - {{if not (eq .PackageDescriptor.Package.Type "container")}} - <div class="divider"></div> - <strong>{{ctx.Locale.Tr "packages.assets"}} ({{len .PackageDescriptor.Files}})</strong> - <div class="ui relaxed list"> - {{range .PackageDescriptor.Files}} - <div class="item"> - <a href="{{$.Link}}/files/{{.File.ID}}">{{.File.Name}}</a> - <span class="text small file-size">{{FileSize .Blob.Size}}</span> - </div> - {{end}} - </div> - {{end}} - <div class="divider"></div> - <strong>{{ctx.Locale.Tr "packages.versions"}} ({{.TotalVersionCount}})</strong> - <a class="tw-float-right" href="{{$.PackageDescriptor.PackageWebLink}}/versions">{{ctx.Locale.Tr "packages.versions.view_all"}}</a> - <div class="ui relaxed list"> - {{range .LatestVersions}} - <div class="item tw-flex"> - <a class="tw-flex-1 gt-ellipsis" title="{{.Version}}" href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .LowerVersion}}">{{.Version}}</a> - <span class="text small">{{DateUtils.AbsoluteShort .CreatedUnix}}</span> - </div> - {{end}} - </div> - {{if or .CanWritePackages .HasRepositoryAccess}} - <div class="divider"></div> - <div class="ui relaxed list flex-items-block"> - {{if .HasRepositoryAccess}} - <div class="item">{{svg "octicon-issue-opened"}} <a href="{{.PackageDescriptor.Repository.Link}}/issues">{{ctx.Locale.Tr "repo.issues"}}</a></div> - {{end}} - {{if .CanWritePackages}} - <div class="item">{{svg "octicon-tools"}} <a href="{{.Link}}/settings">{{ctx.Locale.Tr "repo.settings"}}</a></div> - {{end}} - </div> - {{end}} + <div class="ui twelve wide column tw-mb-4"> + {{template "user/overview/header" .}} + {{template "package/shared/view" .}} </div> </div> </div> </div> +{{end}} {{template "base/footer" .}} diff --git a/templates/post-install.tmpl b/templates/post-install.tmpl index fa10827295..9baac4f84c 100644 --- a/templates/post-install.tmpl +++ b/templates/post-install.tmpl @@ -2,9 +2,9 @@ <div role="main" aria-label="{{.Title}}" class="page-content install post-install tw-h-full"> <div class="home tw-text-center tw-h-full tw-flex tw-flex-col tw-justify-center"><!-- the "home" class makes the links green --> <!-- the "cup" has a handler, so move it a little leftward to make it visually in the center --> - <div class="tw-ml-[-30px]"><img width="160" src="{{AssetUrlPrefix}}/img/loading.png" alt="" aria-hidden="true"></div> + <div class="tw-ml-[-30px]"><img width="160" src="{{AssetUrlPrefix}}/img/loading.png" alt aria-hidden="true"></div> <div class="tw-my-[2em] tw-text-[18px]"> - <a id="goto-user-login" href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "install.installing_desc"}}</a> + <a id="goto-after-install" href="{{AppSubUrl}}{{Iif .IsAccountCreated "/user/login" "/user/sign_up"}}">{{ctx.Locale.Tr "install.installing_desc"}}</a> </div> </div> </div> diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index f5a48f7241..e769543f6a 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -1,5 +1,5 @@ {{if and $.CanWriteProjects (not $.Repository.IsArchived)}} - <div class="tw-flex tw-justify-between tw-mb-4"> + <div class="flex-text-block tw-justify-between tw-mb-4"> <div class="small-menu-items ui compact tiny menu list-header-toggle"> <a class="item{{if not .IsShowClosed}} active{{end}}" href="?state=open&q={{$.Keyword}}"> {{svg "octicon-project-symlink" 16 "tw-mr-2"}} @@ -10,9 +10,7 @@ {{ctx.Locale.PrettyNumber .ClosedCount}} {{ctx.Locale.Tr "repo.issues.closed_title"}} </a> </div> - <div class="tw-text-right"> - <a class="ui small primary button" href="{{$.Link}}/new">{{ctx.Locale.Tr "repo.projects.new"}}</a> - </div> + <a class="ui small primary button" href="{{$.Link}}/new">{{ctx.Locale.Tr "repo.projects.new"}}</a> </div> {{end}} @@ -34,6 +32,8 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> <a class="{{if eq .SortType "oldest"}}active {{end}}item" href="?q={{$.Keyword}}&sort=oldest&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="?q={{$.Keyword}}&sort=alphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?q={{$.Keyword}}&sort=reversealphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> <a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?q={{$.Keyword}}&sort=recentupdate&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> <a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?q={{$.Keyword}}&sort=leastupdate&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> </div> @@ -52,11 +52,11 @@ <div class="group"> <div class="flex-text-block"> {{svg "octicon-issue-opened" 14}} - {{ctx.Locale.PrettyNumber (.NumOpenIssues ctx)}} {{ctx.Locale.Tr "repo.issues.open_title"}} + {{ctx.Locale.PrettyNumber .NumOpenIssues}} {{ctx.Locale.Tr "repo.issues.open_title"}} </div> <div class="flex-text-block"> {{svg "octicon-check" 14}} - {{ctx.Locale.PrettyNumber (.NumClosedIssues ctx)}} {{ctx.Locale.Tr "repo.issues.closed_title"}} + {{ctx.Locale.PrettyNumber .NumClosedIssues}} {{ctx.Locale.Tr "repo.issues.closed_title"}} </div> </div> {{if and $.CanWriteProjects (not $.Repository.IsArchived)}} @@ -67,14 +67,12 @@ {{else}} <a class="link-action flex-text-inline" href data-url="{{.Link ctx}}/close">{{svg "octicon-skip" 14}}{{ctx.Locale.Tr "repo.projects.close"}}</a> {{end}} - <a class="delete-button flex-text-inline" href="#" data-url="{{.Link ctx}}/delete">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a> + <a class="link-action flex-text-inline text red" href data-modal-confirm="#repo-project-delete-modal" data-url="{{.Link ctx}}/delete">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a> </div> {{end}} </div> {{if .Description}} - <div class="content"> - {{.RenderedContent}} - </div> + <div class="render-content markup">{{.RenderedContent}}</div> {{end}} </li> {{end}} @@ -83,14 +81,9 @@ </div> {{if and $.CanWriteProjects (not $.Repository.IsArchived)}} -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.projects.deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.projects.deletion_desc"}}</p> - </div> +<div class="ui small modal" id="repo-project-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.projects.deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.projects.deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> {{end}} diff --git a/templates/projects/new.tmpl b/templates/projects/new.tmpl index a936079c46..f2630be09b 100644 --- a/templates/projects/new.tmpl +++ b/templates/projects/new.tmpl @@ -64,7 +64,7 @@ </div> </div> <div class="divider"></div> - <div class="tw-text-right"> + <div class="flex-text-block tw-justify-end"> <a class="ui cancel button" href="{{$.CancelLink}}"> {{ctx.Locale.Tr "repo.milestones.cancel"}} </a> diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl index 2550cae69c..692808a32d 100644 --- a/templates/projects/view.tmpl +++ b/templates/projects/view.tmpl @@ -1,27 +1,32 @@ {{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}} -<div class="ui container tw-max-w-full"> - <div class="tw-flex tw-justify-between tw-items-center tw-mb-4 tw-gap-3"> - <h2 class="tw-mb-0 tw-flex-1 tw-break-anywhere">{{.Project.Title}}</h2> - <div class="project-toolbar-right"> - <div class="ui secondary filter menu labels"> - {{$queryLink := QueryBuild "?" "labels" .SelectLabels "assignee" $.AssigneeID "archived_labels" (Iif $.ShowArchivedLabels "true")}} - - {{template "repo/issue/filter_item_label" dict "Labels" .Labels "QueryLink" $queryLink "SupportArchivedLabel" true}} - - {{template "repo/issue/filter_item_user_assign" dict - "QueryParamKey" "assignee" - "QueryLink" $queryLink - "UserSearchList" $.Assignees - "SelectedUserId" $.AssigneeID - "TextFilterTitle" (ctx.Locale.Tr "repo.issues.filter_assignee") - "TextZeroValue" (ctx.Locale.Tr "repo.issues.filter_assginee_no_select") - "TextNegativeOne" (ctx.Locale.Tr "repo.issues.filter_assginee_no_assignee") - }} - </div> - </div> +<div class="ui container fluid padded projects-view"> + <div class="ui container flex-text-block project-header"> + <h2>{{.Project.Title}}</h2> + <div class="tw-flex-1"></div> + <div class="ui secondary menu tw-m-0"> + {{$queryLink := QueryBuild "?" "labels" .SelectLabels "assignee" $.AssigneeID "archived_labels" (Iif $.ShowArchivedLabels "true")}} + {{template "repo/issue/filter_item_label" dict "Labels" .Labels "QueryLink" $queryLink "SupportArchivedLabel" true}} + {{template "repo/issue/filter_item_user_assign" dict + "QueryParamKey" "assignee" + "QueryLink" $queryLink + "UserSearchList" $.Assignees + "SelectedUserId" $.AssigneeID + "TextFilterTitle" (ctx.Locale.Tr "repo.issues.filter_assignee") + "TextFilterMatchNone" (ctx.Locale.Tr "repo.issues.filter_assignee_no_assignee") + "TextFilterMatchAny" (ctx.Locale.Tr "repo.issues.filter_assignee_any_assignee") + }} + </div> {{if $canWriteProject}} <div class="ui compact mini menu"> + <a class="item screen-full"> + {{svg "octicon-screen-full"}} + {{ctx.Locale.Tr "projects.enter_fullscreen"}} + </a> + <a class="item screen-normal tw-hidden"> + {{svg "octicon-screen-normal"}} + {{ctx.Locale.Tr "projects.exit_fullscreen"}} + </a> <a class="item" href="{{.Link}}/edit?redirect=project"> {{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}} @@ -59,18 +64,17 @@ {{end}} </div> - <div class="content">{{$.Project.RenderedContent}}</div> - - <div class="divider"></div> -</div> + <div class="ui container project-description"> + {{$.Project.RenderedContent}} + <div class="divider"></div> + </div> -<div id="project-board" data-project-borad-writable="{{$canWriteProject}}"> - <div class="board {{if $canWriteProject}}sortable{{end}}" {{if $canWriteProject}}data-url="{{$.Link}}/move"{{end}}> + <div id="project-board" class="board {{if $canWriteProject}}sortable{{end}}" data-project-borad-writable="{{$canWriteProject}}" {{if $canWriteProject}}data-url="{{$.Link}}/move"{{end}}> {{range .Columns}} <div class="project-column" {{if .Color}}style="background: {{.Color}} !important; color: {{ContrastColor .Color}} !important"{{end}} data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}"> <div class="project-column-header{{if $canWriteProject}} tw-cursor-grab{{end}}"> <div class="ui circular label project-column-issue-count"> - {{.NumIssues ctx}} + {{.NumIssues}} </div> <div class="project-column-title-text gt-ellipsis">{{.Title}}</div> {{if $canWriteProject}} @@ -126,16 +130,16 @@ <input class="project-column-id" type="hidden" name="id"> <div class="required field"> <label class="project-column-title-label" for="project-column-title-input">title</label> - <input id="project-column-title-input" name="title" value="{{.Title}}" required> + <input id="project-column-title-input" name="title" required> </div> <div class="field"> <label class="project-column-color-label" for="project-column-color-input">color</label> - <div class="js-color-picker-input column"> - <input maxlength="7" placeholder="#c320f6" id="project-column-color-input" name="color" value="{{.Color}}"> + <div class="color-picker-combo" data-global-init="initColorPicker"> + <input maxlength="7" placeholder="#c320f6" id="project-column-color-input" name="color"> {{template "repo/issue/label_precolors"}} </div> </div> - <div class="actions tw-text-right"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button type="submit" class="ui primary button project-column-button-save">save</button> </div> diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl index fa1adb3e3b..23df61a43c 100644 --- a/templates/repo/actions/runs_list.tmpl +++ b/templates/repo/actions/runs_list.tmpl @@ -5,36 +5,55 @@ <h2>{{if $.IsFiltered}}{{ctx.Locale.Tr "actions.runs.no_results"}}{{else}}{{ctx.Locale.Tr "actions.runs.no_runs"}}{{end}}</h2> </div> {{end}} - {{range .Runs}} + {{range $run := .Runs}} <div class="flex-item tw-items-center"> <div class="flex-item-leading"> - {{template "repo/actions/status" (dict "status" .Status.String)}} + {{template "repo/actions/status" (dict "status" $run.Status.String)}} </div> <div class="flex-item-main"> - <a class="flex-item-title" title="{{.Title}}" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> - {{if .Title}}{{.Title}}{{else}}{{ctx.Locale.Tr "actions.runs.empty_commit_message"}}{{end}} + <a class="flex-item-title" title="{{$run.Title}}" href="{{$run.Link}}"> + {{or $run.Title (ctx.Locale.Tr "actions.runs.empty_commit_message")}} </a> <div class="flex-item-body"> - <span><b>{{if not $.CurWorkflow}}{{.WorkflowID}} {{end}}#{{.Index}}</b>:</span> - {{- if .ScheduleID -}} + <span><b>{{if not $.CurWorkflow}}{{$run.WorkflowID}} {{end}}#{{$run.Index}}</b>:</span> + {{- if $run.ScheduleID -}} {{ctx.Locale.Tr "actions.runs.scheduled"}} {{- else -}} {{ctx.Locale.Tr "actions.runs.commit"}} - <a href="{{$.RepoLink}}/commit/{{.CommitSHA}}">{{ShortSha .CommitSHA}}</a> + <a href="{{$.RepoLink}}/commit/{{$run.CommitSHA}}">{{ShortSha $run.CommitSHA}}</a> {{ctx.Locale.Tr "actions.runs.pushed_by"}} - <a href="{{.TriggerUser.HomeLink}}">{{.TriggerUser.GetDisplayName}}</a> + <a href="{{$run.TriggerUser.HomeLink}}">{{$run.TriggerUser.GetDisplayName}}</a> {{- end -}} </div> </div> <div class="flex-item-trailing"> - {{if .IsRefDeleted}} - <span class="ui label run-list-ref gt-ellipsis tw-line-through" data-tooltip-content="{{.PrettyRef}}">{{.PrettyRef}}</span> + {{if $run.IsRefDeleted}} + <span class="ui label run-list-ref gt-ellipsis tw-line-through" data-tooltip-content="{{$run.PrettyRef}}">{{$run.PrettyRef}}</span> {{else}} - <a class="ui label run-list-ref gt-ellipsis" href="{{.RefLink}}" data-tooltip-content="{{.PrettyRef}}">{{.PrettyRef}}</a> + <a class="ui label run-list-ref gt-ellipsis" href="{{$run.RefLink}}" data-tooltip-content="{{$run.PrettyRef}}">{{$run.PrettyRef}}</a> {{end}} <div class="run-list-item-right"> - <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince .Updated}}</div> - <div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{.Duration}}</div> + <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince $run.Updated}}</div> + <div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{$run.Duration}}</div> + </div> + <div class="ui dropdown jump tw-p-2"> + {{svg "octicon-kebab-horizontal"}} + <div class="menu flex-items-menu"> + <a class="item" href="{{$run.Link}}/workflow">{{svg "octicon-play"}}{{ctx.Locale.Tr "actions.runs.view_workflow_file"}}</a> + {{if and $.CanWriteRepoUnitActions (not $run.Status.IsDone)}} + <a class="item link-action" data-url="{{$run.Link}}/cancel"> + {{svg "octicon-x"}}{{ctx.Locale.Tr "actions.runs.cancel"}} + </a> + {{end}} + {{if and $.CanWriteRepoUnitActions $run.Status.IsDone}} + <a class="item link-action" + data-url="{{$run.Link}}/delete" + data-modal-confirm="{{ctx.Locale.Tr "actions.runs.delete.description"}}" + > + {{svg "octicon-trash"}}{{ctx.Locale.Tr "actions.runs.delete"}} + </a> + {{end}} + </div> </div> </div> </div> diff --git a/templates/repo/actions/status.tmpl b/templates/repo/actions/status.tmpl index 64c2543302..f2020bc160 100644 --- a/templates/repo/actions/status.tmpl +++ b/templates/repo/actions/status.tmpl @@ -16,7 +16,7 @@ {{else if eq .status "blocked"}} {{svg "octicon-blocked" $size (printf "text yellow %s" $className)}} {{else if eq .status "running"}} - {{svg "octicon-meter" $size (printf "text yellow job-status-rotate %s" $className)}} + {{svg "octicon-meter" $size (printf "text yellow circular-spin %s" $className)}} {{else}}{{/*failure, unknown*/}} {{svg "octicon-x-circle-fill" $size (printf "text red %s" $className)}} {{end}} diff --git a/templates/repo/actions/view_component.tmpl b/templates/repo/actions/view_component.tmpl index 8d1de41f70..4e338ffcfc 100644 --- a/templates/repo/actions/view_component.tmpl +++ b/templates/repo/actions/view_component.tmpl @@ -4,7 +4,7 @@ data-actions-url="{{.ActionsURL}}" data-locale-approve="{{ctx.Locale.Tr "repo.diff.review.approve"}}" - data-locale-cancel="{{ctx.Locale.Tr "cancel"}}" + data-locale-cancel="{{ctx.Locale.Tr "actions.runs.cancel"}}" data-locale-rerun="{{ctx.Locale.Tr "rerun"}}" data-locale-rerun-all="{{ctx.Locale.Tr "rerun_all"}}" data-locale-runs-scheduled="{{ctx.Locale.Tr "actions.runs.scheduled"}}" @@ -19,6 +19,7 @@ data-locale-status-skipped="{{ctx.Locale.Tr "actions.status.skipped"}}" data-locale-status-blocked="{{ctx.Locale.Tr "actions.status.blocked"}}" data-locale-artifacts-title="{{ctx.Locale.Tr "artifacts"}}" + data-locale-artifact-expired="{{ctx.Locale.Tr "expired"}}" data-locale-confirm-delete-artifact="{{ctx.Locale.Tr "confirm_delete_artifact"}}" data-locale-show-timestamps="{{ctx.Locale.Tr "show_timestamps"}}" data-locale-show-log-seconds="{{ctx.Locale.Tr "show_log_seconds"}}" diff --git a/templates/repo/actions/workflow_dispatch.tmpl b/templates/repo/actions/workflow_dispatch.tmpl index 21f3ef2077..540bbe9162 100644 --- a/templates/repo/actions/workflow_dispatch.tmpl +++ b/templates/repo/actions/workflow_dispatch.tmpl @@ -10,8 +10,8 @@ <span class="ui inline required field"> <label>{{ctx.Locale.Tr "actions.workflow.from_ref"}}:</label> </span> - <div class="ui inline field dropdown button select-branch branch-selector-dropdown ellipsis-items-nowrap"> - <input type="hidden" name="ref" value="refs/heads/{{index .Branches 0}}"> + <div class="ui inline field dropdown button select-branch branch-selector-dropdown ellipsis-text-items"> + <input type="hidden" name="ref" hx-sync="this:replace" hx-target="#runWorkflowDispatchModalInputs" hx-swap="innerHTML" hx-get="{{$.Link}}/workflow-dispatch-inputs?workflow={{$.CurWorkflow}}" hx-trigger="change" value="refs/heads/{{index .Branches 0}}"> {{svg "octicon-git-branch" 14}} <div class="default text">{{index .Branches 0}}</div> {{svg "octicon-triangle-down" 14 "dropdown icon"}} @@ -49,30 +49,9 @@ <div class="divider"></div> - {{range $item := .WorkflowDispatchConfig.Inputs}} - <div class="ui field {{if .Required}}required{{end}}"> - {{if eq .Type "choice"}} - <label>{{.Description}}:</label> - <select class="ui selection type dropdown" name="{{.Name}}"> - {{range .Options}} - <option value="{{.}}" {{if eq $item.Default .}}selected{{end}} >{{.}}</option> - {{end}} - </select> - {{else if eq .Type "boolean"}} - <div class="ui inline checkbox"> - <label>{{.Description}}</label> - <input type="checkbox" name="{{.Name}}" {{if eq .Default "true"}}checked{{end}}> - </div> - {{else if eq .Type "number"}} - <label>{{.Description}}:</label> - <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> - {{else}} - <label>{{.Description}}:</label> - <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> - {{end}} + <div id="runWorkflowDispatchModalInputs"> + {{template "repo/actions/workflow_dispatch_inputs" .}} </div> - {{end}} - <button class="ui tiny primary button" type="submit">Submit</button> </form> </div> </div> diff --git a/templates/repo/actions/workflow_dispatch_inputs.tmpl b/templates/repo/actions/workflow_dispatch_inputs.tmpl new file mode 100644 index 0000000000..37538a318f --- /dev/null +++ b/templates/repo/actions/workflow_dispatch_inputs.tmpl @@ -0,0 +1,46 @@ +{{if not .WorkflowDispatchConfig}} + <div class="ui error message tw-block">{{/* using "ui message" in "ui form" needs to force to display */}} + {{if not .CurWorkflowExists}} + {{ctx.Locale.Tr "actions.workflow.not_found" $.CurWorkflow}} + {{else}} + {{ctx.Locale.Tr "actions.workflow.has_no_workflow_dispatch" $.CurWorkflow}} + {{end}} + </div> +{{else}} + {{range $item := .WorkflowDispatchConfig.Inputs}} + <div class="ui field {{if .Required}}required{{end}}"> + {{if eq .Type "choice"}} + <label>{{or .Description .Name}}:</label> + {{/* htmx won't initialize the fomantic dropdown, so it is a standard "select" input */}} + <select class="ui selection dropdown" name="{{.Name}}"> + {{range .Options}} + <option value="{{.}}" {{if eq $item.Default .}}selected{{end}}>{{.}}</option> + {{end}} + </select> + {{else if eq .Type "boolean"}} + {{/* htmx doesn't trigger our JS code to attach fomantic label to checkbox, so here we use standard checkbox */}} + <label class="tw-flex flex-text-inline"> + <input type="checkbox" name="{{.Name}}" {{if eq .Default "true"}}checked{{end}}> + {{or .Description .Name}} + </label> + {{else if eq .Type "number"}} + <label>{{or .Description .Name}}:</label> + <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> + {{else}} + <label>{{or .Description .Name}}:</label> + <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}> + {{end}} + </div> + {{end}} + <div class="ui field"> + {{/* use autofocus here to prevent the "branch selection" dropdown from getting focus, otherwise it will auto popup */}} + <button class="ui tiny primary button" autofocus type="submit">{{ctx.Locale.Tr "actions.workflow.run"}}</button> + </div> +{{end}} +{{range .workflows}} + {{if and .ErrMsg (eq .Entry.Name $.CurWorkflow)}} + <div class="ui field"> + <div>{{svg "octicon-alert" 16 "text red"}} {{.ErrMsg}}</div> + </div> + {{end}} +{{end}} diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl index 62d1bbf2ba..c4d9f0741f 100644 --- a/templates/repo/blame.tmpl +++ b/templates/repo/blame.tmpl @@ -1,5 +1,5 @@ {{if or .UsesIgnoreRevs .FaultyIgnoreRevsFile}} - {{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}} + {{$revsFileLink := URLJoin .RepoLink "src" .RefTypeNameSubURL "/.git-blame-ignore-revs"}} {{if .UsesIgnoreRevs}} <div class="ui info message"> <p>{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink "?bypass-blame-ignore=true"}}</p> @@ -10,7 +10,7 @@ </div> {{end}} {{end}} -<div class="{{TabSizeClass .Editorconfig .FileName}} non-diff-file-content"> +<div class="{{TabSizeClass .Editorconfig .FileTreePath}} non-diff-file-content"> <h4 class="file-header ui top attached header tw-flex tw-items-center tw-justify-between tw-flex-wrap"> <div class="file-header-left tw-flex tw-items-center tw-py-2 tw-pr-4"> {{template "repo/file_info" .}} @@ -18,11 +18,11 @@ <div class="file-header-right file-actions tw-flex tw-items-center tw-flex-wrap"> <div class="ui buttons"> <a class="ui tiny button" href="{{$.RawFileLink}}">{{ctx.Locale.Tr "repo.file_raw"}}</a> - {{if not .IsViewCommit}} + {{if or .RefFullName.IsBranch .RefFullName.IsTag}} <a class="ui tiny button" href="{{.RepoLink}}/src/commit/{{.CommitID | PathEscape}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.file_permalink"}}</a> {{end}} - <a class="ui tiny button" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.normal_view"}}</a> - <a class="ui tiny button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.file_history"}}</a> + <a class="ui tiny button" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.normal_view"}}</a> + <a class="ui tiny button" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.file_history"}}</a> <button class="ui tiny button unescape-button">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> <button class="ui tiny button escape-button tw-hidden">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> </div> @@ -82,6 +82,8 @@ </table> {{end}}{{/* end if .IsFileTooLarge */}} <div class="code-line-menu tippy-target"> + {{/*FIXME: the "HasSourceRenderedToggle" is never set on blame page, it should mean "whether the file is renderable". + If the file is renderable, then it must has the "display=source" parameter to make sure the file view page shows the source code, then line number works. */}} {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} <a class="item ref-in-new-issue" role="menuitem" data-url-issue-new="{{.RepoLink}}/issues/new" data-url-param-body-link="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}" rel="nofollow noindex">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</a> {{end}} diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index cb504e2b75..9e86641c6f 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -20,17 +20,17 @@ <tr> <td> <div class="flex-text-block"> - <a class="gt-ellipsis" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a> + <a class="gt-ellipsis branch-name" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a> {{if .DefaultBranchBranch.IsProtected}} <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span> {{end}} <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}} </div> - <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> ยท <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> ยท {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> + <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> ยท <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DefaultBranchBranch.DBBranch.CommitMessage .Repository}}</span> ยท {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DefaultBranchBranch.DBBranch.CommitTime}}{{if .DefaultBranchBranch.DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> </td> {{/* FIXME: here and below, the tw-overflow-visible is not quite right but it is still needed the moment: to show the important buttons when the width is narrow */}} - <td class="right aligned middle aligned tw-overflow-visible"> + <td class="tw-text-right tw-overflow-visible"> {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}} <button class="btn interact-bg show-create-branch-modal tw-p-2" data-modal="#create-branch-modal" @@ -42,7 +42,7 @@ </button> {{end}} {{if .EnableFeed}} - <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> + <a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> {{end}} {{if not $.DisableDownloadSourceArchives}} <div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" ($.DefaultBranchBranch.DBBranch.Name)}}"> @@ -90,25 +90,31 @@ <td class="eight wide"> {{if .DBBranch.IsDeleted}} <div class="flex-text-block"> - <span class="gt-ellipsis">{{.DBBranch.Name}}</span> + <span class="gt-ellipsis branch-name">{{.DBBranch.Name}}</span> <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> </div> <p class="info">{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{DateUtils.TimeSince .DBBranch.DeletedUnix}}</p> {{else}} <div class="flex-text-block"> - <a class="gt-ellipsis" href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .DBBranch.Name}}">{{.DBBranch.Name}}</a> + <a class="gt-ellipsis branch-name" href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .DBBranch.Name}}">{{.DBBranch.Name}}</a> {{if .IsProtected}} <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.protected_branch"}}">{{svg "octicon-shield-lock"}}</span> {{end}} <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_branch"}}">{{svg "octicon-copy" 14}}</button> {{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}} </div> - <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> ยท <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> ยท {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DBBranch.CommitTime}}{{if .DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p> + <p class="info tw-flex tw-items-center tw-my-1">{{svg "octicon-git-commit" 16 "tw-mr-1"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> ยท <span class="commit-message">{{ctx.RenderUtils.RenderCommitMessage .DBBranch.CommitMessage $.Repository}}</span> ยท {{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .DBBranch.CommitTime}}{{if .DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} {{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p> {{end}} </td> <td class="two wide ui"> - {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} - <div class="commit-divergence"> + {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} + {{$tooltipDivergence := ""}} + {{if or .CommitsBehind .CommitsAhead}} + {{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_divergence_from" .CommitsBehind .CommitsAhead $.DefaultBranchBranch.DBBranch.Name}} + {{else}} + {{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_no_divergence" $.DefaultBranchBranch.DBBranch.Name}} + {{end}} + <div class="commit-divergence" data-tooltip-content="{{$tooltipDivergence}}"> <div class="bar-group"> <div class="count count-behind">{{.CommitsBehind}}</div> {{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}} @@ -119,22 +125,22 @@ <div class="bar bar-ahead" style="width: {{Eval 100 "*" .CommitsAhead "/" "(" .CommitsBehind "+" .CommitsAhead "+" 0.0 ")"}}%"></div> </div> </div> - {{end}} + {{end}} </td> - <td class="two wide right aligned"> + <td class="two wide tw-text-right"> {{if not .LatestPullRequest}} {{if .IsIncluded}} <span class="ui orange large label" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.included_desc"}}"> {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.branch.included"}} </span> {{else if and (not .DBBranch.IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} - <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}"> + <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}?expand=1"> <button id="new-pull-request" class="ui compact basic button tw-mr-0">{{if $.CanPull}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}</button> </a> {{end}} {{else if and .LatestPullRequest.HasMerged .MergeMovedOn}} {{if and (not .DBBranch.IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} - <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}"> + <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}?expand=1"> <button id="new-pull-request" class="ui compact basic button tw-mr-0">{{if $.CanPull}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}</button> </a> {{end}} @@ -143,14 +149,14 @@ {{if .LatestPullRequest.HasMerged}} <a href="{{.LatestPullRequest.Issue.Link}}" class="ui purple large label">{{svg "octicon-git-merge" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.pulls.merged"}}</a> {{else if .LatestPullRequest.Issue.IsClosed}} - <a href="{{.LatestPullRequest.Issue.Link}}" class="ui red large label">{{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}}</a> + <a href="{{.LatestPullRequest.Issue.Link}}" class="ui red large label">{{svg "octicon-git-pull-request-closed" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.closed_title"}}</a> {{else}} <a href="{{.LatestPullRequest.Issue.Link}}" class="ui green large label">{{svg "octicon-git-pull-request" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.issues.open_title"}}</a> {{end}} {{end}} </td> {{/* FIXME: here and above, the tw-overflow-visible is not quite right */}} - <td class="three wide right aligned tw-overflow-visible"> + <td class="three wide tw-text-right tw-overflow-visible"> {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted)}} <button class="btn interact-bg tw-p-2 show-modal show-create-branch-modal" data-branch-from="{{.DBBranch.Name}}" @@ -162,7 +168,7 @@ </button> {{end}} {{if $.EnableFeed}} - <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> + <a role="button" class="btn interact-bg tw-p-2" href="{{$.RepoLink}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss"}}</a> {{end}} {{if and (not .DBBranch.IsDeleted) (not $.DisableDownloadSourceArchives)}} <div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" (.DBBranch.Name)}}"> diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index b68c34a02a..36dc047c23 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -1,8 +1,8 @@ {{/* Attributes: * ContainerClasses * Repository -* CurrentRefType: eg. "branch", "tag" -* CurrentRefShortName: eg. "master", "v1.0" +* CurrentRefType: eg. "branch", "tag", "commit" +* CurrentRefShortName: eg. "master", "v1.0", "abcdef0123" * CurrentTreePath * RefLinkTemplate: redirect to the link when a branch/tag is selected * RefFormActionTemplate: change the parent form's action when a branch/tag is selected @@ -14,7 +14,8 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences. */}} -<div class="js-branch-tag-selector {{if .ContainerClasses}}{{.ContainerClasses}}{{end}}" +<div class="{{if .ContainerClasses}}{{.ContainerClasses}}{{end}}" + data-global-init="initRepoBranchTagSelector" data-text-release-compare="{{ctx.Locale.Tr "repo.release.compare"}}" data-text-branches="{{ctx.Locale.Tr "repo.branches"}}" data-text-tags="{{ctx.Locale.Tr "repo.tags"}}" @@ -45,17 +46,21 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences. data-enable-feed="{{ctx.RootData.EnableFeed}}" > {{/* show dummy elements before Vue componment is mounted, this code must match the code in BranchTagSelector.vue */}} - <div class="ui dropdown custom branch-selector-dropdown ellipsis-items-nowrap"> - <div class="ui button branch-dropdown-button"> + <div class="ui dropdown custom branch-selector-dropdown ellipsis-text-items"> + <div class="ui compact button branch-dropdown-button"> <span class="flex-text-block gt-ellipsis"> - {{if not .DropdownFixedText}} - {{if .ShowTabTags}} + {{if .DropdownFixedText}} + {{.DropdownFixedText}} + {{else}} + {{if eq .CurrentRefType "tag"}} {{svg "octicon-tag"}} - {{else if .ShowTabBranches}} + {{else if eq .CurrentRefType "branch"}} {{svg "octicon-git-branch"}} + {{else}} + {{svg "octicon-git-commit"}} {{end}} + <strong class="tw-inline-block gt-ellipsis">{{.CurrentRefShortName}}</strong> {{end}} - <strong class="tw-ml-2 tw-inline-block gt-ellipsis">{{Iif .DropdownFixedText .SelectedRefShortName}}</strong> </span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> diff --git a/templates/repo/clone_panel.tmpl b/templates/repo/clone_panel.tmpl index d3496bdb73..e23bc8a19a 100644 --- a/templates/repo/clone_panel.tmpl +++ b/templates/repo/clone_panel.tmpl @@ -1,5 +1,6 @@ -<button class="ui primary button js-btn-clone-panel"> - <span>{{svg "octicon-code" 16}} Code</span> +<button class="ui compact primary button js-btn-clone-panel"> + {{svg "octicon-code" 16}} + <span>{{ctx.Locale.Tr "repo.code"}}</span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </button> <div class="clone-panel-popup tippy-target"> @@ -13,6 +14,7 @@ {{if $.CloneButtonShowSSH}} <button class="item repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}">SSH</button> {{end}} + <button class="item repo-clone-tea" data-link="{{$.CloneButtonOriginLink.Tea}}">Tea CLI</button> </div> <div class="divider"></div> @@ -32,12 +34,14 @@ {{end}} </div> - {{if and (not $.DisableDownloadSourceArchives) $.RefName}} + {{if and (not $.DisableDownloadSourceArchives) $.RefFullName}} <div class="divider"></div> <div class="flex-items-block clone-panel-list"> - <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a> - <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a> - <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a> + {{/* FIXME: here it only uses the shortname in the ref to build the link, it can't distinguish the branch/tag/commit with the same name + in the future, it's better to use something like "/archive/branch/the-name.zip", "/archive/tag/the-name.zip" */}} + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a> + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a> + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a> </div> {{end}} {{end}} diff --git a/templates/repo/code/recently_pushed_new_branches.tmpl b/templates/repo/code/recently_pushed_new_branches.tmpl index f0edf6065b..4a864ba756 100644 --- a/templates/repo/code/recently_pushed_new_branches.tmpl +++ b/templates/repo/code/recently_pushed_new_branches.tmpl @@ -5,7 +5,7 @@ {{$branchLink := HTMLFormat `<a href="%s">%s</a>` .BranchLink .BranchDisplayName}} {{ctx.Locale.Tr "repo.pulls.recently_pushed_new_branches" $branchLink $timeSince}} </div> - <a role="button" class="ui compact green button tw-m-0" href="{{.BranchCompareURL}}"> + <a role="button" class="ui compact green button tw-m-0" href="{{QueryBuild .BranchCompareURL "expand" 1}}"> {{ctx.Locale.Tr "repo.pulls.compare_changes"}} </a> </div> diff --git a/templates/repo/code/upstream_diverging_info.tmpl b/templates/repo/code/upstream_diverging_info.tmpl index 51402598f9..b3d35c05e5 100644 --- a/templates/repo/code/upstream_diverging_info.tmpl +++ b/templates/repo/code/upstream_diverging_info.tmpl @@ -1,16 +1,21 @@ -{{if and .UpstreamDivergingInfo (or .UpstreamDivergingInfo.BaseIsNewer .UpstreamDivergingInfo.CommitsBehind)}} +{{if and .UpstreamDivergingInfo .UpstreamDivergingInfo.BaseBranchHasNewCommits}} <div class="ui message flex-text-block"> <div class="tw-flex-1"> - {{$upstreamLink := printf "%s/src/branch/%s" .Repository.BaseRepo.Link (.BranchName|PathEscapeSegments)}} - {{$upstreamHtml := HTMLFormat `<a href="%s">%s:%s</a>` $upstreamLink .Repository.BaseRepo.FullName .BranchName}} - {{if .UpstreamDivergingInfo.CommitsBehind}} - {{ctx.Locale.TrN .UpstreamDivergingInfo.CommitsBehind "repo.pulls.upstream_diverging_prompt_behind_1" "repo.pulls.upstream_diverging_prompt_behind_n" .UpstreamDivergingInfo.CommitsBehind $upstreamHtml}} + {{$upstreamLink := printf "%s/src/branch/%s" .Repository.BaseRepo.Link (.UpstreamDivergingInfo.BaseBranchName|PathEscapeSegments)}} + {{$upstreamRepoBranchDisplay := HTMLFormat "%s:%s" .Repository.BaseRepo.FullName .UpstreamDivergingInfo.BaseBranchName}} + {{$thisRepoBranchDisplay := HTMLFormat "%s:%s" .Repository.FullName .BranchName}} + {{$upstreamHtml := HTMLFormat `<a href="%s">%s</a>` $upstreamLink $upstreamRepoBranchDisplay}} + {{if .UpstreamDivergingInfo.HeadBranchCommitsBehind}} + {{ctx.Locale.TrN .UpstreamDivergingInfo.HeadBranchCommitsBehind "repo.pulls.upstream_diverging_prompt_behind_1" "repo.pulls.upstream_diverging_prompt_behind_n" .UpstreamDivergingInfo.HeadBranchCommitsBehind $upstreamHtml}} {{else}} {{ctx.Locale.Tr "repo.pulls.upstream_diverging_prompt_base_newer" $upstreamHtml}} {{end}} </div> {{if .CanWriteCode}} - <button class="ui compact primary button tw-m-0 link-action" data-url="{{.Repository.Link}}/branches/merge-upstream?branch={{.BranchName}}"> + <button class="ui compact primary button tw-m-0 link-action" + data-modal-confirm-header="{{ctx.Locale.Tr "repo.pulls.upstream_diverging_merge"}}" + data-modal-confirm-content="{{ctx.Locale.Tr "repo.pulls.upstream_diverging_merge_confirm" $upstreamRepoBranchDisplay $thisRepoBranchDisplay}}" + data-url="{{.Repository.Link}}/branches/merge-upstream?branch={{.BranchName}}"> {{ctx.Locale.Tr "repo.pulls.upstream_diverging_merge"}} </button> {{end}} diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 3d95e8a715..46f641824b 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -5,7 +5,7 @@ <div class="ui container fluid padded"> <div class="ui top attached header clearing segment tw-relative commit-header"> <div class="tw-flex tw-mb-4 tw-gap-1"> - <h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3> + <h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message $.Repository}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses "AdditionalClasses" "tw-inline"}}</h3> {{if not $.PageIsWiki}} <div class="commit-header-buttons"> <a class="ui primary tiny button" href="{{.SourcePath}}"> @@ -16,7 +16,7 @@ {{ctx.Locale.Tr "repo.commit.operations"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> - <div class="ui header">{{ctx.Locale.Tr "repo.commit.operations"}}</div> + <div class="header">{{ctx.Locale.Tr "repo.commit.operations"}}</div> <div class="divider"></div> <div class="item show-create-branch-modal" data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}} @@ -54,13 +54,11 @@ <p id="cherry-pick-content" class="branch-dropdown"></p> <form method="get"> - {{/*FIXME: CurrentRefShortName seems not making sense here (old code), - because the "commit page" has no "$.BranchName" info, so only using DefaultBranch should be enough */}} {{template "repo/branch_dropdown" dict "Repository" .Repository "ShowTabBranches" true "CurrentRefType" "branch" - "CurrentRefShortName" (or $.BranchName $.Repository.DefaultBranch) + "CurrentRefShortName" $.Repository.DefaultBranch "RefFormActionTemplate" (print "{RepoLink}/_cherrypick/" .CommitID "/{RefShortName}") }} <input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br> @@ -77,7 +75,7 @@ {{.CsrfTokenHtml}} <div class="field"> <label> - {{ctx.Locale.Tr "repo.branch.new_branch_from" (`<span class="text" id="modal-create-branch-from-span"></span>`|SafeHTML)}} + {{ctx.Locale.Tr "repo.branch.new_branch_from" (HTMLFormat `<span class="%s" id="%s"></span>` "text" "modal-create-branch-from-span")}} </label> </div> <div class="required field"> @@ -85,7 +83,7 @@ <input id="new_branch_name" name="new_branch_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "repo.branch.confirm_create_branch"}}</button> </div> @@ -102,7 +100,7 @@ <input type="hidden" name="create_tag" value="true"> <div class="field"> <label> - {{ctx.Locale.Tr "repo.tag.create_tag_from" (`<span class="text" id="modal-create-tag-from-span"></span>`|SafeHTML)}} + {{ctx.Locale.Tr "repo.tag.create_tag_from" (HTMLFormat `<span class="%s" id="%s"></span>` "text" "modal-create-tag-from-span")}} </label> </div> <div class="required field"> @@ -110,7 +108,7 @@ <input id="new_branch_name" name="new_branch_name" required> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "repo.tag.confirm_create_tag"}}</button> </div> @@ -124,7 +122,7 @@ {{end}} </div> {{if IsMultilineCommitMessage .Commit.Message}} - <pre class="commit-body">{{ctx.RenderUtils.RenderCommitBody .Commit.Message ($.Repository.ComposeMetas ctx)}}</pre> + <pre class="commit-body">{{ctx.RenderUtils.RenderCommitBody .Commit.Message $.Repository}}</pre> {{end}} {{template "repo/commit_load_branches_and_tags" .}} </div> diff --git a/templates/repo/commit_sign_badge.tmpl b/templates/repo/commit_sign_badge.tmpl index aa68e9dd23..02089d7a4c 100644 --- a/templates/repo/commit_sign_badge.tmpl +++ b/templates/repo/commit_sign_badge.tmpl @@ -38,6 +38,8 @@ so this template should be kept as small as possbile, DO NOT put large component {{- else -}} {{- if $verification.Warning -}} {{- $extraClass = print $extraClass " sign-warning" -}} + {{- else -}} + {{- $extraClass = "" -}}{{/* the commit is not signed */}} {{- end -}} {{- $msgReason = ctx.Locale.Tr $verification.Reason -}}{{- /* dirty part: it is the translation key ..... */ -}} {{- end -}} @@ -57,6 +59,7 @@ so this template should be kept as small as possbile, DO NOT put large component <a {{if $commitBaseLink}}href="{{$commitBaseLink}}/{{$commit.ID}}"{{end}} class="ui label commit-id-short {{$extraClass}}" rel="nofollow"> {{- ShortSha $commit.ID.String -}} {{- end -}} +{{- if or (not $commit) $extraClass}}{{/* only show the lock icon if there is no commit info (icon only) or the commit is really signed */}} <span class="ui label commit-sign-badge {{$extraClass}}"> {{- if $verified -}} {{- if and $signingUser $signingUser.ID -}} @@ -70,7 +73,7 @@ so this template should be kept as small as possbile, DO NOT put large component <span data-tooltip-content="{{$msgReason}}">{{svg "gitea-unlock"}}</span> {{- end -}} </span> - +{{- end -}} {{- if $commit -}} </a> {{- end -}} diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl index eb700ab2bb..7184f5f8eb 100644 --- a/templates/repo/commit_status.tmpl +++ b/templates/repo/commit_status.tmpl @@ -14,3 +14,6 @@ {{if eq .State "warning"}} {{svg "gitea-exclamation" 18 "commit-status icon text yellow"}} {{end}} +{{if eq .State "skipped"}} + {{svg "octicon-skip" 18 "commit-status icon text grey"}} +{{end}} diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index a6f75584a3..1bbfb33105 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -1,10 +1,10 @@ {{if .Statuses}} {{if and (eq (len .Statuses) 1) .Status.TargetURL}} - <a class="flex-text-inline tw-no-underline {{.AdditionalClasses}}" data-tippy="commit-statuses" href="{{.Status.TargetURL}}"> + <a class="flex-text-inline tw-no-underline {{.AdditionalClasses}}" data-global-init="initCommitStatuses" href="{{.Status.TargetURL}}"> {{template "repo/commit_status" .Status}} </a> {{else}} - <span class="flex-text-inline {{.AdditionalClasses}}" data-tippy="commit-statuses" tabindex="0"> + <span class="flex-text-inline {{.AdditionalClasses}}" data-global-init="initCommitStatuses" tabindex="0"> {{template "repo/commit_status" .Status}} </span> {{end}} diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 7065bf33f4..07c6b5f618 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -5,24 +5,17 @@ {{template "repo/sub_menu" .}} <div class="repo-button-row"> <div class="repo-button-row-left"> - - {{$branchDropdownCurrentRefType := "branch"}} - {{$branchDropdownCurrentRefShortName := .BranchName}} - {{if .IsViewTag}} - {{$branchDropdownCurrentRefType = "tag"}} - {{$branchDropdownCurrentRefShortName = .TagName}} - {{end}} - {{template "repo/branch_dropdown" dict + {{- /* for /owner/repo/commits/{RefType}/{RefShortName} */ -}} + {{- template "repo/branch_dropdown" dict "Repository" .Repository "ShowTabBranches" true "ShowTabTags" true - "CurrentRefType" $branchDropdownCurrentRefType - "CurrentRefShortName" $branchDropdownCurrentRefShortName + "CurrentRefType" .RefFullName.RefType + "CurrentRefShortName" .RefFullName.ShortName "CurrentTreePath" .TreePath "RefLinkTemplate" "{RepoLink}/commits/{RefType}/{RefShortName}/{TreePath}" "AllowCreateNewRef" .CanCreateBranch - }} - + -}} <a href="{{.RepoLink}}/graph" class="ui basic small compact button"> {{svg "octicon-git-branch"}} {{ctx.Locale.Tr "repo.commit_graph"}} diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 329dc45149..959f2a9398 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -5,7 +5,7 @@ <th class="three wide">{{ctx.Locale.Tr "repo.commits.author"}}</th> <th class="two wide sha">{{StringUtils.ToUpper $.Repository.ObjectFormatName}}</th> <th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th> - <th class="two wide right aligned">{{ctx.Locale.Tr "repo.commits.date"}}</th> + <th class="two wide tw-text-right">{{ctx.Locale.Tr "repo.commits.date"}}</th> <th class="one wide"></th> </tr> </thead> @@ -44,33 +44,42 @@ <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | ctx.RenderUtils.RenderEmoji}}</span> {{else}} {{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}} - <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.Repository.ComposeMetas ctx)}}</span> + <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink $.Repository}}</span> {{end}} </span> {{if IsMultilineCommitMessage .Message}} - <button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button> + <button class="ui button ellipsis-button" aria-expanded="false" data-global-click="onRepoEllipsisButtonClick">...</button> {{end}} {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}} {{if IsMultilineCommitMessage .Message}} - <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .Message ($.Repository.ComposeMetas ctx)}}</pre> + <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .Message $.Repository}}</pre> {{end}} {{if $.CommitsTagsMap}} {{range (index $.CommitsTagsMap .ID.String)}} - {{- template "repo/tag/name" dict "RepoLink" $.Repository.Link "TagName" .TagName "IsRelease" (not .IsTag) -}} + {{- template "repo/tag/name" dict "AdditionalClasses" "tw-py-0" "RepoLink" $.Repository.Link "TagName" .TagName "IsRelease" (not .IsTag) -}} {{end}} {{end}} </td> {{if .Committer}} - <td class="text right aligned">{{DateUtils.TimeSince .Committer.When}}</td> + <td class="tw-text-right">{{DateUtils.TimeSince .Committer.When}}</td> {{else}} - <td class="text right aligned">{{DateUtils.TimeSince .Author.When}}</td> + <td class="tw-text-right">{{DateUtils.TimeSince .Author.When}}</td> {{end}} - <td class="text right aligned tw-py-0"> - <button class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button> - {{if not $.PageIsWiki}}{{/* at the moment, wiki doesn't support "view at history point*/}} + <td class="tw-text-right tw-py-0"> + <button class="btn interact-bg tw-p-2 copy-commit-id" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button> + {{/* at the moment, wiki doesn't support these "view" links like "view at history point" */}} + {{if not $.PageIsWiki}} + {{/* view single file diff */}} + {{if $.FileTreePath}} + <a class="btn interact-bg tw-p-2 view-single-diff" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_file_diff"}}" + href="{{$commitRepoLink}}/commit/{{.ID.String}}?files={{$.FileTreePath}}" + >{{svg "octicon-file-diff"}}</a> + {{end}} + + {{/* view at history point */}} {{$viewCommitLink := printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}} - {{if $.FileName}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileName)}}{{end}} - <a class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a> + {{if $.FileTreePath}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileTreePath)}}{{end}} + <a class="btn interact-bg tw-p-2 view-commit-path" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a> {{end}} </td> </tr> diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl index 2acf7c58b8..ee94ad7e58 100644 --- a/templates/repo/commits_list_small.tmpl +++ b/templates/repo/commits_list_small.tmpl @@ -15,7 +15,7 @@ {{$commitLink:= printf "%s/%s" $commitBaseLink (PathEscape .ID.String)}} <span class="tw-flex-1 tw-font-mono gt-ellipsis" title="{{.Summary}}"> - {{- ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}} + {{- ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink $.comment.Issue.PullRequest.BaseRepo -}} </span> {{if IsMultilineCommitMessage .Message}} @@ -29,7 +29,7 @@ </div> {{if IsMultilineCommitMessage .Message}} <pre class="commit-body tw-ml-[33px] tw-hidden" data-singular-commit-body-for="{{$tag}}"> - {{- ctx.RenderUtils.RenderCommitBody .Message ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}} + {{- ctx.RenderUtils.RenderCommitBody .Message $.comment.Issue.PullRequest.BaseRepo -}} </pre> {{end}} {{end}} diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 91fc1c2fae..a0c5eacdd4 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -19,7 +19,7 @@ {{if .PageIsCommits}} <div class="ui attached segment"> - <form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/search"> + <form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/search"> <div class="ui small fluid action input"> {{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.commit_kind")}} {{template "repo/commits_search_dropdown" .}} diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 78eb2f704a..ada7e0c092 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -1,222 +1,217 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new-repo"> - <div class="ui middle very relaxed page one column grid"> - <div class="column"> - <form class="ui form new-repo-form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "new_repo"}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + {{template "repo/create_helper" .}} + <form class="ui form left-right-form new-repo-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "new_repo"}} - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - {{template "repo/create_helper" .}} - - {{if not .CanCreateRepo}} - <div class="ui negative message"> - <p>{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}</p> - </div> - {{end}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> + <div id="create-repo-error-message" class="ui negative message tw-text-center tw-hidden"></div> + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection dropdown ellipsis-text-items" id="repo_owner_dropdown"> + <input type="hidden" name="uid" value="{{.ContextUser.ID}}"> + <span class="text"></span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}" + {{if not .CanCreateRepoInDoer}} + data-create-repo-disallowed-prompt="{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimitOfDoer}}" {{end}} - </div> + > + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} </div> - <span class="help">{{ctx.Locale.Tr "repo.owner_helper"}}</span> </div> + <span class="help">{{ctx.Locale.Tr "repo.owner_helper"}}</span> + </div> + + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required maxlength="100"> + <span class="help" data-help-for-repo-name>{{ctx.Locale.Tr "repo.repo_name_helper"}}</span> + <span class="help tw-hidden" data-help-for-repo-name=".profile">{{ctx.Locale.Tr "repo.repo_name_profile_public_hint"}}</span> + <span class="help tw-hidden" data-help-for-repo-name=".profile-private">{{ctx.Locale.Tr "repo.repo_name_profile_private_hint"}}</span> + </div> - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required maxlength="100"> - <span class="help" data-help-for-repo-name>{{ctx.Locale.Tr "repo.repo_name_helper"}}</span> - <span class="help tw-hidden" data-help-for-repo-name=".profile">{{ctx.Locale.Tr "repo.repo_name_profile_public_hint"}}</span> - <span class="help tw-hidden" data-help-for-repo-name=".profile-private">{{ctx.Locale.Tr "repo.repo_name_profile_private_hint"}}</span> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> + <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> + </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.template"}}</label> + <div id="repo_template_search" class="ui search selection dropdown"> + <input type="hidden" id="repo_template" name="repo_template" value="{{or .repo_template ""}}"> + <div class="default text">{{.repo_template_name}}</div> + <div class="menu"> + </div> + </div> + </div> + <div id="template_units" class="tw-hidden"> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <label>{{ctx.Locale.Tr "repo.template.items"}}</label> <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> - {{end}} + <input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.git_content"}}</label> + </div> + <div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip-content="{{ctx.Locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}> + <input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.git_hooks"}}</label> </div> - <span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span> - </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea> </div> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.template"}}</label> - <div id="repo_template_search" class="ui search selection dropdown"> - <input type="hidden" id="repo_template" name="repo_template" value="{{.repo_template}}"> - <div class="default text">{{.repo_template_name}}</div> - <div class="menu"> - </div> + <label></label> + <div class="ui checkbox"> + <input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.webhooks"}}</label> </div> - </div> - - <div id="template_units" class="tw-hidden"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.template.items"}}</label> - <div class="ui checkbox"> - <input name="git_content" type="checkbox" {{if .git_content}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.git_content"}}</label> - </div> - <div class="ui checkbox" {{if not .SignedUser.CanEditGitHook}}data-tooltip-content="{{ctx.Locale.Tr "repo.template.git_hooks_tooltip"}}"{{end}}> - <input name="git_hooks" type="checkbox" {{if .git_hooks}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.git_hooks"}}</label> - </div> + <div class="ui checkbox"> + <input name="topics" type="checkbox" {{if .topics}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.topics"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="webhooks" type="checkbox" {{if .webhooks}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.webhooks"}}</label> - </div> - <div class="ui checkbox"> - <input name="topics" type="checkbox" {{if .topics}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.topics"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.avatar"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="avatar" type="checkbox" {{if .avatar}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.avatar"}}</label> - </div> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.template.issue_labels"}}</label> - </div> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.issue_labels"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.settings.protected_branch"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="protected_branch" type="checkbox" {{if .protected_branch}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protected_branch"}}</label> </div> </div> + </div> - <div id="non_template"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.issue_labels"}}</label> - <div class="ui search selection dropdown"> - <input type="hidden" name="issue_labels" value="{{.issueLabels}}"> - <div class="default text">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> - <div class="menu"> - <div class="item" data-value="">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> - {{range .LabelTemplateFiles}} - <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div> - {{end}} - </div> + <div id="non_template"> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.issue_labels"}}</label> + <div class="ui search selection dropdown"> + <input type="hidden" name="issue_labels" value="{{.issueLabels}}"> + <div class="default text">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> + <div class="menu"> + <div class="item" data-value="">{{ctx.Locale.Tr "repo.issue_labels_helper"}}</div> + {{range .LabelTemplateFiles}} + <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><i>({{.Description}})</i></div> + {{end}} </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline field"> - <label>.gitignore</label> - <div class="ui multiple search selection dropdown"> - <input type="hidden" name="gitignores" value="{{.gitignores}}"> - <div class="default text">{{ctx.Locale.Tr "repo.repo_gitignore_helper"}}</div> - <div class="menu"> - {{range .Gitignores}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> - </div> - <span class="help">{{ctx.Locale.Tr "repo.repo_gitignore_helper_desc"}}</span> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.license"}}</label> - <div class="ui search selection dropdown"> - <input type="hidden" name="license" value="{{.license}}"> - <div class="default text">{{ctx.Locale.Tr "repo.license_helper"}}</div> - <div class="menu"> - <div class="item" data-value="">{{ctx.Locale.Tr "repo.license_helper"}}</div> - {{range .Licenses}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> + <div class="inline field"> + <label>.gitignore</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="gitignores" value="{{.gitignores}}"> + <div class="default text">{{ctx.Locale.Tr "repo.repo_gitignore_helper"}}</div> + <div class="menu"> + {{range .Gitignores}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} </div> - <span class="help">{{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/"}}</span> </div> - - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.readme"}}</label> - <div class="ui selection dropdown"> - <input type="hidden" name="readme" value="{{.readme}}"> - <div class="default text">{{ctx.Locale.Tr "repo.readme_helper"}}</div> - <div class="menu"> - {{range .Readmes}} - <div class="item" data-value="{{.}}">{{.}}</div> - {{end}} - </div> + <span class="help">{{ctx.Locale.Tr "repo.repo_gitignore_helper_desc"}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.license"}}</label> + <div class="ui search selection dropdown"> + <input type="hidden" name="license" value="{{.license}}"> + <div class="default text">{{ctx.Locale.Tr "repo.license_helper"}}</div> + <div class="menu"> + <div class="item" data-value="">{{ctx.Locale.Tr "repo.license_helper"}}</div> + {{range .Licenses}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} </div> - <span class="help">{{ctx.Locale.Tr "repo.readme_helper_desc"}}</span> </div> - <div class="inline field"> - <div class="ui checkbox" id="auto-init"> - <input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.auto_init"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.license_helper_desc" "https://choosealicense.com/"}}</span> + </div> + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.readme"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" name="readme" value="{{.readme}}"> + <div class="default text">{{ctx.Locale.Tr "repo.readme_helper"}}</div> + <div class="menu"> + {{range .Readmes}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} </div> </div> - <div class="inline field"> - <label for="default_branch">{{ctx.Locale.Tr "repo.default_branch"}}</label> - <input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="{{.default_branch}}"> - <span class="help">{{ctx.Locale.Tr "repo.default_branch_helper"}}</span> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.object_format"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="object_format_name" name="object_format_name" value="{{.DefaultObjectFormat.Name}}" required> - <div class="default text">{{.DefaultObjectFormat.Name}}</div> - <div class="menu"> - {{range .SupportedObjectFormats}} - <div class="item" data-value="{{.Name}}">{{.Name}}</div> - {{end}} - </div> - </div> - <span class="help">{{ctx.Locale.Tr "repo.object_format_helper"}}</span> + <span class="help">{{ctx.Locale.Tr "repo.readme_helper_desc"}}</span> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox" id="auto-init"> + <input name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.auto_init"}}</label> </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.template"}}</label> - <div class="ui checkbox"> - <input name="template" type="checkbox"> - <label>{{ctx.Locale.Tr "repo.template_helper"}}</label> + </div> + <div class="inline field"> + <label for="default_branch">{{ctx.Locale.Tr "repo.default_branch"}}</label> + <input id="default_branch" name="default_branch" value="{{.default_branch}}" placeholder="{{.default_branch}}"> + <span class="help">{{ctx.Locale.Tr "repo.default_branch_helper"}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.object_format"}}</label> + <div class="ui selection owner dropdown"> + <input type="hidden" id="object_format_name" name="object_format_name" value="{{or .object_format_name .DefaultObjectFormat.Name}}" required> + <div class="default text">{{.DefaultObjectFormat.Name}}</div> + <div class="menu"> + {{range .SupportedObjectFormats}} + <div class="item" data-value="{{.Name}}">{{.Name}}</div> + {{end}} </div> </div> + <span class="help">{{ctx.Locale.Tr "repo.object_format_helper"}}</span> </div> - <br> <div class="inline field"> - <label></label> - <button class="ui primary button{{if not .CanCreateRepo}} disabled{{end}}"> - {{ctx.Locale.Tr "repo.create_repo"}} - </button> + <label>{{ctx.Locale.Tr "repo.template"}}</label> + <div class="ui checkbox"> + <input name="template" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.template_helper"}}</label> + </div> </div> </div> + <br> + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.create_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 9733e5f980..22abf9a219 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -1,6 +1,6 @@ -{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}} +{{$showFileTree := (and (not .DiffNotAvailable) (gt .DiffShortStat.NumFiles 1))}} <div> - <div class="diff-detail-box diff-box"> + <div class="diff-detail-box"> <div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-ml-0.5"> {{if $showFileTree}} <button class="diff-toggle-file-tree-button not-mobile btn interact-fg" data-show-text="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}"> @@ -19,17 +19,17 @@ {{end}} {{if not .DiffNotAvailable}} <div class="diff-detail-stats tw-flex tw-items-center tw-flex-wrap"> - {{svg "octicon-diff" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion}} + {{svg "octicon-diff" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .DiffShortStat.NumFiles .DiffShortStat.TotalAddition .DiffShortStat.TotalDeletion}} </div> {{end}} </div> <div class="diff-detail-actions"> - {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}} + {{if and .PageIsPullFiles $.SignedUserID (not .DiffNotAvailable)}} <div class="not-mobile tw-flex tw-items-center tw-flex-col tw-whitespace-nowrap tw-mr-1"> <label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{ctx.Locale.Tr "repo.pulls.viewed_files_label"}}"> - {{ctx.Locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}} + {{ctx.Locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .DiffShortStat.NumFiles}} </label> - <progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.Diff.NumFiles}}"></progress> + <progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.DiffShortStat.NumFiles}}"></progress> </div> {{end}} {{template "repo/diff/whitespace_dropdown" .}} @@ -37,12 +37,12 @@ {{if .PageIsPullFiles}} <div id="diff-commit-select" data-issuelink="{{$.Issue.Link}}" data-queryparams="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}" data-filter_changes_by_commit="{{ctx.Locale.Tr "repo.pulls.filter_changes_by_commit"}}"> {{/* the following will be replaced by vue component, but this avoids any loading artifacts till the vue component is initialized */}} - <div class="ui jump dropdown basic button custom"> + <div class="ui jump dropdown tiny basic button custom"> {{svg "octicon-git-commit"}} </div> </div> {{end}} - {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}} + {{if and .PageIsPullFiles $.SignedUserID}} {{template "repo/diff/new_review" .}} {{end}} </div> @@ -57,35 +57,10 @@ <div>{{ctx.Locale.Tr "repo.pulls.showing_specified_commit_range" (ShortSha .BeforeCommitID) (ShortSha .AfterCommitID)}} - <a href="{{$.Issue.Link}}/files?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}">{{ctx.Locale.Tr "repo.pulls.show_all_commits"}}</a></div> </div> {{end}} - <script id="diff-data-script" type="module"> - const diffDataFiles = [{{range $i, $file := .Diff.Files}}{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Type:{{$file.Type}},IsBin:{{$file.IsBin}},Addition:{{$file.Addition}},Deletion:{{$file.Deletion}},IsViewed:{{$file.IsViewed}}},{{end}}]; - const diffData = { - isIncomplete: {{.Diff.IsIncomplete}}, - tooManyFilesMessage: "{{ctx.Locale.Tr "repo.diff.too_many_files"}}", - binaryFileMessage: "{{ctx.Locale.Tr "repo.diff.bin"}}", - showMoreMessage: "{{ctx.Locale.Tr "repo.diff.show_more"}}", - statisticsMessage: "{{ctx.Locale.Tr "repo.diff.stats_desc_file"}}", - linkLoadMore: "?skip-to={{.Diff.End}}&file-only=true", - }; - - // for first time loading, the diffFileInfo is a plain object - // after the Vue component is mounted, the diffFileInfo is a reactive object - // keep in mind that this script block would be executed many times when loading more files, by "loadMoreFiles" - let diffFileInfo = window.config.pageData.diffFileInfo || { - files:[], - fileTreeIsVisible: false, - fileListIsVisible: false, - isLoadingNewData: false, - selectedItem: '', - }; - diffFileInfo = Object.assign(diffFileInfo, diffData); - diffFileInfo.files.push(...diffDataFiles); - window.config.pageData.diffFileInfo = diffFileInfo; - </script> - <div id="diff-file-list"></div> {{end}} <div id="diff-container"> {{if $showFileTree}} + {{$.FileIconPoolHTML}} <div id="diff-file-tree" class="tw-hidden not-mobile"></div> <script> if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('tw-hidden'); @@ -105,8 +80,8 @@ {{$isCsv := (call $.IsCsvFile $file)}} {{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}} {{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}} - {{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.IsArchived) $.IsShowingAllCommits}} - <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} tw-mt-0" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}> + {{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.Repository.IsArchived) $.IsShowingAllCommits}} + <div class="diff-file-box file-content {{TabSizeClass $.Editorconfig $file.Name}} tw-mt-0" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}> <h4 class="diff-file-header sticky-2nd-row ui top attached header"> <div class="diff-file-name tw-flex tw-flex-1 tw-items-center tw-gap-1 tw-flex-wrap"> <button class="fold-file btn interact-bg tw-p-1{{if not $isExpandable}} tw-invisible{{end}}"> @@ -126,8 +101,8 @@ {{end}} </div> <span class="file tw-flex tw-items-center tw-font-mono tw-flex-1"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} โ {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} โ {{end}}{{$file.Name}}</a> - {{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} <button class="btn interact-fg tw-p-2" data-clipboard-text="{{$file.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> + {{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}} {{if $file.IsGenerated}} <span class="ui label">{{ctx.Locale.Tr "repo.diff.generated"}}</span> {{end}} @@ -161,23 +136,25 @@ <input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{ctx.Locale.Tr "repo.pulls.has_viewed_file"}} </label> {{end}} - <button class="btn diff-header-popup-btn tw-p-1">{{svg "octicon-kebab-horizontal" 18}}</button> - <div class="tippy-target"> - {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} - <button class="unescape-button item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> - <button class="escape-button tw-hidden item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> - {{end}} - {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} - {{if $file.IsDeleted}} - <a class="item" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> - {{else}} - <a class="item" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> - {{if and $.Repository.CanEnableEditor $.CanEditFile (not $file.IsLFSFile) (not $file.IsBin)}} - <a class="item" rel="nofollow" href="{{$.HeadRepoLink}}/_edit/{{PathEscapeSegments $.HeadBranchName}}/{{PathEscapeSegments $file.Name}}?return_uri={{print $.BackToLink "#diff-" $file.NameHash | QueryEscape}}">{{ctx.Locale.Tr "repo.editor.edit_this_file"}}</a> + {{if not $file.IsSubmodule}} + <button class="btn diff-header-popup-btn tw-p-1">{{svg "octicon-kebab-horizontal" 18}}</button> + <div class="tippy-target"> + {{if not (or $file.IsIncomplete $file.IsBin)}} + <button class="unescape-button item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> + <button class="escape-button tw-hidden item" data-unicode-content-selector="#diff-{{$file.NameHash}}">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> + {{end}} + {{if not $.PageIsWiki}} + {{if $file.IsDeleted}} + <a class="item" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + {{else}} + <a class="item" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + {{if and $.Repository.CanEnableEditor $.CanEditFile}} + <a class="item" rel="nofollow" href="{{$.HeadRepoLink}}/_edit/{{PathEscapeSegments $.HeadBranchName}}/{{PathEscapeSegments $file.Name}}?return_uri={{print $.BackToLink "#diff-" $file.NameHash | QueryEscape}}">{{ctx.Locale.Tr "repo.editor.edit_this_file"}}</a> + {{end}} {{end}} {{end}} - {{end}} - </div> + </div> + {{end}} </div> </h4> <div class="diff-file-body ui attached unstackable table segment" {{if and $file.IsViewed $.IsShowingAllCommits}}data-folded="true"{{end}}> @@ -195,6 +172,17 @@ {{ctx.Locale.Tr "repo.diff.bin_not_shown"}} {{end}} </div> + {{else if $file.SubmoduleDiffInfo}} + <div class="tw-p-3">{{svg "octicon-file-submodule"}} {{$submoduleDiffInfo := $file.SubmoduleDiffInfo -}} + {{- $submoduleName := $submoduleDiffInfo.SubmoduleRepoLinkHTML ctx -}} + {{- if $file.IsDeleted -}} + {{- ctx.Locale.Tr "repo.diff.submodule_deleted" $submoduleName ($submoduleDiffInfo.CommitRefIDLinkHTML ctx $submoduleDiffInfo.PreviousRefID) -}} + {{- else if $file.IsCreated -}} + {{- ctx.Locale.Tr "repo.diff.submodule_added" $submoduleName ($submoduleDiffInfo.CommitRefIDLinkHTML ctx $submoduleDiffInfo.NewRefID) -}} + {{- else -}} + {{- ctx.Locale.Tr "repo.diff.submodule_updated" $submoduleName ($submoduleDiffInfo.CompareRefIDLinkHTML ctx) -}} + {{end}} + </div> {{else}} <table class="chroma" data-new-comment-url="{{$.Issue.Link}}/files/reviews/new_comment" data-path="{{$file.Name}}"> {{if $.IsSplitStyle}} @@ -222,7 +210,7 @@ {{end}} {{if .Diff.IsIncomplete}} - <div class="diff-file-box diff-box file-content tw-mt-2" id="diff-incomplete"> + <div class="diff-file-box file-content tw-mt-2" id="diff-incomplete"> <h4 class="ui top attached header tw-font-normal tw-flex tw-items-center tw-justify-between"> {{ctx.Locale.Tr "repo.diff.too_many_files"}} <a class="ui basic tiny button" id="diff-show-more-files" data-href="?skip-to={{.Diff.End}}&file-only=true">{{ctx.Locale.Tr "repo.diff.show_more"}}</a> @@ -236,6 +224,7 @@ {{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}} <template id="issue-comment-editor-template"> <form class="ui form comment"> + <div class="field"> {{template "shared/combomarkdowneditor" (dict "CustomInit" true "MarkdownPreviewInRepo" $.Repository @@ -243,12 +232,13 @@ "TextareaName" "content" "DropzoneParentContainer" ".ui.form" )}} + </div> {{if .IsAttachmentEnabled}} <div class="field"> {{template "repo/upload" .}} </div> {{end}} - <div class="text right edit buttons"> + <div class="field flex-text-block tw-justify-end"> <button class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button> </div> diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 964dc2adc7..58b675467c 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -27,7 +27,7 @@ {{end}} <div class="field footer"> - <div class="tw-text-right"> + <div class="flex-text-block tw-justify-end"> {{if $.reply}} <button class="ui submit primary tiny button btn-reply" type="submit">{{ctx.Locale.Tr "repo.diff.comment.reply"}}</button> <input type="hidden" name="reply" value="{{$.reply}}"> diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 2d716688b9..2e8261e479 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -8,7 +8,7 @@ {{template "shared/user/avatarlink" dict "user" .Poster}} {{end}} <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between"> + <div class="comment-header"> <div class="comment-header-left tw-flex tw-items-center"> {{if .OriginalAuthor}} <span class="text black tw-font-semibold tw-mr-1"> @@ -48,7 +48,9 @@ </div> {{end}} {{end}} - {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} + {{if not $.root.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} + {{end}} {{template "repo/issue/view_content/context_menu" dict "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}} </div> </div> diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 9a7a04a328..4e8ad1326c 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -32,7 +32,7 @@ <a class="tw-mr-2" href="{{$.HeadRepo.Link}}/compare/{{PathEscapeSegments $.HeadBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.BaseName}}/{{PathEscape $.Repository.Name}}:{{end}}{{PathEscapeSegments $.BaseBranch}}" title="{{ctx.Locale.Tr "repo.pulls.switch_head_and_base"}}">{{svg "octicon-git-compare"}}</a> <div class="ui dropdown jump select-branch"> <div class="ui basic small button"> - <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_base"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_base"}}{{end}}: {{$BaseCompareName}}:{{$.BaseBranch}}</span> + <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_base"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_base"}}{{end}}: <strong>{{$BaseCompareName}}:{{$.BaseBranch}}</strong></span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> <div class="menu"> @@ -103,7 +103,7 @@ <div class="ui dropdown jump select-branch"> <div class="ui basic small button"> - <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_compare"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_head"}}{{end}}: {{$HeadCompareName}}:{{$.HeadBranch}}</span> + <span class="text">{{if $.PageIsComparePull}}{{ctx.Locale.Tr "repo.pulls.compare_compare"}}{{else}}{{ctx.Locale.Tr "repo.compare.compare_head"}}{{end}}: <strong>{{$HeadCompareName}}:{{$.HeadBranch}}</strong></span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> <div class="menu"> @@ -189,7 +189,7 @@ <div class="ui segment flex-text-block tw-gap-4"> {{template "shared/issueicon" .}} <div class="issue-title tw-break-anywhere"> - {{ctx.RenderUtils.RenderIssueTitle .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx)}} + {{ctx.RenderUtils.RenderIssueTitle .PullRequest.Issue.Title $.Repository}} <span class="index">#{{.PullRequest.Issue.Index}}</span> </div> <a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui compact button primary"> @@ -205,10 +205,10 @@ {{end}} </div> {{else if $allowCreatePR}} - <div class="ui info message pullrequest-form-toggle {{if .Flash}}tw-hidden{{end}}"> + <div class="ui info message pullrequest-form-toggle {{if .ExpandNewPrForm}}tw-hidden{{end}}"> <button class="ui button primary show-panel toggle" data-panel=".pullrequest-form-toggle, .pullrequest-form">{{ctx.Locale.Tr "repo.pulls.new"}}</button> </div> - <div class="pullrequest-form {{if not .Flash}}tw-hidden{{end}}"> + <div class="pullrequest-form {{if not .ExpandNewPrForm}}tw-hidden{{end}}"> {{template "repo/issue/new_form" .}} </div> {{end}} diff --git a/templates/repo/diff/conversation.tmpl b/templates/repo/diff/conversation.tmpl index 08f60644b3..eb2abfa7e9 100644 --- a/templates/repo/diff/conversation.tmpl +++ b/templates/repo/diff/conversation.tmpl @@ -8,9 +8,9 @@ {{$referenceUrl := printf "%s#%s" $.Issue.Link $comment.HashTag}} <div class="conversation-holder" data-path="{{$comment.TreePath}}" data-side="{{if lt $comment.Line 0}}left{{else}}right{{end}}" data-idx="{{$comment.UnsignedLine}}"> {{if $resolved}} - <div class="ui attached header resolved-placeholder tw-flex tw-items-center tw-justify-between"> - <div class="ui grey text tw-flex tw-items-center tw-flex-wrap tw-gap-1"> - {{svg "octicon-check" 16 "icon tw-mr-1"}} + <div class="resolved-placeholder"> + <div class="flex-text-block tw-flex-wrap grey text"> + {{svg "octicon-check"}} <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} {{if $invalid}} <!-- @@ -22,35 +22,33 @@ </a> {{end}} </div> - <div class="tw-flex tw-items-center tw-gap-2"> - <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button show-outdated tw-flex tw-items-center"> - {{svg "octicon-unfold" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} + <div class="flex-text-block"> + <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny show-outdated"> + {{svg "octicon-unfold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.show_resolved"}} </button> - <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button hide-outdated tw-flex tw-items-center tw-hidden"> - {{svg "octicon-fold" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} + <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="btn tiny hide-outdated tw-hidden"> + {{svg "octicon-fold" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} </button> </div> </div> {{end}} <div id="code-comments-{{$comment.ID}}" class="field comment-code-cloud {{if $resolved}}tw-hidden{{end}}"> <div class="comment-list"> - <ui class="ui comments"> + <div class="ui comments"> {{template "repo/diff/comments" dict "root" $ "comments" .comments}} - </ui> + </div> </div> - <div class="tw-flex tw-justify-end tw-items-center tw-gap-2 tw-mt-2 tw-flex-wrap"> + <div class="flex-text-block tw-mt-2 tw-flex-wrap tw-justify-end"> <div class="ui buttons"> <button class="ui icon tiny basic button previous-conversation"> - {{svg "octicon-arrow-up" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.previous"}} + {{svg "octicon-arrow-up" 12}} {{ctx.Locale.Tr "repo.issues.previous"}} </button> <button class="ui icon tiny basic button next-conversation"> - {{svg "octicon-arrow-down" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.next"}} + {{svg "octicon-arrow-down" 12}} {{ctx.Locale.Tr "repo.issues.next"}} </button> </div> {{if and $.CanMarkConversation $hasReview (not $isReviewPending)}} - <button class="ui icon tiny basic button resolve-conversation tw-mr-0" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> + <button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> {{if $resolved}} {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} {{else}} @@ -59,8 +57,8 @@ </button> {{end}} {{if and $.SignedUserID (not $.Repository.IsArchived)}} - <button class="comment-form-reply ui primary tiny labeled icon button tw-mr-0"> - {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} + <button class="comment-form-reply ui primary icon tiny button"> + {{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} </button> {{end}} </div> diff --git a/templates/repo/diff/image_diff.tmpl b/templates/repo/diff/image_diff.tmpl index 608174e51b..7557129c64 100644 --- a/templates/repo/diff/image_diff.tmpl +++ b/templates/repo/diff/image_diff.tmpl @@ -9,20 +9,20 @@ > <overflow-menu class="ui secondary pointing tabular menu custom"> <div class="overflow-menu-items tw-justify-center"> - <a class="item active" data-tab="diff-side-by-side-{{.file.Index}}">{{ctx.Locale.Tr "repo.diff.image.side_by_side"}}</a> + <a class="item active" data-tab="diff-side-by-side-{{.file.NameHash}}">{{ctx.Locale.Tr "repo.diff.image.side_by_side"}}</a> {{if and .blobBase .blobHead}} - <a class="item" data-tab="diff-swipe-{{.file.Index}}">{{ctx.Locale.Tr "repo.diff.image.swipe"}}</a> - <a class="item" data-tab="diff-overlay-{{.file.Index}}">{{ctx.Locale.Tr "repo.diff.image.overlay"}}</a> + <a class="item" data-tab="diff-swipe-{{.file.NameHash}}">{{ctx.Locale.Tr "repo.diff.image.swipe"}}</a> + <a class="item" data-tab="diff-overlay-{{.file.NameHash}}">{{ctx.Locale.Tr "repo.diff.image.overlay"}}</a> {{end}} </div> </overflow-menu> <div class="image-diff-tabs is-loading"> - <div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.Index}}"> + <div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.NameHash}}"> <div class="diff-side-by-side"> {{if .blobBase}} <span class="side"> <p class="side-header">{{ctx.Locale.Tr "repo.diff.file_before"}}</p> - <span class="before-container"><img class="image-before"></span> + <span class="before-container"><img alt class="image-before"></span> <p> <span class="bounds-info-before"> {{ctx.Locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span> @@ -37,7 +37,7 @@ {{if .blobHead}} <span class="side"> <p class="side-header">{{ctx.Locale.Tr "repo.diff.file_after"}}</p> - <span class="after-container"><img class="image-after"></span> + <span class="after-container"><img alt class="image-after"></span> <p> <span class="bounds-info-after"> {{ctx.Locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span> @@ -52,12 +52,12 @@ </div> </div> {{if and .blobBase .blobHead}} - <div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.Index}}"> + <div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.NameHash}}"> <div class="diff-swipe"> <div class="swipe-frame"> - <span class="before-container"><img class="image-before"></span> + <span class="before-container"><img alt class="image-before"></span> <span class="swipe-container"> - <span class="after-container"><img class="image-after"></span> + <span class="after-container"><img alt class="image-after"></span> </span> <span class="swipe-bar"> <span class="handle top-handle"></span> @@ -66,12 +66,12 @@ </div> </div> </div> - <div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{.file.Index}}"> + <div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{.file.NameHash}}"> <div class="diff-overlay"> <input type="range" min="0" max="100" value="50"> <div class="overlay-frame"> - <span class="before-container"><img class="image-before"></span> - <span class="after-container"><img class="image-after"></span> + <span class="before-container"><img alt class="image-before"></span> + <span class="after-container"><img alt class="image-after"></span> </div> </div> </div> diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index 2febc6303a..3bb01a139a 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -1,56 +1,59 @@ -<div id="review-box"> - <button class="ui tiny primary button tw-pr-1 tw-flex js-btn-review {{if not $.IsShowingAllCommits}}disabled{{end}}" {{if not $.IsShowingAllCommits}}data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.review_only_possible_for_full_diff"}}"{{end}}> +<div id="review-box" {{if $.Repository.IsArchived}}data-tooltip-content="{{ctx.Locale.Tr "repo.archive.pull.nocomment"}}"{{end}}> + <button class="ui tiny primary button tw-pr-1 js-btn-review {{if not $.IsShowingAllCommits}}disabled{{end}}" + {{if not $.IsShowingAllCommits}}data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.review_only_possible_for_full_diff"}}"{{end}} + {{if $.Repository.IsArchived}}disabled{{end}} + > {{ctx.Locale.Tr "repo.diff.review"}} <span class="ui small label review-comments-counter" data-pending-comment-number="{{.PendingCodeCommentNumber}}">{{.PendingCodeCommentNumber}}</span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </button> - {{if $.IsShowingAllCommits}} - <div class="review-box-panel tippy-target"> - <div class="ui segment"> - <form class="ui form form-fetch-action" action="{{.Link}}/reviews/submit" method="post"> - {{.CsrfTokenHtml}} - <input type="hidden" name="commit_id" value="{{.AfterCommitID}}"> - <div class="field tw-flex tw-items-center"> - <div class="tw-flex-1">{{ctx.Locale.Tr "repo.diff.review.header"}}</div> - <a class="muted close">{{svg "octicon-x" 16}}</a> - </div> +</div> +{{if $.IsShowingAllCommits}} +<div class="review-box-panel tippy-target"> + <div class="ui segment"> + <form class="ui form form-fetch-action" action="{{.Link}}/reviews/submit" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="commit_id" value="{{.AfterCommitID}}"> + <div class="field tw-flex tw-items-center"> + <div class="tw-flex-1">{{ctx.Locale.Tr "repo.diff.review.header"}}</div> + <a class="muted close">{{svg "octicon-x" 16}}</a> + </div> + <div class="field"> + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewInRepo" $.Repository + "MarkdownPreviewMode" "comment" + "TextareaName" "content" + "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.review.placeholder") + "DropzoneParentContainer" "form" + )}} + </div> + {{if .IsAttachmentEnabled}} <div class="field"> - {{template "shared/combomarkdowneditor" (dict - "MarkdownPreviewInRepo" $.Repository - "MarkdownPreviewMode" "comment" - "TextareaName" "content" - "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.review.placeholder") - "DropzoneParentContainer" "form" - )}} + {{template "repo/upload" .}} </div> - {{if .IsAttachmentEnabled}} - <div class="field"> - {{template "repo/upload" .}} - </div> - {{end}} - <div class="divider"></div> - {{$showSelfTooltip := (and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID))}} - {{if not $.Issue.IsClosed}} - {{if $showSelfTooltip}} - <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_approve"}}"> - <button type="submit" name="type" value="approve" disabled class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> - </span> - {{else}} - <button type="submit" name="type" value="approve" class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> - {{end}} + {{end}} + <div class="divider"></div> + {{$showSelfTooltip := (and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID))}} + {{if not $.Issue.IsClosed}} + {{if $showSelfTooltip}} + <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_approve"}}"> + <button type="submit" name="type" value="approve" disabled class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> + </span> + {{else}} + <button type="submit" name="type" value="approve" class="ui submit primary tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.approve"}}</button> {{end}} - <button type="submit" name="type" value="comment" class="ui submit tiny basic button btn-submit">{{ctx.Locale.Tr "repo.diff.review.comment"}}</button> - {{if not $.Issue.IsClosed}} - {{if $showSelfTooltip}} - <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_reject"}}"> - <button type="submit" name="type" value="reject" disabled class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> - </span> - {{else}} - <button type="submit" name="type" value="reject" class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> - {{end}} + {{end}} + <button type="submit" name="type" value="comment" class="ui submit tiny basic button btn-submit">{{ctx.Locale.Tr "repo.diff.review.comment"}}</button> + {{if not $.Issue.IsClosed}} + {{if $showSelfTooltip}} + <span class="tw-inline-block" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.review.self_reject"}}"> + <button type="submit" name="type" value="reject" disabled class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> + </span> + {{else}} + <button type="submit" name="type" value="reject" class="ui submit red tiny button btn-submit">{{ctx.Locale.Tr "repo.diff.review.reject"}}</button> {{end}} - </form> - </div> + {{end}} + </form> </div> - {{end}} </div> +{{end}} diff --git a/templates/repo/diff/options_dropdown.tmpl b/templates/repo/diff/options_dropdown.tmpl index 09b7b80e41..8d08e7ad46 100644 --- a/templates/repo/diff/options_dropdown.tmpl +++ b/templates/repo/diff/options_dropdown.tmpl @@ -1,7 +1,6 @@ <div class="ui dropdown tiny basic button" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.options_button"}}"> {{svg "octicon-kebab-horizontal"}} <div class="menu"> - <a class="item" id="show-file-list-btn">{{ctx.Locale.Tr "repo.diff.show_diff_stats"}}</a> {{if .Issue.Index}} <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a> <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a> diff --git a/templates/repo/editor/cherry_pick.tmpl b/templates/repo/editor/cherry_pick.tmpl index f9c9eef5aa..7981fd0761 100644 --- a/templates/repo/editor/cherry_pick.tmpl +++ b/templates/repo/editor/cherry_pick.tmpl @@ -3,15 +3,14 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui edit form" method="post" action="{{.RepoLink}}/_cherrypick/{{.SHA}}/{{.BranchName | PathEscapeSegments}}"> + <form class="ui edit form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"> {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> - <input type="hidden" name="page_has_posted" value="true"> + {{template "repo/editor/common_top" .}} <input type="hidden" name="revert" value="{{if eq .CherryPickType "revert"}}true{{else}}false{{end}}"> <div class="repo-editor-header"> - <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> - {{$shaurl := printf "%s/commit/%s" $.RepoLink (PathEscape .SHA)}} - {{$shalink := HTMLFormat `<a class="ui primary sha label" href="%s">%s</a>` $shaurl (ShortSha .SHA)}} + <div class="breadcrumb"> + {{$shaurl := printf "%s/commit/%s" $.RepoLink (PathEscape .FromCommitID)}} + {{$shalink := HTMLFormat `<a class="ui primary sha label" href="%s">%s</a>` $shaurl (ShortSha .FromCommitID)}} {{if eq .CherryPickType "revert"}} {{ctx.Locale.Tr "repo.editor.revert" $shalink}} {{else}} diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl index c050324e93..7067614444 100644 --- a/templates/repo/editor/commit_form.tmpl +++ b/templates/repo/editor/commit_form.tmpl @@ -1,11 +1,11 @@ <div class="commit-form-wrapper"> {{ctx.AvatarUtils.Avatar .SignedUser 40 "commit-avatar"}} <div class="commit-form"> - <h3>{{- if .CanCommitToBranch.WillSign}} - <span title="{{ctx.Locale.Tr "repo.signing.will_sign" .CanCommitToBranch.SigningKey}}">{{svg "octicon-lock" 24}}</span> + <h3>{{- if .CommitFormOptions.WillSign}} + <span title="{{ctx.Locale.Tr "repo.signing.will_sign" .CommitFormOptions.SigningKey}}">{{svg "octicon-lock" 24}}</span> {{ctx.Locale.Tr "repo.editor.commit_signed_changes"}} {{- else}} - <span title="{{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .CanCommitToBranch.WontSignReason)}}">{{svg "octicon-unlock" 24}}</span> + <span title="{{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .CommitFormOptions.WontSignReason)}}">{{svg "octicon-unlock" 24}}</span> {{ctx.Locale.Tr "repo.editor.commit_changes"}} {{- end}}</h3> <div class="field"> @@ -22,17 +22,17 @@ </div> <div class="quick-pull-choice js-quick-pull-choice"> <div class="field"> - <div class="ui radio checkbox {{if not .CanCommitToBranch.CanCommitToBranch}}disabled{{end}}"> + <div class="ui radio checkbox {{if not .CommitFormOptions.CanCommitToBranch}}disabled{{end}}"> <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" data-button-text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "direct"}}checked{{end}}> <label> {{svg "octicon-git-commit"}} {{ctx.Locale.Tr "repo.editor.commit_directly_to_this_branch" .BranchName}} - {{if not .CanCommitToBranch.CanCommitToBranch}} + {{if not .CommitFormOptions.CanCommitToBranch}} <div class="ui visible small warning message"> {{ctx.Locale.Tr "repo.editor.no_commit_to_branch"}} <ul> - {{if not .CanCommitToBranch.UserCanPush}}<li>{{ctx.Locale.Tr "repo.editor.user_no_push_to_branch"}}</li>{{end}} - {{if and .CanCommitToBranch.RequireSigned (not .CanCommitToBranch.WillSign)}}<li>{{ctx.Locale.Tr "repo.editor.require_signed_commit"}}</li>{{end}} + {{if not .CommitFormOptions.UserCanPush}}<li>{{ctx.Locale.Tr "repo.editor.user_no_push_to_branch"}}</li>{{end}} + {{if and .CommitFormOptions.RequireSigned (not .CommitFormOptions.WillSign)}}<li>{{ctx.Locale.Tr "repo.editor.require_signed_commit"}}</li>{{end}} </ul> </div> {{end}} @@ -42,14 +42,14 @@ {{if and (not .Repository.IsEmpty) (not .IsEditingFileOnly)}} <div class="field"> <div class="ui radio checkbox"> - {{if .CanCreatePullRequest}} + {{if .CommitFormOptions.CanCreatePullRequest}} <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" data-button-text="{{ctx.Locale.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> {{else}} <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" data-button-text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> {{end}} <label> {{svg "octicon-git-pull-request"}} - {{if .CanCreatePullRequest}} + {{if .CommitFormOptions.CanCreatePullRequest}} {{ctx.Locale.Tr "repo.editor.create_new_branch"}} {{else}} {{ctx.Locale.Tr "repo.editor.create_new_branch_np"}} @@ -58,7 +58,7 @@ </div> </div> <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}tw-hidden{{end}}"> - <div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}"> + <div class="new-branch-name-input field"> {{svg "octicon-git-branch"}} <input type="text" name="new_branch_name" maxlength="100" value="{{.new_branch_name}}" class="input-contrast tw-mr-1 js-quick-pull-new-branch-name" placeholder="{{ctx.Locale.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}} title="{{ctx.Locale.Tr "repo.editor.new_branch_name"}}"> <span class="text-muted js-quick-pull-normalization-info"></span> @@ -66,7 +66,18 @@ </div> {{end}} </div> + {{if and .CommitCandidateEmails (gt (len .CommitCandidateEmails) 1)}} + <div class="field"> + <label>{{ctx.Locale.Tr "repo.editor.commit_email"}}</label> + <select class="ui selection dropdown" name="commit_email"> + {{- range $email := .CommitCandidateEmails -}} + <option {{if eq $email $.CommitDefaultEmail}}selected{{end}} value="{{$email}}">{{$email}}</option> + {{- end -}} + </select> + </div> + {{end}} </div> + <input type="hidden" name="last_commit" value="{{.last_commit}}"> <button id="commit-button" type="submit" class="ui primary button"> {{if eq .commit_choice "commit-to-new-branch"}}{{ctx.Locale.Tr "repo.editor.propose_file_change"}}{{else}}{{ctx.Locale.Tr "repo.editor.commit_changes"}}{{end}} </button> diff --git a/templates/repo/editor/common_breadcrumb.tmpl b/templates/repo/editor/common_breadcrumb.tmpl new file mode 100644 index 0000000000..8cfbe09d3e --- /dev/null +++ b/templates/repo/editor/common_breadcrumb.tmpl @@ -0,0 +1,16 @@ +<div class="breadcrumb"> + <a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a> + {{$n := len .TreeNames}} + {{$l := Eval $n "-" 1}} + {{range $i, $v := .TreeNames}} + <div class="breadcrumb-divider">/</div> + {{if eq $i $l}} + <input id="file-name" maxlength="255" value="{{$v}}" placeholder="{{ctx.Locale.Tr (Iif $.PageIsUpload "repo.editor.add_subdir" "repo.editor.name_your_file")}}" data-editorconfig="{{$.EditorconfigJson}}" {{Iif $.PageIsUpload "" "required"}} autofocus> + <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span> + {{else}} + <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span> + {{end}} + {{end}} + <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{or .ReturnURI (print $.BranchLink "/" (PathEscapeSegments .TreePath))}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> + <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}"> +</div> diff --git a/templates/repo/editor/common_top.tmpl b/templates/repo/editor/common_top.tmpl new file mode 100644 index 0000000000..23280ed565 --- /dev/null +++ b/templates/repo/editor/common_top.tmpl @@ -0,0 +1,6 @@ +{{if .CommitFormOptions.WillSubmitToFork}} +<div class="ui blue message"> + {{$repoLinkHTML := HTMLFormat `<a href="%s">%s</a>` .CommitFormOptions.TargetRepo.Link .CommitFormOptions.TargetRepo.FullName}} + {{ctx.Locale.Tr "repo.editor.fork_edit_description" $repoLinkHTML}} +</div> +{{end}} diff --git a/templates/repo/editor/delete.tmpl b/templates/repo/editor/delete.tmpl index 2c0c2fc792..bf6143f1cb 100644 --- a/templates/repo/editor/delete.tmpl +++ b/templates/repo/editor/delete.tmpl @@ -3,9 +3,9 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui form" method="post"> + <form class="ui form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"> {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> + {{template "repo/editor/common_top" .}} {{template "repo/editor/commit_form" .}} </form> </div> diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index 204a426970..0911d02e1f 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -3,56 +3,49 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui edit form" method="post" + <form class="ui edit form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}" data-text-empty-confirm-header="{{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}" data-text-empty-confirm-content="{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}" > {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> - <input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}"> + {{template "repo/editor/common_top" .}} <div class="repo-editor-header"> - <div class="ui breadcrumb field{{if .Err_TreePath}} error{{end}}"> - <a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a> - {{$n := len .TreeNames}} - {{$l := Eval $n "-" 1}} - {{range $i, $v := .TreeNames}} - <div class="breadcrumb-divider">/</div> - {{if eq $i $l}} - <input id="file-name" maxlength="255" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus> - <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span> - {{else}} - <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span> - {{end}} - {{end}} - <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{if .ReturnURI}}{{.ReturnURI}}{{else}}{{$.BranchLink}}{{if not .IsNewFile}}/{{PathEscapeSegments .TreePath}}{{end}}{{end}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> - <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required> - </div> + {{template "repo/editor/common_breadcrumb" .}} </div> - <div class="field"> - <div class="ui top attached header"> - <div class="ui compact small menu small-menu-items repo-editor-menu"> - <a class="active item" data-tab="write">{{svg "octicon-code"}} {{if .IsNewFile}}{{ctx.Locale.Tr "repo.editor.new_file"}}{{else}}{{ctx.Locale.Tr "repo.editor.edit_file"}}{{end}}</a> - <a class="item" data-tab="preview" data-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.BranchNameSubURL}}">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a> - {{if not .IsNewFile}} - <a class="item" data-tab="diff" hx-params="context,content" hx-vals='{"context":"{{.BranchLink}}"}' hx-include="#edit_area" hx-swap="innerHTML" hx-target=".tab[data-tab='diff']" hx-indicator=".tab[data-tab='diff']" hx-post="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">{{svg "octicon-diff"}} {{ctx.Locale.Tr "repo.editor.preview_changes"}}</a> - {{end}} - </div> - </div> - <div class="ui bottom attached segment tw-p-0"> - <div class="ui active tab tw-rounded-b" data-tab="write"> - <textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}" - data-previewable-extensions="{{.PreviewableExtensions}}" - data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea> - <div class="editor-loading is-loading"></div> + {{if not .NotEditableReason}} + <div class="field"> + <div class="ui top attached header"> + <div class="ui compact small menu small-menu-items repo-editor-menu"> + <a class="active item" data-tab="write">{{svg "octicon-code"}} {{if .IsNewFile}}{{ctx.Locale.Tr "repo.editor.new_file"}}{{else}}{{ctx.Locale.Tr "repo.editor.edit_file"}}{{end}}</a> + <a class="item" data-tab="preview" data-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a> + {{if not .IsNewFile}} + <a class="item" data-tab="diff" hx-params="context,content" hx-vals='{"context":"{{.BranchLink}}"}' hx-include="#edit_area" hx-swap="innerHTML" hx-target=".tab[data-tab='diff']" hx-indicator=".tab[data-tab='diff']" hx-post="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">{{svg "octicon-diff"}} {{ctx.Locale.Tr "repo.editor.preview_changes"}}</a> + {{end}} + </div> </div> - <div class="ui tab markup tw-px-4 tw-py-3" data-tab="preview"> - {{ctx.Locale.Tr "loading"}} + <div class="ui bottom attached segment tw-p-0"> + <div class="ui active tab tw-rounded-b" data-tab="write"> + <textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}" + data-previewable-extensions="{{.PreviewableExtensions}}" + data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea> + <div class="editor-loading is-loading"></div> + </div> + <div class="ui tab tw-px-4 tw-py-3" data-tab="preview"> + {{ctx.Locale.Tr "loading"}} + </div> + <div class="ui tab" data-tab="diff"> + <div class="tw-p-16"></div> + </div> </div> - <div class="ui tab diff edit-diff" data-tab="diff"> - <div class="tw-p-16"></div> + </div> + {{else}} + <div class="field"> + <div class="ui segment tw-text-center"> + <h4 class="tw-font-semibold tw-mb-2">{{.NotEditableReason}}</h4> + <p>{{ctx.Locale.Tr "repo.editor.file_not_editable_hint"}}</p> </div> </div> - </div> + {{end}} {{template "repo/editor/commit_form" .}} </form> </div> diff --git a/templates/repo/editor/fork.tmpl b/templates/repo/editor/fork.tmpl new file mode 100644 index 0000000000..e28b2ba7a2 --- /dev/null +++ b/templates/repo/editor/fork.tmpl @@ -0,0 +1,18 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <form class="ui form form-fetch-action" method="post" action="{{.RepoLink}}/_fork/{{.BranchName | PathEscapeSegments}}"> + {{.CsrfTokenHtml}} + <div class="tw-text-center"> + <div class="tw-my-[40px]"> + <h3>{{ctx.Locale.Tr "repo.editor.fork_create"}}</h3> + <p>{{ctx.Locale.Tr "repo.editor.fork_create_description"}}</p> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.fork_repo"}}</button> + </div> + </form> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/editor/patch.tmpl b/templates/repo/editor/patch.tmpl index 33a7c2a89d..fa00edd92e 100644 --- a/templates/repo/editor/patch.tmpl +++ b/templates/repo/editor/patch.tmpl @@ -3,15 +3,14 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui edit form" method="post" action="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}" + <form class="ui edit form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}" data-text-empty-confirm-header="{{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}" data-text-empty-confirm-content="{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}" > {{.CsrfTokenHtml}} - <input type="hidden" name="last_commit" value="{{.last_commit}}"> - <input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}"> + {{template "repo/editor/common_top" .}} <div class="repo-editor-header"> - <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> + <div class="breadcrumb"> {{ctx.Locale.Tr "repo.editor.patching"}} <a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a> <div class="breadcrumb-divider">:</div> diff --git a/templates/repo/editor/upload.tmpl b/templates/repo/editor/upload.tmpl index 5725020406..3e36c77b3b 100644 --- a/templates/repo/editor/upload.tmpl +++ b/templates/repo/editor/upload.tmpl @@ -3,25 +3,11 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <form class="ui comment form" method="post"> + <form class="ui comment form form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"> {{.CsrfTokenHtml}} + {{template "repo/editor/common_top" .}} <div class="repo-editor-header"> - <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> - <a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a> - {{$n := len .TreeNames}} - {{$l := Eval $n "-" 1}} - {{range $i, $v := .TreeNames}} - <div class="breadcrumb-divider">/</div> - {{if eq $i $l}} - <input type="text" id="file-name" maxlength="255" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.add_subdir"}}" autofocus> - <span data-tooltip-content="{{ctx.Locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span> - {{else}} - <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span> - {{end}} - {{end}} - <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}{{if not .IsNewFile}}/{{.TreePath | PathEscapeSegments}}{{end}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> - <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required> - </div> + {{template "repo/editor/common_breadcrumb" .}} </div> <div class="field"> {{template "repo/upload" .}} diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index 7170fe3602..32b5c8401b 100644 --- a/templates/repo/empty.tmpl +++ b/templates/repo/empty.tmpl @@ -14,14 +14,13 @@ {{end}} </div> {{end}} + {{if .Repository.IsBroken}} - <div class="ui segment center"> - {{ctx.Locale.Tr "repo.broken_message"}} - </div> + <div class="ui segment center">{{ctx.Locale.Tr "repo.broken_message"}}</div> + {{else if .RepoHasContentsWithoutBranch}} + <div class="ui segment center">{{ctx.Locale.Tr "repo.no_branch"}}</div> {{else if .CanWriteCode}} - <h4 class="ui top attached header"> - {{ctx.Locale.Tr "repo.quick_guide"}} - </h4> + <h4 class="ui top attached header">{{ctx.Locale.Tr "repo.quick_guide"}}</h4> <div class="ui attached guide table segment empty-repo-guide"> <div class="item"> <h3>{{ctx.Locale.Tr "repo.clone_this_repo"}} <small>{{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository"}}</small></h3> @@ -48,7 +47,7 @@ <h3>{{ctx.Locale.Tr "repo.create_new_repo_command"}}</h3> <div class="markup"> <pre><code>touch README.md -git init +git init{{if ne .Repository.ObjectFormatName "sha1"}} --object-format={{.Repository.ObjectFormatName}}{{end}}{{/* for sha256 repo, it needs to set "object-format" explicitly*/}} {{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}} git add README.md git commit -m "first commit" @@ -66,12 +65,10 @@ git push -u origin {{.Repository.DefaultBranch}}</code></pre> </div> </div> {{end}} - {{else}} - <div class="ui segment center"> - {{ctx.Locale.Tr "repo.empty_message"}} - </div> - {{end}} - </div> + </div> + {{else}} + <div class="ui segment center">{{ctx.Locale.Tr "repo.empty_message"}}</div> + {{end}} </div> </div> </div> diff --git a/templates/repo/file_info.tmpl b/templates/repo/file_info.tmpl index b63af68973..38133bde2b 100644 --- a/templates/repo/file_info.tmpl +++ b/templates/repo/file_info.tmpl @@ -11,7 +11,7 @@ {{end}} {{if ne .FileSize nil}} <div class="file-info-entry"> - {{FileSize .FileSize}}{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} + {{FileSize .FileSize}}{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}} </div> {{end}} {{if .LFSLock}} diff --git a/templates/repo/forks.tmpl b/templates/repo/forks.tmpl index 725b67c651..6e46457893 100644 --- a/templates/repo/forks.tmpl +++ b/templates/repo/forks.tmpl @@ -1,20 +1,12 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository forks"> {{template "repo/header" .}} - <div class="ui container"> + <div class="ui container fork-list"> <h2 class="ui dividing header"> {{ctx.Locale.Tr "repo.forks"}} </h2> - <div class="flex-list"> - {{range .Forks}} - <div class="flex-item tw-border-0 repo-fork-item"> - <span>{{ctx.AvatarUtils.Avatar .Owner}}</span> - <span><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="{{.Link}}">{{.Name}}</a></span> - </div> - {{end}} - </div> + {{template "shared/repo/list" .}} + {{template "base/paginate" .}} </div> - - {{template "base/paginate" .}} </div> {{template "base/footer" .}} diff --git a/templates/repo/graph.tmpl b/templates/repo/graph.tmpl index 9eb4bd4ecb..cd115f95dc 100644 --- a/templates/repo/graph.tmpl +++ b/templates/repo/graph.tmpl @@ -2,7 +2,7 @@ <div role="main" aria-label="{{.Title}}" class="page-content repository commits"> {{template "repo/header" .}} <div class="ui container"> - <div id="git-graph-container" class="ui segment{{if eq .Mode "monochrome"}} monochrome{{end}}"> + <div id="git-graph-container" class="ui segment {{if eq .Mode "monochrome"}}monochrome{{end}}"> <h2 class="ui header dividing"> {{ctx.Locale.Tr "repo.commit_graph"}} <div class="ui icon buttons tiny color-buttons"> @@ -11,52 +11,45 @@ <div class="default text">{{ctx.Locale.Tr "repo.commit_graph.select"}}</div> <div class="menu"> <div class="item" data-value="...flow-hide-pr-refs"> - <span class="truncate"> - {{svg "octicon-eye-closed" 16 "tw-mr-1"}}<span title="{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}">{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}</span> - </span> + {{svg "octicon-eye-closed"}} + <span class="gt-ellipsis" title="{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}">{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}</span> </div> {{range .AllRefs}} {{$refGroup := .RefGroup}} {{if eq $refGroup "pull"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-git-pull-request" 16 "tw-mr-1"}}<span title="{{.ShortName}}">#{{.ShortName}}</span> - </span> + {{svg "octicon-git-pull-request"}} + <span class="gt-ellipsis" title="{{.ShortName}}">#{{.ShortName}}</span> </div> {{else if eq $refGroup "tags"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-tag" 16 "tw-mr-1"}}<span title="{{.ShortName}}">{{.ShortName}}</span> - </span> + {{svg "octicon-tag"}} + <span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> </div> {{else if eq $refGroup "remotes"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-cross-reference" 16 "tw-mr-1"}}<span title="{{.ShortName}}">{{.ShortName}}</span> - </span> + {{svg "octicon-cross-reference"}} + <span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> </div> {{else if eq $refGroup "heads"}} <div class="item" data-value="{{.Name}}"> - <span class="truncate"> - {{svg "octicon-git-branch" 16 "tw-mr-1"}}<span title="{{.ShortName}}">{{.ShortName}}</span> - </span> + {{svg "octicon-git-branch"}} + <span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> </div> {{end}} {{end}} </div> </div> - <button id="flow-color-monochrome" class="ui labelled icon button{{if eq .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}">{{svg "material-invert-colors" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}</button> - <button id="flow-color-colored" class="ui labelled icon button{{if ne .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.color"}}">{{svg "material-palette" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.color"}}</button> + <button id="flow-color-monochrome" class="ui icon button{{if eq .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}">{{svg "material-invert-colors" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.monochrome"}}</button> + <button id="flow-color-colored" class="ui icon button{{if ne .Mode "monochrome"}} active{{end}}" title="{{ctx.Locale.Tr "repo.commit_graph.color"}}">{{svg "material-palette" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.commit_graph.color"}}</button> </div> </h2> - <div class="ui dividing"></div> - <div class="is-loading tw-py-32 tw-hidden" id="loading-indicator"></div> - {{template "repo/graph/svgcontainer" .}} - {{template "repo/graph/commits" .}} + <div id="git-graph-body"> + {{template "repo/graph/svgcontainer" .}} + {{template "repo/graph/commits" .}} + {{template "base/paginate" .}} + </div> </div> </div> </div> -<div id="pagination"> - {{template "base/paginate" .}} -</div> {{template "base/footer" .}} diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl index 6af0ba1f0f..07ec076697 100644 --- a/templates/repo/graph/commits.tmpl +++ b/templates/repo/graph/commits.tmpl @@ -5,10 +5,13 @@ {{if $commit.OnlyRelation}} <span></span> {{else}} - {{template "repo/commit_sign_badge" dict "Commit" $commit.Commit "CommitBaseLink" (print $.RepoLink "/commit") "CommitSignVerification" $commit.Verification}} + {{/* every field must be in a span to get correctly styled */}} + <span> + {{template "repo/commit_sign_badge" dict "Commit" $commit.Commit "CommitBaseLink" (print $.RepoLink "/commit") "CommitSignVerification" $commit.Verification}} + </span> <span class="message tw-inline-block gt-ellipsis"> - <span>{{ctx.RenderUtils.RenderCommitMessage $commit.Subject ($.Repository.ComposeMetas ctx)}}</span> + {{ctx.RenderUtils.RenderCommitMessage $commit.Subject $.Repository}} </span> <span class="commit-refs flex-text-inline"> @@ -17,18 +20,18 @@ {{if eq $refGroup "pull"}} {{if or (not $.HidePRRefs) (SliceUtils.Contains $.SelectedBranches .Name)}} <!-- it's intended to use issues not pulls, if it's a pull you will get redirected --> - <a class="ui labelled basic tiny button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}"> + <a class="ui basic tiny button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}"> {{svg "octicon-git-pull-request"}} #{{.ShortName}} </a> {{end}} {{else if eq $refGroup "tags"}} - {{- template "repo/tag/name" dict "RepoLink" $.Repository.Link "TagName" .ShortName -}} + {{- template "repo/tag/name" dict "AdditionalClasses" "tag-label" "RepoLink" $.Repository.Link "TagName" .ShortName -}} {{else if eq $refGroup "remotes"}} - <a class="ui labelled basic tiny button" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}"> + <a class="ui basic tiny button" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}"> {{svg "octicon-cross-reference"}} {{.ShortName}} </a> {{else if eq $refGroup "heads"}} - <a class="ui labelled basic tiny button" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}"> + <a class="ui basic tiny button" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}"> {{svg "octicon-git-branch"}} {{.ShortName}} </a> {{else}} diff --git a/templates/repo/graph/div.tmpl b/templates/repo/graph/div.tmpl index c0bd4e269a..12c2869cd8 100644 --- a/templates/repo/graph/div.tmpl +++ b/templates/repo/graph/div.tmpl @@ -1,7 +1,3 @@ -<div> - {{template "repo/graph/svgcontainer" .}} - {{template "repo/graph/commits" .}} - <div id="pagination"> - {{template "base/paginate" .}} - </div> -</div> +{{template "repo/graph/svgcontainer" .}} +{{template "repo/graph/commits" .}} +{{template "base/paginate" .}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index c3ae697f31..b61076ff46 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -25,6 +25,9 @@ <div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.internal"}}">{{svg "octicon-shield-lock" 18}}</div> {{end}} {{end}} + {{if $.Permission.HasAnyUnitPublicAccess}} + <span class="ui basic orange label">{{ctx.Locale.Tr "repo.desc.public_access"}}</span> + {{end}} {{if .IsTemplate}} <span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.template"}}</span> <div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.template"}}">{{svg "octicon-repo-template" 18}}</div> @@ -35,20 +38,20 @@ </div> </div> {{if not (or .IsBeingCreated .IsBroken)}} - <div class="repo-buttons"> + <div class="flex-text-block tw-flex-wrap"> {{if $.RepoTransfer}} <form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}"> {{$.CsrfTokenHtml}} - <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{ctx.Locale.Tr "repo.transfer.accept_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_accept"}}{{end}}"> - <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}primary {{end}} ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}> + <div class="flex-text-inline" data-tooltip-content="{{if $.CanUserAcceptOrRejectTransfer}}{{ctx.Locale.Tr "repo.transfer.accept_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_accept"}}{{end}}"> + <button type="submit" class="ui compact small basic button {{if $.CanUserAcceptOrRejectTransfer}}primary {{end}} ok small"{{if not $.CanUserAcceptOrRejectTransfer}} disabled{{end}}> {{ctx.Locale.Tr "repo.transfer.accept"}} </button> </div> </form> <form method="post" action="{{$.RepoLink}}/action/reject_transfer?redirect_to={{$.RepoLink}}"> {{$.CsrfTokenHtml}} - <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{ctx.Locale.Tr "repo.transfer.reject_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_reject"}}{{end}}"> - <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}> + <div class="flex-text-inline" data-tooltip-content="{{if $.CanUserAcceptOrRejectTransfer}}{{ctx.Locale.Tr "repo.transfer.reject_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{ctx.Locale.Tr "repo.transfer.no_permission_to_reject"}}{{end}}"> + <button type="submit" class="ui compact small basic button {{if $.CanUserAcceptOrRejectTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptOrRejectTransfer}} disabled{{end}}> {{ctx.Locale.Tr "repo.transfer.reject"}} </button> </div> @@ -133,7 +136,7 @@ {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}} <div class="overflow-menu-items"> {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}} - <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}"> + <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.RefTypeNameSubURL}}{{end}}"> {{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}} </a> {{end}} @@ -162,7 +165,7 @@ </a> {{end}} - {{if and .EnableActions (.Permission.CanRead ctx.Consts.RepoUnitTypeActions)}} + {{if and .EnableActions (.Permission.CanRead ctx.Consts.RepoUnitTypeActions) (not .IsEmptyRepo)}} <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions"> {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}} {{if .Repository.NumOpenActionRuns}} @@ -208,7 +211,7 @@ </a> {{end}} - {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} + {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity"> {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}} </a> @@ -223,11 +226,19 @@ </a> {{end}} </div> - {{else if .Permission.IsAdmin}} + {{else}} <div class="overflow-menu-items"> + {{if(and .Repository.IsBeingCreated (.Permission.CanRead ctx.Consts.RepoUnitTypeCode))}} + <a class="{{if not .PageIsRepoSettings}}active {{end}}item" href="{{.RepoLink}}"> + {{svg "octicon-clock"}} {{ctx.Locale.Tr "repo.migration_status"}} + </a> + {{end}} + + {{if .Permission.IsAdmin}} <a class="{{if .PageIsRepoSettings}}active {{end}} item" href="{{.RepoLink}}/settings"> {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} </a> + {{end}} </div> {{end}} </overflow-menu> diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index d73b7470bc..f86b90502d 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -1,7 +1,8 @@ {{template "base/head" .}} +{{$showSidebar := and (not .TreeNames) (not .HideRepoInfo) (not .IsBlame)}} <div role="main" aria-label="{{.Title}}" class="page-content repository file list {{if .IsBlame}}blame{{end}}"> {{template "repo/header" .}} - <div class="ui container {{if .IsBlame}}fluid padded{{end}}"> + <div class="ui container {{if or .TreeNames .IsBlame}}fluid padded{{end}}"> {{template "base/alert" .}} {{if .Repository.IsArchived}} @@ -16,117 +17,9 @@ {{template "repo/code/recently_pushed_new_branches" .}} - {{$treeNamesLen := len .TreeNames}} - {{$isTreePathRoot := eq $treeNamesLen 0}} - {{$showSidebar := and $isTreePathRoot (not .HideRepoInfo) (not .IsBlame)}} <div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" "repo-grid-filelist-only"}}"> <div class="repo-home-filelist"> - {{template "repo/sub_menu" .}} - <div class="repo-button-row"> - <div class="repo-button-row-left"> - {{$branchDropdownCurrentRefType := "branch"}} - {{$branchDropdownCurrentRefShortName := .BranchName}} - {{if .IsViewTag}} - {{$branchDropdownCurrentRefType = "tag"}} - {{$branchDropdownCurrentRefShortName = .TagName}} - {{end}} - {{template "repo/branch_dropdown" dict - "Repository" .Repository - "ShowTabBranches" true - "ShowTabTags" true - "CurrentRefType" $branchDropdownCurrentRefType - "CurrentRefShortName" $branchDropdownCurrentRefShortName - "CurrentTreePath" .TreePath - "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" - "AllowCreateNewRef" .CanCreateBranch - "ShowViewAllRefsEntry" true - }} - {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} - {{$cmpBranch := ""}} - {{if ne .Repository.ID .BaseRepo.ID}} - {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} - {{end}} - {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} - {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}} - <a id="new-pull-request" role="button" class="ui compact basic button" href="{{$compareLink}}" - data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}"> - {{svg "octicon-git-pull-request"}} - </a> - {{end}} - - <!-- Show go to file if on home page --> - {{if $isTreePathRoot}} - <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a> - {{end}} - - {{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}} - <button class="ui dropdown basic compact jump button"{{if not .Repository.CanEnableEditor}} disabled{{end}}> - {{ctx.Locale.Tr "repo.editor.add_file"}} - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> - {{ctx.Locale.Tr "repo.editor.new_file"}} - </a> - {{if .RepositoryUploadEnabled}} - <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> - {{ctx.Locale.Tr "repo.editor.upload_file"}} - </a> - {{end}} - <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> - {{ctx.Locale.Tr "repo.editor.patch"}} - </a> - </div> - </button> - {{end}} - - {{if and $isTreePathRoot .Repository.IsTemplate}} - <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}"> - {{ctx.Locale.Tr "repo.use_template"}} - </a> - {{end}} - - {{if not $isTreePathRoot}} - {{$treeNameIdxLast := Eval $treeNamesLen "-" 1}} - <span class="breadcrumb repo-path tw-ml-1"> - <a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a> - {{- range $i, $v := .TreeNames -}} - <span class="breadcrumb-divider">/</span> - {{- if eq $i $treeNameIdxLast -}} - <span class="active section" title="{{$v}}">{{$v}}</span> - <button class="btn interact-fg tw-mx-1" data-clipboard-text="{{$.TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> - {{- else -}} - {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{$v}}</a></span> - {{- end -}} - {{- end -}} - </span> - {{end}} - </div> - - <div class="repo-button-row-right"> - <!-- Only show clone panel in repository home page --> - {{if $isTreePathRoot}} - {{template "repo/clone_panel" .}} - {{end}} - {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} - <a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> - {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} - </a> - {{end}} - </div> - </div> - {{if .IsViewFile}} - {{template "repo/view_file" .}} - {{else if .IsBlame}} - {{template "repo/blame" .}} - {{else}}{{/* IsViewDirectory */}} - {{if $isTreePathRoot}} - {{template "repo/code/upstream_diverging_info" .}} - {{end}} - {{template "repo/view_list" .}} - {{if and .ReadmeExist (or .IsMarkup .IsPlainText)}} - {{template "repo/view_file" .}} - {{end}} - {{end}} + {{template "repo/view_content" .}} </div> {{if $showSidebar}} diff --git a/templates/repo/home_sidebar_bottom.tmpl b/templates/repo/home_sidebar_bottom.tmpl index f780dc122d..01e630ccbf 100644 --- a/templates/repo/home_sidebar_bottom.tmpl +++ b/templates/repo/home_sidebar_bottom.tmpl @@ -4,14 +4,14 @@ <div class="flex-item"> <div class="flex-item-main"> <div class="flex-item-title"> - <a class="item muted" href="{{.Link}}/releases"> + <a class="item muted" href="{{.RepoLink}}/releases"> {{ctx.Locale.Tr "repo.releases"}} <span class="ui small label">{{.NumReleases}}</span> </a> </div> <div class="flex-item"> - <div class="flex-item-icon"> - {{svg "octicon-tag" 16}} + <div class="flex-item-leading"> + <div class="tw-mt-1">{{svg "octicon-tag" 16}}</div> </div> <div class="flex-item-main"> <div class="flex-item-header"> diff --git a/templates/repo/home_sidebar_top.tmpl b/templates/repo/home_sidebar_top.tmpl index 607dc62e2e..8c2089c839 100644 --- a/templates/repo/home_sidebar_top.tmpl +++ b/templates/repo/home_sidebar_top.tmpl @@ -1,5 +1,5 @@ <div class="repo-home-sidebar-top"> - <form class="ignore-dirty tw-flex tw-flex-1 tw-mt-1" action="{{.RepoLink}}/search" method="get"> + <form class="ignore-dirty tw-flex tw-flex-1" action="{{.RepoLink}}/search" method="get"> <div class="ui small action input tw-flex-1"> <input name="q" size="10" placeholder="{{ctx.Locale.Tr "search.code_kind"}}"> {{template "shared/search/button"}} </div> @@ -45,7 +45,7 @@ {{end}} {{if .ReadmeExist}} - <a class="flex-text-block muted" href="{{.TreeLink}}/{{.FileName}}"> + <a class="flex-text-block muted" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}/{{PathEscapeSegments .FileTreePath}}"> {{svg "octicon-book"}} {{ctx.Locale.Tr "readme"}} </a> {{end}} @@ -62,6 +62,11 @@ {{svg "octicon-cross-reference"}} {{ctx.Locale.Tr "repo.cite_this_repo"}} </a> {{end}} + <span class="flex-text-block muted" {{if not (eq .Repository.Size 0)}}data-tooltip-placement="top" data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}> + {{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}} + {{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}} + {{svg "octicon-database"}} <b>{{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}} + </span> </div> </div> </div> diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index e5e0bd68e7..e4a904c46b 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -1,6 +1,6 @@ {{$avatarLink := (.RelAvatarLink ctx)}} {{if $avatarLink}} - <img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt="{{.FullName}}"> + <img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt aria-hidden="true"> {{else if $.IsMirror}} {{svg "octicon-mirror" 24}} {{else if $.IsFork}} diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl index 9183b7b46a..c8b67490ac 100644 --- a/templates/repo/issue/branch_selector_field.tmpl +++ b/templates/repo/issue/branch_selector_field.tmpl @@ -14,7 +14,7 @@ Still needs to figure out: */}} {{if and (not .Issue.IsPull) (not .PageIsComparePull)}} <input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}"> -<div class="ui dropdown select-branch branch-selector-dropdown ellipsis-items-nowrap {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" +<div class="ui dropdown select-branch branch-selector-dropdown ellipsis-text-items {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" data-no-results="{{ctx.Locale.Tr "no_results_found"}}" {{if and .Issue (or .IsIssueWriter .HasIssuesOrPullsWritePermission)}}data-url-update-issueref="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref"{{end}} > diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index 2e19e86d7a..6dae49c455 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -4,7 +4,7 @@ {{if $attachments}} <div class="card-attachment-images"> {{range $attachments}} - <img src="{{.DownloadURL}}" alt="{{.Name}}" /> + <img loading="lazy" src="{{.DownloadURL}}" alt="{{.Name}}" /> {{end}} </div> {{end}} @@ -16,7 +16,7 @@ </div> <a class="issue-card-title muted issue-title tw-break-anywhere" href="{{.Link}}">{{.Title | ctx.RenderUtils.RenderIssueSimpleTitle}}</a> {{if and $.isPinnedIssueCard $.Page.IsRepoAdmin}} - <a role="button" class="issue-card-unpin muted tw-flex tw-items-center" data-tooltip-content={{ctx.Locale.Tr "repo.issues.unpin_issue"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Page.Link}}/unpin/{{.Index}}"> + <a role="button" class="issue-card-unpin muted tw-flex tw-items-center" data-tooltip-content={{ctx.Locale.Tr "repo.issues.unpin"}} data-issue-id="{{.ID}}" data-unpin-url="{{$.Page.Link}}/unpin/{{.Index}}"> {{svg "octicon-x" 16}} </a> {{end}} @@ -45,7 +45,7 @@ {{if $.Page.LinkedPRs}} {{range index $.Page.LinkedPRs .ID}} <div class="meta tw-my-1"> - <a href="{{$.Issue.Repo.Link}}/pulls/{{.Index}}"> + <a href="{{.Repo.Link}}/pulls/{{.Index}}"> <span class="tw-m-0 text {{if .PullRequest.HasMerged}}purple{{else if .IsClosed}}red{{else}}green{{end}}">{{svg "octicon-git-merge" 16 "tw-mr-1 tw-align-middle"}}</span> <span class="tw-align-middle">{{.Title}} <span class="text light grey">#{{.Index}}</span></span> </a> @@ -63,16 +63,21 @@ {{if or .Labels .Assignees}} <div class="issue-card-bottom"> - <div class="labels-list"> - {{range .Labels}} - <a target="_blank" href="{{$.Issue.Repo.Link}}/issues?labels={{.ID}}">{{ctx.RenderUtils.RenderLabel .}}</a> + {{/* the labels container must always be present, to help the assignees list right-aligned */}} + <div class="issue-card-bottom-part labels-list"> + {{range $label := .Labels}} + {{$link := print $.Issue.Repo.Link "/issues"}} + {{$link = QueryBuild $link "labels" $label.ID}} + {{ctx.RenderUtils.RenderLabelWithLink $label $link}} {{end}} </div> - <div class="issue-card-assignees"> + {{if .Assignees}} + <div class="issue-card-bottom-part tw-justify-end"> {{range .Assignees}} - <a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{ctx.Locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28}}</a> + <a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{ctx.Locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 24}}</a> {{end}} </div> + {{end}} </div> {{end}} {{end}} diff --git a/templates/repo/issue/choose.tmpl b/templates/repo/issue/choose.tmpl index 38cf9e485f..e3314f4260 100644 --- a/templates/repo/issue/choose.tmpl +++ b/templates/repo/issue/choose.tmpl @@ -10,11 +10,11 @@ {{range .IssueTemplates}} <div class="ui attached segment"> <div class="ui two column grid"> - <div class="column left aligned"> + <div class="column"> <strong>{{.Name}}</strong> <br>{{.About}} </div> - <div class="column right aligned"> + <div class="column tw-text-right"> <a href="{{$.RepoLink}}/issues/new?template={{.FileName}}{{if $.milestone}}&milestone={{$.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui primary button">{{ctx.Locale.Tr "repo.issues.choose.get_started"}}</a> </div> </div> @@ -23,11 +23,11 @@ {{range .IssueConfig.ContactLinks}} <div class="ui attached segment"> <div class="ui two column grid"> - <div class="column left aligned"> + <div class="column"> <strong>{{.Name}}</strong> <br>{{.About}} </div> - <div class="column right aligned"> + <div class="column tw-text-right"> <a href="{{.URL}}" class="ui primary button">{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues.choose.open_external_link"}}</a> </div> </div> @@ -36,11 +36,11 @@ {{if .IssueConfig.BlankIssuesEnabled}} <div class="ui attached segment"> <div class="ui two column grid"> - <div class="column left aligned"> + <div class="column"> <strong>{{ctx.Locale.Tr "repo.issues.choose.blank"}}</strong> <br/>{{ctx.Locale.Tr "repo.issues.choose.blank_about"}} </div> - <div class="column right aligned"> + <div class="column tw-text-right"> <a href="{{.RepoLink}}/issues/new?{{if .milestone}}&milestone={{.milestone}}{{end}}{{if $.project}}&project={{$.project}}{{end}}" class="ui primary button">{{ctx.Locale.Tr "repo.issues.choose.get_started"}}</a> </div> </div> diff --git a/templates/repo/issue/fields/markdown.tmpl b/templates/repo/issue/fields/markdown.tmpl index da8f5e6bdf..dbf4b71ba8 100644 --- a/templates/repo/issue/fields/markdown.tmpl +++ b/templates/repo/issue/fields/markdown.tmpl @@ -1,3 +1,3 @@ <div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}}"> - <div class="markup">{{ctx.RenderUtils.MarkdownToHtml .item.Attributes.value}}</div> + <div class="render-content markup">{{ctx.RenderUtils.MarkdownToHtml .item.Attributes.value}}</div> </div> diff --git a/templates/repo/issue/filter_item_label.tmpl b/templates/repo/issue/filter_item_label.tmpl index 0883d93804..04c3605a6a 100644 --- a/templates/repo/issue/filter_item_label.tmpl +++ b/templates/repo/issue/filter_item_label.tmpl @@ -22,7 +22,7 @@ <span class="label-filter-exclude-info">{{ctx.Locale.Tr "repo.issues.filter_label_exclude"}}</span> <div class="divider"></div> <a class="item label-filter-query-default" href="{{QueryBuild $queryLink "labels" NIL}}">{{ctx.Locale.Tr "repo.issues.filter_label_no_select"}}</a> - <a class="item label-filter-query-not-set" href="{{QueryBuild $queryLink "labels" 0}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a> + <a class="item label-filter-query-not-set" href="{{QueryBuild $queryLink "labels" "0"}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a> {{/* The logic here is not the same as the label selector in the issue sidebar. The one in the issue sidebar renders "repo labels | divider | org labels". Maybe the logic should be updated to be consistent.*/}} diff --git a/templates/repo/issue/filter_item_user_assign.tmpl b/templates/repo/issue/filter_item_user_assign.tmpl index 4f1db71d57..42886edaa0 100644 --- a/templates/repo/issue/filter_item_user_assign.tmpl +++ b/templates/repo/issue/filter_item_user_assign.tmpl @@ -4,8 +4,8 @@ * UserSearchList * SelectedUserId: 0 or empty means default, -1 means "no user is set" * TextFilterTitle -* TextZeroValue: the text for "all issues" -* TextNegativeOne: the text for "issues with no assignee" +* TextFilterMatchNone: the text for "issues with no assignee" +* TextFilterMatchAny: the text for "issues with any assignee" */}} {{$queryLink := .QueryLink}} <div class="item ui dropdown jump {{if not .UserSearchList}}disabled{{end}}"> @@ -15,16 +15,24 @@ <i class="icon">{{svg "octicon-search" 16}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_user_placeholder"}}"> </div> - {{if $.TextZeroValue}} - <a class="item {{if not .SelectedUserId}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey NIL}}">{{$.TextZeroValue}}</a> + {{if $.TextFilterMatchNone}} + {{$isSelected := eq .SelectedUserId "(none)"}} + <a class="item" href="{{QueryBuild $queryLink $.QueryParamKey (Iif $isSelected NIL "(none)")}}"> + {{svg "octicon-check" 14 (Iif $isSelected "" "tw-invisible")}} {{$.TextFilterMatchNone}} + </a> {{end}} - {{if $.TextNegativeOne}} - <a class="item {{if eq .SelectedUserId -1}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey -1}}">{{$.TextNegativeOne}}</a> + {{if $.TextFilterMatchAny}} + {{$isSelected := eq .SelectedUserId "(any)"}} + <a class="item" href="{{QueryBuild $queryLink $.QueryParamKey (Iif $isSelected NIL "(any)")}}"> + {{svg "octicon-check" 14 (Iif $isSelected "" "tw-invisible")}} {{$.TextFilterMatchAny}} + </a> {{end}} <div class="divider"></div> - {{range .UserSearchList}} - <a class="item {{if eq $.SelectedUserId .ID}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey .ID}}"> - {{ctx.AvatarUtils.Avatar . 20}}{{template "repo/search_name" .}} + {{range $user := .UserSearchList}} + {{$isSelected := eq $.SelectedUserId (print $user.ID)}} + <a class="item" href="{{QueryBuild $queryLink $.QueryParamKey (Iif $isSelected NIL $user.ID)}}"> + {{svg "octicon-check" 14 (Iif $isSelected "" "tw-invisible")}} + {{ctx.AvatarUtils.Avatar $user 20}}{{template "repo/search_name" .}} </a> {{end}} </div> diff --git a/templates/repo/issue/filter_list.tmpl b/templates/repo/issue/filter_list.tmpl index 7612d93b21..bfdf94513e 100644 --- a/templates/repo/issue/filter_list.tmpl +++ b/templates/repo/issue/filter_list.tmpl @@ -15,7 +15,7 @@ <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_milestone"}}"> </div> <div class="divider"></div> - <a class="{{if not $.MilestoneID}}active selected {{end}}item" href="{{QueryBuild $queryLink "milestone" 0}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_all"}}</a> + <a class="{{if not $.MilestoneID}}active selected {{end}}item" href="{{QueryBuild $queryLink "milestone" NIL}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_all"}}</a> <a class="{{if $.MilestoneID}}{{if eq $.MilestoneID -1}}active selected {{end}}{{end}}item" href="{{QueryBuild $queryLink "milestone" -1}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_none"}}</a> {{if .OpenMilestones}} <div class="divider"></div> @@ -94,8 +94,8 @@ "UserSearchList" $.Assignees "SelectedUserId" $.AssigneeID "TextFilterTitle" (ctx.Locale.Tr "repo.issues.filter_assignee") - "TextZeroValue" (ctx.Locale.Tr "repo.issues.filter_assginee_no_select") - "TextNegativeOne" (ctx.Locale.Tr "repo.issues.filter_assginee_no_assignee") + "TextFilterMatchNone" (ctx.Locale.Tr "repo.issues.filter_assignee_no_assignee") + "TextFilterMatchAny" (ctx.Locale.Tr "repo.issues.filter_assignee_any_assignee") }} {{if .IsSigned}} @@ -106,7 +106,7 @@ </span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> - <a class="{{if eq .ViewType "all"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "all"}}">{{ctx.Locale.Tr "repo.issues.filter_type.all_issues"}}</a> + <a class="{{if eq .ViewType "all"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "all"}}">{{if .PageIsPullList}}{{ctx.Locale.Tr "repo.issues.filter_type.all_pull_requests"}}{{else}}{{ctx.Locale.Tr "repo.issues.filter_type.all_issues"}}{{end}}</a> <a class="{{if eq .ViewType "assigned"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "assigned"}}">{{ctx.Locale.Tr "repo.issues.filter_type.assigned_to_you"}}</a> <a class="{{if eq .ViewType "created_by"}}active {{end}}item" href="{{QueryBuild $queryLink "type" "created_by"}}">{{ctx.Locale.Tr "repo.issues.filter_type.created_by_you"}}</a> {{if .PageIsPullList}} @@ -133,5 +133,11 @@ <a class="{{if eq .SortType "leastcomment"}}active {{end}}item" href="{{QueryBuild $queryLink "sort" "leastcomment"}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastcomment"}}</a> <a class="{{if eq .SortType "nearduedate"}}active {{end}}item" href="{{QueryBuild $queryLink "sort" "nearduedate"}}">{{ctx.Locale.Tr "repo.issues.filter_sort.nearduedate"}}</a> <a class="{{if eq .SortType "farduedate"}}active {{end}}item" href="{{QueryBuild $queryLink "sort" "farduedate"}}">{{ctx.Locale.Tr "repo.issues.filter_sort.farduedate"}}</a> + <div class="divider"></div> + <div class="header">{{ctx.Locale.Tr "repo.issues.filter_label"}}</div> + {{range $scope := .ExclusiveLabelScopes}} + {{$sortType := (printf "scope-%s" $scope)}} + <a class="{{if eq $.SortType $sortType}}active {{end}}item" href="{{QueryBuild $queryLink "sort" $sortType}}">{{$scope}}</a> + {{end}} </div> </div> diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index 06e7c1aa6c..409ec876e6 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -9,7 +9,7 @@ <div class="ui compact tiny secondary menu"> <span class="item" data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> {{svg "octicon-clock"}} - {{.TotalTrackedTime | Sec2Time}} + {{.TotalTrackedTime | Sec2Hour}} </span> </div> {{end}} diff --git a/templates/repo/issue/label_precolors.tmpl b/templates/repo/issue/label_precolors.tmpl index 80007662c0..7be3f40350 100644 --- a/templates/repo/issue/label_precolors.tmpl +++ b/templates/repo/issue/label_precolors.tmpl @@ -1,22 +1,27 @@ <div class="precolors"> - <div class="tw-flex"> - <a class="color" style="background-color:#e11d21" data-color-hex="#e11d21"></a> - <a class="color" style="background-color:#eb6420" data-color-hex="#eb6420"></a> - <a class="color" style="background-color:#fbca04" data-color-hex="#fbca04"></a> - <a class="color" style="background-color:#009800" data-color-hex="#009800"></a> - <a class="color" style="background-color:#006b75" data-color-hex="#006b75"></a> - <a class="color" style="background-color:#207de5" data-color-hex="#207de5"></a> - <a class="color" style="background-color:#0052cc" data-color-hex="#0052cc"></a> - <a class="color" style="background-color:#5319e7" data-color-hex="#5319e7"></a> - </div> - <div class="tw-flex"> - <a class="color" style="background-color:#f6c6c7" data-color-hex="#f6c6c7"></a> - <a class="color" style="background-color:#fad8c7" data-color-hex="#fad8c7"></a> - <a class="color" style="background-color:#fef2c0" data-color-hex="#fef2c0"></a> - <a class="color" style="background-color:#bfe5bf" data-color-hex="#bfe5bf"></a> - <a class="color" style="background-color:#bfdadc" data-color-hex="#bfdadc"></a> - <a class="color" style="background-color:#c7def8" data-color-hex="#c7def8"></a> - <a class="color" style="background-color:#bfd4f2" data-color-hex="#bfd4f2"></a> - <a class="color" style="background-color:#d4c5f9" data-color-hex="#d4c5f9"></a> + <button type="button" class="ui button generate-random-color"> + {{svg "octicon-sync"}} + </button> + <div> + <div class="tw-flex"> + <a class="color" style="background-color:#e11d21" data-color-hex="#e11d21"></a> + <a class="color" style="background-color:#eb6420" data-color-hex="#eb6420"></a> + <a class="color" style="background-color:#fbca04" data-color-hex="#fbca04"></a> + <a class="color" style="background-color:#009800" data-color-hex="#009800"></a> + <a class="color" style="background-color:#006b75" data-color-hex="#006b75"></a> + <a class="color" style="background-color:#207de5" data-color-hex="#207de5"></a> + <a class="color" style="background-color:#0052cc" data-color-hex="#0052cc"></a> + <a class="color" style="background-color:#5319e7" data-color-hex="#5319e7"></a> + </div> + <div class="tw-flex"> + <a class="color" style="background-color:#f6c6c7" data-color-hex="#f6c6c7"></a> + <a class="color" style="background-color:#fad8c7" data-color-hex="#fad8c7"></a> + <a class="color" style="background-color:#fef2c0" data-color-hex="#fef2c0"></a> + <a class="color" style="background-color:#bfe5bf" data-color-hex="#bfe5bf"></a> + <a class="color" style="background-color:#bfdadc" data-color-hex="#bfdadc"></a> + <a class="color" style="background-color:#c7def8" data-color-hex="#c7def8"></a> + <a class="color" style="background-color:#bfd4f2" data-color-hex="#bfd4f2"></a> + <a class="color" style="background-color:#d4c5f9" data-color-hex="#d4c5f9"></a> + </div> </div> </div> diff --git a/templates/repo/issue/labels/label_edit_modal.tmpl b/templates/repo/issue/labels/label_edit_modal.tmpl index 527b7ff900..ec57de2f3f 100644 --- a/templates/repo/issue/labels/label_edit_modal.tmpl +++ b/templates/repo/issue/labels/label_edit_modal.tmpl @@ -5,7 +5,7 @@ > <div class="header"></div> <div class="content"> - <form class="ui form ignore-dirty" method="post"> + <form class="ui form ignore-dirty form-fetch-action" method="post"> {{.CsrfTokenHtml}} <input name="id" type="hidden"> <div class="required field"> @@ -24,7 +24,13 @@ <div class="desc tw-ml-1 tw-mt-2 tw-hidden label-exclusive-warning"> {{svg "octicon-alert"}} {{ctx.Locale.Tr "repo.issues.label_exclusive_warning"}} </div> - <br> + <div class="field label-exclusive-order-input-field tw-mt-2"> + <label class="flex-text-block"> + {{ctx.Locale.Tr "repo.issues.label_exclusive_order"}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.label_exclusive_order_tooltip"}}">{{svg "octicon-info"}}</span> + </label> + <input class="label-exclusive-order-input" name="exclusive_order" type="number" maxlength="4"> + </div> </div> <div class="field label-is-archived-input-field"> <div class="ui checkbox"> @@ -43,8 +49,9 @@ </div> <div class="field"> <label for="color">{{ctx.Locale.Tr "repo.issues.label_color"}}</label> - <div class="column js-color-picker-input"> - <input name="color" value="#70c24a"placeholder="#c320f6" required maxlength="7"> + <div class="color-picker-combo" data-global-init="initColorPicker"> + <!-- the "#" is optional because backend NormalizeColor is able to handle it, API also accepts both formats, and it is easier for users to directly copy-paste a hex value --> + <input name="color" value="#70c24a" placeholder="#c320f6" required pattern="^#?([\dA-Fa-f]{3}|[\dA-Fa-f]{6})$" maxlength="7"> {{template "repo/issue/label_precolors"}} </div> </div> diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl index 822567301e..c8a6b46cc4 100644 --- a/templates/repo/issue/labels/label_list.tmpl +++ b/templates/repo/issue/labels/label_list.tmpl @@ -26,7 +26,7 @@ <div class="divider"></div> {{end}} - <ul class="issue-label-list"> + <ul class="issue-label-list muted-links"> {{$canEditLabel := and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}} {{$canEditLabel = or $canEditLabel $.PageIsOrgSettingsLabels}} {{range .Labels}} @@ -42,34 +42,31 @@ <a class="open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> {{end}} </div> - <div class="label-operation tw-flex"> + <div class="label-operation"> {{template "repo/issue/labels/label_archived" .}} - <div class="tw-flex tw-ml-auto"> {{if $canEditLabel}} <a class="edit-label-button" href="#" data-label-id="{{.ID}}" data-label-name="{{.Name}}" data-label-color="{{.Color}}" data-label-exclusive="{{.Exclusive}}" data-label-is-archived="{{gt .ArchivedUnix 0}}" data-label-num-issues="{{.NumIssues}}" data-label-description="{{.Description}}" + data-label-exclusive-order="{{.ExclusiveOrder}}" >{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a> <a class="link-action" href="#" data-url="{{$.Link}}/delete?id={{.ID}}" data-modal-confirm-header="{{ctx.Locale.Tr "repo.issues.label_deletion"}}" data-modal-confirm-content="{{ctx.Locale.Tr "repo.issues.label_deletion_desc"}}" >{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a> {{end}} - </div> </div> </li> {{end}} {{if and (not .PageIsOrgSettingsLabels) (.OrgLabels)}} <li class="item"> - <div class="ui grid middle aligned"> - <div class="ten wide column"> - {{ctx.Locale.Tr "repo.org_labels_desc"}} - {{if .IsOrganizationOwner}} - <a href="{{.OrganizationLink}}/settings/labels">({{ctx.Locale.Tr "repo.org_labels_desc_manage"}})</a>: - {{end}} - </div> + <div>{{/* parent is flex, so use block here to keep sentence spaces */}} + {{ctx.Locale.Tr "repo.org_labels_desc"}} + {{if .IsOrganizationOwner}} + <a href="{{.OrganizationLink}}/settings/labels">({{ctx.Locale.Tr "repo.org_labels_desc_manage"}})</a>: + {{end}} </div> </li> diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 01b610b39d..0ab761e038 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -14,9 +14,10 @@ </div> {{end}} - <div class="list-header"> - {{template "repo/issue/navbar" .}} + <div class="list-header flex-text-block"> {{template "repo/issue/search" .}} + <a class="ui small button" href="{{.RepoLink}}/labels">{{ctx.Locale.Tr "repo.labels"}}</a> + <a class="ui small button" href="{{.RepoLink}}/milestones">{{ctx.Locale.Tr "repo.milestones"}}</a> {{if not .Repository.IsArchived}} {{if .PageIsIssueList}} <a class="ui small primary button issue-list-new" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}">{{ctx.Locale.Tr "repo.issues.new"}}</a> @@ -40,7 +41,7 @@ <div class="ui compact tiny secondary menu"> <span class="item" data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> {{svg "octicon-clock"}} - {{.TotalTrackedTime | Sec2Time}} + {{.TotalTrackedTime | Sec2Hour}} </span> </div> {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 4fc6057117..591820080f 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -3,10 +3,10 @@ {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <div class="tw-flex"> - <h1 class="tw-mb-2">{{.Milestone.Name}}</h1> + <div class="flex-text-block tw-flex-wrap tw-mb-2"> + <h1 class="tw-flex-1 tw-m-0">{{.Milestone.Name}}</h1> {{if not .Repository.IsArchived}} - <div class="text right tw-flex-1"> + <div> {{if or .CanWriteIssues .CanWritePulls}} {{if .Milestone.IsClosed}} <a class="ui primary basic button link-action" href data-url="{{$.RepoLink}}/milestones/{{.MilestoneID}}/open">{{ctx.Locale.Tr "repo.milestones.open"}} @@ -22,14 +22,14 @@ {{end}} </div> {{if .Milestone.RenderedContent}} - <div class="markup content tw-mb-4"> + <div class="render-content markup tw-mb-4"> {{.Milestone.RenderedContent}} </div> {{end}} <div class="tw-flex tw-flex-col tw-gap-2"> <progress class="milestone-progress-big" value="{{.Milestone.Completeness}}" max="100"></progress> - <div class="tw-flex tw-gap-4"> - <div classs="tw-flex tw-items-center"> + <div class="flex-text-block tw-gap-4"> + <div class="flex-text-inline"> {{$closedDate:= DateUtils.TimeSince .Milestone.ClosedDateUnix}} {{if .IsClosed}} {{svg "octicon-clock"}} {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} @@ -46,11 +46,11 @@ {{end}} {{end}} </div> - <div class="tw-mr-2">{{ctx.Locale.Tr "repo.milestones.completeness" .Milestone.Completeness}}</div> + <div>{{ctx.Locale.Tr "repo.milestones.completeness" .Milestone.Completeness}}</div> {{if .TotalTrackedTime}} <div data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> {{svg "octicon-clock"}} - {{.TotalTrackedTime | Sec2Time}} + {{.TotalTrackedTime | Sec2Hour}} </div> {{end}} </div> diff --git a/templates/repo/issue/milestone_new.tmpl b/templates/repo/issue/milestone_new.tmpl index 4809149a21..9bcced6f54 100644 --- a/templates/repo/issue/milestone_new.tmpl +++ b/templates/repo/issue/milestone_new.tmpl @@ -44,7 +44,7 @@ "TextareaPlaceholder" (ctx.Locale.Tr "repo.milestones.desc") )}} </div> - <div class="tw-text-right"> + <div class="flex-text-block tw-justify-end"> {{if .PageIsEditMilestone}} <a class="ui primary basic button" href="{{.RepoLink}}/milestones"> {{ctx.Locale.Tr "repo.milestones.cancel"}} diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl index 9515acfb8e..8805c709a0 100644 --- a/templates/repo/issue/milestones.tmpl +++ b/templates/repo/issue/milestones.tmpl @@ -41,7 +41,7 @@ {{if .TotalTrackedTime}} <div class="flex-text-block"> {{svg "octicon-clock"}} - {{.TotalTrackedTime|Sec2Time}} + {{.TotalTrackedTime|Sec2Hour}} </div> {{end}} {{if .UpdatedUnix}} @@ -76,14 +76,12 @@ {{else}} <a class="link-action flex-text-inline" href data-url="{{$.Link}}/{{.ID}}/close">{{svg "octicon-x" 14}}{{ctx.Locale.Tr "repo.milestones.close"}}</a> {{end}} - <a class="delete-button flex-text-inline" href="#" data-url="{{$.RepoLink}}/milestones/delete" data-id="{{.ID}}">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a> + <a class="link-action flex-text-inline text red" href data-modal-confirm="#repo-milestone-delete-modal" data-url="{{$.RepoLink}}/milestones/delete?id={{.ID}}">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a> </div> {{end}} </div> {{if .Content}} - <div class="markup content"> - {{.RenderedContent}} - </div> + <div class="render-content markup">{{.RenderedContent}}</div> {{end}} </li> {{end}} @@ -94,15 +92,11 @@ </div> {{if or .CanWriteIssues .CanWritePulls}} - <div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.milestones.deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.milestones.deletion_desc"}}</p> - </div> + <div class="ui small modal" id="repo-milestone-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.milestones.deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.milestones.deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> {{end}} + {{template "base/footer" .}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index dd4c7617ce..9413200870 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -1,6 +1,4 @@ -{{if .Flash}} {{template "base/alert" .}} -{{end}} <form class="issue-content ui comment form form-fetch-action" id="new-issue" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} <div class="issue-content-left"> @@ -9,7 +7,10 @@ {{ctx.AvatarUtils.Avatar .SignedUser 40}} <div class="ui segment content tw-my-0"> <div class="field"> - <input name="title" class="js-autofocus-end" id="issue_title" placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" required maxlength="255" autocomplete="off"> + <input name="title" data-global-init="initInputAutoFocusEnd" id="issue_title" required maxlength="255" autocomplete="off" + placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" + value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" + > {{if .PageIsComparePull}} <div class="title_wip_desc" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}">{{ctx.Locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0)}}</div> {{end}} @@ -32,7 +33,7 @@ {{else}} {{template "repo/issue/comment_tab" .}} {{end}} - <div class="text right"> + <div class="flex-text-block tw-justify-end"> <button class="ui primary button"> {{if .PageIsComparePull}} {{ctx.Locale.Tr "repo.pulls.create"}} diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl index b9dd04a7db..00a31b5fad 100644 --- a/templates/repo/issue/openclose.tmpl +++ b/templates/repo/issue/openclose.tmpl @@ -17,7 +17,7 @@ {{ctx.Locale.PrettyNumber .OpenCount}} {{ctx.Locale.Tr "repo.issues.open_title"}} </a> <a class="{{if eq .State "closed"}}active {{end}}item flex-text-inline" href="{{if eq .State "closed"}}{{$allStatesLink}}{{else}}{{$closedLink}}{{end}}"> - {{svg "octicon-check"}} + {{svg "octicon-issue-closed"}} {{ctx.Locale.PrettyNumber .ClosedCount}} {{ctx.Locale.Tr "repo.issues.closed_title"}} </a> </div> diff --git a/templates/repo/issue/search.tmpl b/templates/repo/issue/search.tmpl index 07732ab5e7..de6c194ee8 100644 --- a/templates/repo/issue/search.tmpl +++ b/templates/repo/issue/search.tmpl @@ -8,6 +8,7 @@ <input type="hidden" name="project" value="{{$.ProjectID}}"> <input type="hidden" name="assignee" value="{{$.AssigneeID}}"> <input type="hidden" name="poster" value="{{$.PosterUsername}}"> + <input type="hidden" name="sort" value="{{$.SortType}}"> {{end}} {{template "shared/search/input" dict "Value" .Keyword}} {{if .PageIsIssueList}} diff --git a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl index ad4ce96a47..f584f9076c 100644 --- a/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl +++ b/templates/repo/issue/sidebar/allow_maintainer_edit.tmpl @@ -1,13 +1,18 @@ -{{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}} - {{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}} +{{- $isHeadForkedRepo := and .Issue.PullRequest .Issue.PullRequest.HeadRepo (ne .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName) -}} +{{if $isHeadForkedRepo}} + {{- $isPullPoster := and .Issue.IsPull .IsIssuePoster -}} + {{- $isPullEditable := and .Issue.PullRequest (not .Issue.IsClosed) (not .Repository.IsArchived) -}} + {{- $allowToChange := and $isPullPoster $isPullEditable -}} <div class="divider"></div> - <div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers" + <div class="ui checkbox {{if not $allowToChange}}disabled{{end}} loading-icon-2px" + {{if $allowToChange}} + id="allow-edits-from-maintainers" data-url="{{.Issue.Link}}" data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}" data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}" + {{end}} > <label><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label> - <input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}}> + <input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}} {{if not $allowToChange}}disabled{{end}}> </div> - {{end}} {{end}} diff --git a/templates/repo/issue/sidebar/assignee_list.tmpl b/templates/repo/issue/sidebar/assignee_list.tmpl index d8ccd73387..1d2279a45d 100644 --- a/templates/repo/issue/sidebar/assignee_list.tmpl +++ b/templates/repo/issue/sidebar/assignee_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/assignee?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="assignee_ids" type="hidden" value="{{$data.SelectedAssigneeIDs}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -15,10 +15,11 @@ <i class="icon">{{svg "octicon-search" 16}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}"> </div> - <div class="item clear-selection">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div> - <div class="scrolling menu"> + <div class="scrolling menu flex-items-block"> + <div class="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div> + <div class="divider"></div> {{range $data.CandidateAssignees}} - <a class="item muted" href="#" data-value="{{.ID}}"> + <a class="item" href="#" data-value="{{.ID}}"> <span class="item-check-mark">{{svg "octicon-check"}}</span> {{ctx.AvatarUtils.Avatar . 20}} {{template "repo/search_name" .}} </a> @@ -26,10 +27,10 @@ </div> </div> </div> - <div class="ui list tw-flex tw-flex-row tw-gap-2"> + <div class="ui relaxed list muted-links flex-items-block"> <span class="item empty-list {{if $issueAssignees}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_assignees"}}</span> {{range $issueAssignees}} - <a class="item muted" href="{{$pageMeta.RepoLink}}/{{if $pageMeta.IsPullRequest}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> + <a class="item" href="{{$pageMeta.RepoLink}}/{{if $pageMeta.IsPullRequest}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> {{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}} </a> {{end}} diff --git a/templates/repo/issue/sidebar/issue_dependencies.tmpl b/templates/repo/issue/sidebar/issue_dependencies.tmpl index 837bcd5670..bbae011958 100644 --- a/templates/repo/issue/sidebar/issue_dependencies.tmpl +++ b/templates/repo/issue/sidebar/issue_dependencies.tmpl @@ -22,7 +22,7 @@ {{range .BlockingDependencies}} <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> - <a class="muted gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> + <a class="muted issue-dependency-title gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> #{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}} </a> <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> @@ -31,7 +31,9 @@ </div> <div class="item-right tw-flex tw-items-center tw-m-1"> {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm" + data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blocking" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> {{svg "octicon-trash" 16}} </a> {{end}} @@ -54,7 +56,7 @@ {{range .BlockedByDependencies}} <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> - <a class="muted gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> + <a class="muted issue-dependency-title gt-ellipsis" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> #{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}} </a> <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> @@ -63,7 +65,9 @@ </div> <div class="item-right tw-flex tw-items-center tw-m-1"> {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blockedBy" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm" + data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blockedBy" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> {{svg "octicon-trash" 16}} </a> {{end}} @@ -76,7 +80,7 @@ <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> <div class="gt-ellipsis"> <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.no_permission.can_remove"}}">{{svg "octicon-lock" 16}}</span> - <span class="gt-ellipsis" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> + <span class="gt-ellipsis issue-dependency-title" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}}"> #{{.Issue.Index}} {{.Issue.Title | ctx.RenderUtils.RenderEmoji}} </span> </div> @@ -86,7 +90,9 @@ </div> <div class="item-right tw-flex tw-items-center tw-m-1"> {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm" + data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blocking" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> {{svg "octicon-trash" 16}} </a> {{end}} @@ -106,7 +112,7 @@ <form method="post" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm"> {{$.CsrfTokenHtml}} <div class="ui fluid action input"> - <div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}"> + <div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}" data-issue-cross-repo-search="{{.AllowCrossRepositoryDependencies}}"> <input name="newDependency" type="hidden"> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <input type="text" class="search"> @@ -122,28 +128,19 @@ </div> {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} - <input type="hidden" id="crossRepoSearch" value="{{.AllowCrossRepositoryDependencies}}"> - - <div class="ui g-modal-confirm modal remove-dependency"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.issues.dependency.remove_header"}} - </div> + <form id="issue-remove-dependency-confirm" class="ui g-modal-confirm modal" method="post" action="{{.Issue.Link}}/dependency/delete"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.dependency.remove_header"}}</div> <div class="content"> - <form method="post" action="{{.Issue.Link}}/dependency/delete" id="removeDependencyForm"> - {{$.CsrfTokenHtml}} - <input type="hidden" value="" name="removeDependencyID" id="removeDependencyID"> - <input type="hidden" value="" name="dependencyType" id="dependencyType"> - </form> - <p>{{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.issues.dependency.pr_remove_text"}} - {{else}} - {{ctx.Locale.Tr "repo.issues.dependency.issue_remove_text"}} - {{end}}</p> + {{$.CsrfTokenHtml}} + <input type="hidden" value="" name="removeDependencyID" class="remove-dependency-id"> + <input type="hidden" value="" name="dependencyType" class="dependency-type"> + <p> + {{ctx.Locale.Tr (Iif .Issue.IsPull "repo.issues.dependency.pr_remove_text" "repo.issues.dependency.issue_remove_text")}} + </p> + {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}} + {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}} + {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}} </div> - {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}} - {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}} - {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}} - </div> + </form> {{end}} {{end}} diff --git a/templates/repo/issue/sidebar/issue_management.tmpl b/templates/repo/issue/sidebar/issue_management.tmpl index 76edf16e03..8876a5054e 100644 --- a/templates/repo/issue/sidebar/issue_management.tmpl +++ b/templates/repo/issue/sidebar/issue_management.tmpl @@ -1,6 +1,7 @@ {{if and .IsRepoAdmin (not .Repository.IsArchived)}} <div class="divider"></div> + {{/* Pin issue */}} {{if or .PinEnabled .Issue.IsPinned}} <form class="tw-mt-1 form-fetch-action single-button-form" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.max_pinned"}}"{{end}}> {{$.CsrfTokenHtml}} @@ -16,16 +17,15 @@ </form> {{end}} - <button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock"> + {{/* Lock/unlock conversation */}} + <button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock-conversation"> {{if .Issue.IsLocked}} - {{svg "octicon-key"}} - {{ctx.Locale.Tr "repo.issues.unlock"}} + {{svg "octicon-key"}} {{ctx.Locale.Tr "repo.issues.unlock"}} {{else}} - {{svg "octicon-lock"}} - {{ctx.Locale.Tr "repo.issues.lock"}} + {{svg "octicon-lock"}} {{ctx.Locale.Tr "repo.issues.lock"}} {{end}} </button> - <div class="ui tiny modal" id="lock"> + <div class="ui tiny modal" id="lock-conversation"> <div class="header"> {{if .Issue.IsLocked}} {{ctx.Locale.Tr "repo.issues.unlock.title"}} @@ -45,29 +45,20 @@ {{end}} </div> - <form class="ui form form-fetch-action" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}" - method="post"> + <form class="ui form form-fetch-action" method="post" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}"> {{.CsrfTokenHtml}} {{if not .Issue.IsLocked}} <div class="field"> - <strong> {{ctx.Locale.Tr "repo.issues.lock.reason"}} </strong> + <strong>{{ctx.Locale.Tr "repo.issues.lock.reason"}}</strong> </div> <div class="field"> <div class="ui fluid dropdown selection"> - - <select name="reason"> - <option value=""> </option> - {{range .LockReasons}} - <option value="{{.}}">{{.}}</option> - {{end}} - </select> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - - <div class="default text"> </div> - + <input type="hidden" name="reason"> + <div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="menu"> + <div class="item" data-value=""></div> {{range .LockReasons}} <div class="item" data-value="{{.}}">{{.}}</div> {{end}} @@ -76,9 +67,10 @@ </div> {{end}} - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> - <button class="ui red button"> + {{/* explicitly focus the submit button, to avoid Fomantic modal focuses and popups the dropdown */}} + <button class="ui red button" autofocus> {{if .Issue.IsLocked}} {{ctx.Locale.Tr "repo.issues.unlock_confirm"}} {{else}} diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl index 9dd83ba188..15c8760d1a 100644 --- a/templates/repo/issue/sidebar/label_list.tmpl +++ b/templates/repo/issue/sidebar/label_list.tmpl @@ -4,8 +4,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/labels?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="label_ids" type="hidden" value="{{$data.SelectedLabelIDs}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.labels"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -16,8 +16,9 @@ <i class="icon">{{svg "octicon-search" 16}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_labels"}}"> </div> - <a class="item clear-selection" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a> <div class="scrolling menu"> + <a class="item clear-selection" data-text="" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a> + <div class="divider"></div> {{$previousExclusiveScope := "_no_scope"}} {{range $data.RepoLabels}} {{$exclusiveScope := .ExclusiveScope}} @@ -42,7 +43,7 @@ </div> </div> - <div class="ui list labels-list tw-my-2 tw-flex tw-gap-2"> + <div class="ui list labels-list"> <span class="item empty-list {{if $data.SelectedLabelIDs}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span> {{range $data.AllLabels}} {{if .IsChecked}} diff --git a/templates/repo/issue/sidebar/milestone_list.tmpl b/templates/repo/issue/sidebar/milestone_list.tmpl index 8b3e5b0eee..5bc961ed3c 100644 --- a/templates/repo/issue/sidebar/milestone_list.tmpl +++ b/templates/repo/issue/sidebar/milestone_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/milestone?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="milestone_id" type="hidden" value="{{$data.SelectedMilestoneID}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.milestone"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -18,13 +18,13 @@ <i class="icon">{{svg "octicon-search"}}</i> <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_milestones"}}"> </div> - <div class="divider"></div> - <div class="item clear-selection">{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div> <div class="scrolling menu"> + <div class="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div> + <div class="divider"></div> {{if $data.OpenMilestones}} <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_open"}}</div> {{range $data.OpenMilestones}} - <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/issues?milestone={{.ID}}"> + <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/milestone/{{.ID}}"> {{svg "octicon-milestone" 18}} {{.Name}} </a> {{end}} @@ -33,7 +33,7 @@ {{if $data.ClosedMilestones}} <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_closed"}}</div> {{range $data.ClosedMilestones}} - <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/issues?milestone={{.ID}}"> + <a class="item muted" data-value="{{.ID}}" href="{{$pageMeta.RepoLink}}/milestone/{{.ID}}"> {{svg "octicon-milestone" 18}} {{.Name}} </a> {{end}} @@ -43,10 +43,10 @@ </div> </div> - <div class="ui list"> + <div class="ui list muted-links flex-items-block"> <span class="item empty-list {{if $issueMilestone}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_milestone"}}</span> {{if $issueMilestone}} - <a class="item muted" href="{{$pageMeta.RepoLink}}/milestone/{{$issueMilestone.ID}}"> + <a class="item" href="{{$pageMeta.RepoLink}}/milestone/{{$issueMilestone.ID}}"> {{svg "octicon-milestone" 18}} {{$issueMilestone.Name}} </a> {{end}} diff --git a/templates/repo/issue/sidebar/project_list.tmpl b/templates/repo/issue/sidebar/project_list.tmpl index 0cbbdce760..a212261a22 100644 --- a/templates/repo/issue/sidebar/project_list.tmpl +++ b/templates/repo/issue/sidebar/project_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/projects?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input class="combo-value" name="project_id" type="hidden" value="{{$data.SelectedProjectID}}"> - <div class="ui dropdown {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if not $pageMeta.CanModifyIssueOrPull}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.new.projects"}}</strong> {{if $pageMeta.CanModifyIssueOrPull}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu"> @@ -17,8 +17,9 @@ <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_projects"}}"> </div> {{end}} - <div class="item clear-selection">{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}</div> <div class="scrolling menu"> + <div class="item clear-selection" data-text="">{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}</div> + <div class="divider"></div> {{if $data.OpenProjects}} <div class="header">{{ctx.Locale.Tr "repo.issues.new.open_projects"}}</div> {{range $data.OpenProjects}} @@ -39,10 +40,10 @@ </div> </div> </div> - <div class="ui list"> + <div class="ui list muted-links flex-items-block"> <span class="item empty-list {{if $issueProject}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_projects"}}</span> {{if $issueProject}} - <a class="item muted" href="{{$issueProject.Link ctx}}"> + <a class="item" href="{{$issueProject.Link ctx}}"> {{svg $issueProject.IconName 18}} {{$issueProject.Title}} </a> {{end}} diff --git a/templates/repo/issue/sidebar/reference_link.tmpl b/templates/repo/issue/sidebar/reference_link.tmpl index 6b8f120c7b..ad7c0f6bc0 100644 --- a/templates/repo/issue/sidebar/reference_link.tmpl +++ b/templates/repo/issue/sidebar/reference_link.tmpl @@ -1,8 +1,6 @@ <div class="divider"></div> -<div class="ui equal width compact grid"> - {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} - <div class="row tw-items-center" data-tooltip-content="{{$issueReferenceLink}}"> - <span class="text column truncate">{{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}</span> - <button class="ui two wide button column tw-p-2" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button> - </div> +{{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} +<div class="flex-text-block" data-tooltip-content="{{$issueReferenceLink}}"> + <span class="tw-flex-1 gt-ellipsis">{{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}</span> + <button class="ui compact tiny icon button" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button> </div> diff --git a/templates/repo/issue/sidebar/reviewer_list.tmpl b/templates/repo/issue/sidebar/reviewer_list.tmpl index b3d9590d58..2b5ca80fe7 100644 --- a/templates/repo/issue/sidebar/reviewer_list.tmpl +++ b/templates/repo/issue/sidebar/reviewer_list.tmpl @@ -6,8 +6,8 @@ {{if $pageMeta.Issue}}data-update-url="{{$pageMeta.RepoLink}}/issues/request_review?issue_ids={{$pageMeta.Issue.ID}}"{{end}} > <input type="hidden" class="combo-value" name="reviewer_ids">{{/* match CreateIssueForm */}} - <div class="ui dropdown {{if or (not $hasCandidates) (not $data.CanChooseReviewer)}}disabled{{end}}"> - <a class="text muted"> + <div class="ui dropdown full-width {{if or (not $hasCandidates) (not $data.CanChooseReviewer)}}disabled{{end}}"> + <a class="fixed-text muted"> <strong>{{ctx.Locale.Tr "repo.issues.review.reviewers"}}</strong> {{if $data.CanChooseReviewer}}{{svg "octicon-gear"}}{{end}} </a> <div class="menu flex-items-menu"> @@ -43,7 +43,7 @@ </div> </div> - <div class="ui relaxed list flex-items-block tw-my-4"> + <div class="ui relaxed list flex-items-block"> <span class="item empty-list {{if or $data.OriginalReviews $data.CurrentPullReviewers}}tw-hidden{{end}}"> {{ctx.Locale.Tr "repo.issues.new.no_reviewers"}} </span> @@ -51,9 +51,9 @@ <div class="item"> <div class="flex-text-inline tw-flex-1"> {{if .User}} - <a class="muted flex-text-inline" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}} {{.User.GetDisplayName}}</a> + <a class="muted flex-text-inline tw-gap-2" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}} {{.User.GetDisplayName}}</a> {{else if .Team}} - {{svg "octicon-people" 20}} {{$repoOwnerName}}/{{.Team.Name}} + <span class="flex-text-inline tw-gap-2">{{svg "octicon-people" 20}} {{$repoOwnerName}}/{{.Team.Name}}</span> {{end}} </div> <div class="flex-text-inline"> @@ -92,7 +92,7 @@ <div class="flex-text-inline tw-flex-1"> {{$originalURLHostname := $pageMeta.Repository.GetOriginalURLHostname}} {{$originalURL := $pageMeta.Repository.OriginalURL}} - <a class="muted flex-text-inline" href="{{$originalURL}}" data-tooltip-content="{{ctx.Locale.Tr "repo.migrated_from_fake" $originalURLHostname}}"> + <a class="muted flex-text-inline tw-gap-2" href="{{$originalURL}}" data-tooltip-content="{{ctx.Locale.Tr "repo.migrated_from_fake" $originalURLHostname}}"> {{svg (MigrationIcon $originalURLHostname) 20}} {{.OriginalAuthor}} </a> </div> @@ -121,7 +121,7 @@ <label for="issue-sidebar-dismiss-review-message">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</label> <input id="issue-sidebar-dismiss-review-message" name="message"> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> <button class="ui red button" type="submit">{{ctx.Locale.Tr "ok"}}</button> </div> diff --git a/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl index f107dc5ef5..ab8600b068 100644 --- a/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl +++ b/templates/repo/issue/sidebar/stopwatch_timetracker.tmpl @@ -2,10 +2,13 @@ {{if and .CanUseTimetracker (not .Repository.IsArchived)}} <div class="divider"></div> <div> - <div class="ui dropdown jump"> - <a class="text muted"> - <strong>{{ctx.Locale.Tr "repo.issues.tracker"}}</strong> {{svg "octicon-gear"}} - {{if $.IsStopwatchRunning}}{{svg "octicon-stopwatch"}}{{end}} + <div class="ui dropdown full-width jump"> + <a class="fixed-text muted"> + <div> + <strong>{{ctx.Locale.Tr "repo.issues.tracker"}}</strong> + {{if $.IsStopwatchRunning}}{{svg "octicon-stopwatch"}}{{end}} + </div> + {{svg "octicon-gear"}} </a> <div class="menu"> <a class="item issue-set-time-estimate show-modal" data-modal="#issue-time-set-estimate-modal"> @@ -13,14 +16,14 @@ </a> <div class="divider"></div> {{if $.IsStopwatchRunning}} - <a class="item issue-stop-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/toggle"> + <a class="item issue-stop-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/stop"> {{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_stop"}} </a> <a class="item issue-cancel-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/cancel"> {{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_discard"}} </a> {{else}} - <a class="item issue-start-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/toggle"> + <a class="item issue-start-time link-action" data-url="{{.Issue.Link}}/times/stopwatch/start"> {{svg "octicon-stopwatch"}} {{ctx.Locale.Tr "repo.issues.timetracker_timer_start"}} </a> <a class="item issue-add-time show-modal" data-modal="#issue-time-manually-add-modal"> @@ -72,7 +75,7 @@ {{end}} {{if .WorkingUsers}} <div class="ui comments tw-mt-2"> - {{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time)}} + {{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Hour)}} <div> {{range $user, $trackedtime := .WorkingUsers}} <div class="comment tw-mt-2"> @@ -82,7 +85,7 @@ <div class="content"> {{template "shared/user/authorlink" $user}} <div class="text"> - {{$trackedtime|Sec2Time}} + {{$trackedtime|Sec2Hour}} </div> </div> </div> diff --git a/templates/repo/issue/sidebar/wip_switch.tmpl b/templates/repo/issue/sidebar/wip_switch.tmpl index 06a3be0d8f..8c40908f62 100644 --- a/templates/repo/issue/sidebar/wip_switch.tmpl +++ b/templates/repo/issue/sidebar/wip_switch.tmpl @@ -1,7 +1,5 @@ {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}} - <div class="toggle-wip tw-mt-2" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title"> - <a class="muted"> - {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} - </a> - </div> + <a data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title"> + {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} + </a> {{end}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 1a68781ecd..dae3c4ee6a 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -13,7 +13,7 @@ </a> {{end}} <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between" role="heading" aria-level="3"> + <div class="comment-header" role="heading" aria-level="3"> <div class="comment-header-left tw-flex tw-items-center"> {{if .Issue.OriginalAuthor}} <span class="text black tw-font-semibold"> @@ -68,7 +68,7 @@ {{template "repo/issue/view_content/comments" .}} {{if and .Issue.IsPull (not $.Repository.IsArchived)}} - {{template "repo/issue/view_content/pull".}} + {{template "repo/issue/view_content/pull_merge_box".}} {{end}} {{if .IsSigned}} @@ -83,7 +83,7 @@ {{template "repo/issue/comment_tab" .}} {{.CsrfTokenHtml}} <div class="field footer"> - <div class="text right"> + <div class="flex-text-block tw-justify-end"> {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}} {{if .Issue.IsClosed}} <button id="status-button" class="ui primary basic button" data-status="{{ctx.Locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.reopen_comment_issue"}}" name="status" value="reopen"> @@ -157,7 +157,7 @@ {{end}} <div class="field"> - <div class="text right edit"> + <div class="flex-text-block tw-justify-end"> <button type="button" class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> <button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button> </div> diff --git a/templates/repo/issue/view_content/add_reaction.tmpl b/templates/repo/issue/view_content/add_reaction.tmpl index 6baded8fe9..2f5764d964 100644 --- a/templates/repo/issue/view_content/add_reaction.tmpl +++ b/templates/repo/issue/view_content/add_reaction.tmpl @@ -3,7 +3,7 @@ <a class="muted">{{svg "octicon-smiley"}}</a> <div class="menu"> {{range $value := AllowedReactions}} - <a class="item emoji comment-reaction-button" data-tooltip-content="{{$value}}" aria-label="{{$value}}" data-reaction-content="{{$value}}">{{ReactionToEmoji $value}}</a> + <a class="item emoji" data-tooltip-content="{{$value}}" aria-label="{{$value}}" data-reaction-content="{{$value}}" data-global-click="onCommentReactionButtonClick">{{ReactionToEmoji $value}}</a> {{end}} </div> </div> diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index 2155f78656..e865050559 100644 --- a/templates/repo/issue/view_content/attachments.tmpl +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -31,7 +31,7 @@ {{if FilenameIsImage .Name}} {{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}} <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}"> - <img alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}"> + <img loading="lazy" alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}"> </a> {{end}} {{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 2e1a67edcc..50b8f58fc3 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -26,7 +26,7 @@ </a> {{end}} <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between" role="heading" aria-level="3"> + <div class="comment-header" role="heading" aria-level="3"> <div class="comment-header-left tw-flex tw-items-center"> {{if .OriginalAuthor}} <span class="text black tw-font-semibold tw-mr-1"> @@ -163,12 +163,13 @@ </span> <div class="detail flex-text-block"> {{svg "octicon-git-commit"}} + {{/* the content is a link like <a href="{RepoLink}/commit/{CommitID}">message title</a> (from CreateRefComment) */}} <span class="text grey muted-links">{{.Content | SanitizeHTML}}</span> </div> </div> {{else if eq .Type 7}} {{if or .AddedLabels .RemovedLabels}} - <div class="timeline-item event" id="{{.HashTag}}"> + <div class="timeline-item event with-labels-list-inline" id="{{.HashTag}}"> <span class="badge">{{svg "octicon-tag"}}</span> {{template "shared/user/avatarlink" dict "user" .Poster}} <span class="text grey muted-links"> @@ -252,7 +253,7 @@ <span class="text grey muted-links"> {{template "shared/user/authorlink" .Poster}} {{$timeStr := .RenderedContent}} {{/* compatibility with time comments made before v1.21 */}} - {{if not $timeStr}}{{$timeStr = .Content|Sec2Time}}{{end}} + {{if not $timeStr}}{{$timeStr = .Content|Sec2Hour}}{{end}} {{ctx.Locale.Tr "repo.issues.stop_tracking_history" $timeStr $createdStr}} </span> {{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}} @@ -264,7 +265,7 @@ <span class="text grey muted-links"> {{template "shared/user/authorlink" .Poster}} {{$timeStr := .RenderedContent}} {{/* compatibility with time comments made before v1.21 */}} - {{if not $timeStr}}{{$timeStr = .Content|Sec2Time}}{{end}} + {{if not $timeStr}}{{$timeStr = .Content|Sec2Hour}}{{end}} {{ctx.Locale.Tr "repo.issues.add_time_history" $timeStr $createdStr}} </span> {{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}} @@ -393,7 +394,7 @@ {{if or .Content .Attachments}} <div class="timeline-item comment"> <div class="content comment-container"> - <div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between"> + <div class="comment-header"> <div class="comment-header-left tw-flex tw-items-center"> {{if gt .Poster.ID 0}} <a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}"> @@ -506,7 +507,7 @@ {{/* compatibility with time comments made before v1.21 */}} <span class="text grey muted-links">{{.RenderedContent}}</span> {{else}} - <span class="text grey muted-links">- {{.Content|Sec2Time}}</span> + <span class="text grey muted-links">- {{.Content|Sec2Hour}}</span> {{end}} </div> </div> @@ -615,7 +616,7 @@ <div class="timeline-item-group"> <div class="timeline-item event" id="{{.HashTag}}"> <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> - <img src="{{.Poster.AvatarLink ctx}}" width="40" height="40"> + <img loading="lazy" alt src="{{.Poster.AvatarLink ctx}}" width="40" height="40"> </a> <span class="badge grey">{{svg "octicon-x" 16}}</span> <span class="text grey muted-links"> @@ -633,8 +634,8 @@ </div> {{if .Content}} <div class="timeline-item comment"> - <div class="content"> - <div class="ui top attached header comment-header-left tw-flex tw-items-center arrow-top"> + <div class="content comment-container"> + <div class="comment-header arrow-top"> {{if gt .Poster.ID 0}} <a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}"> {{ctx.AvatarUtils.Avatar .Poster 24}} @@ -644,7 +645,7 @@ {{ctx.Locale.Tr "action.review_dismissed_reason"}} </span> </div> - <div class="ui attached segment"> + <div class="ui attached segment comment-body"> <div class="render-content markup"> {{if .RenderedContent}} {{.RenderedContent}} diff --git a/templates/repo/issue/view_content/conversation.tmpl b/templates/repo/issue/view_content/conversation.tmpl index 14803298b8..aa94a2dbc4 100644 --- a/templates/repo/issue/view_content/conversation.tmpl +++ b/templates/repo/issue/view_content/conversation.tmpl @@ -17,7 +17,7 @@ </div> <div> {{if or $invalid $resolved}} - <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}tw-hidden {{end}}ui compact labeled button show-outdated tw-flex tw-items-center"> + <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}tw-hidden{{end}} btn tiny show-outdated"> {{svg "octicon-unfold" 16 "tw-mr-2"}} {{if $resolved}} {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} @@ -25,7 +25,7 @@ {{ctx.Locale.Tr "repo.issues.review.show_outdated"}} {{end}} </button> - <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if $resolved}}tw-hidden {{end}}ui compact labeled button hide-outdated tw-flex tw-items-center"> + <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if $resolved}}tw-hidden {{end}} btn tiny hide-outdated"> {{svg "octicon-fold" 16 "tw-mr-2"}} {{if $resolved}} {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} @@ -40,7 +40,7 @@ {{if $diff}} {{$file := (index $diff.Files 0)}} <div id="code-preview-{{$comment.ID}}" class="ui table segment{{if $resolved}} tw-hidden{{end}}"> - <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> + <div class="diff-file-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> <table> <tbody> @@ -57,7 +57,7 @@ {{$createdSubStr:= DateUtils.TimeSince .CreatedUnix}} <div class="comment code-comment" id="{{.HashTag}}"> <div class="content comment-container"> - <div class="header comment-header"> + <div class="comment-header"> <div class="comment-header-left tw-flex tw-items-center"> {{if not .OriginalAuthor}} <a class="avatar"> @@ -109,7 +109,7 @@ </div> {{end}} </div> - <div class="code-comment-buttons tw-flex tw-items-center tw-flex-wrap tw-mt-2 tw-mb-1 tw-mx-2"> + <div class="flex-text-block tw-flex-wrap tw-my-2"> <div class="tw-flex-1"> {{if $resolved}} <div class="ui grey text"> @@ -118,7 +118,7 @@ </div> {{end}} </div> - <div class="code-comment-buttons-buttons"> + <div class="flex-text-block"> {{if and $.CanMarkConversation $hasReview (not $isReviewPending)}} <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> {{if $resolved}} @@ -129,8 +129,8 @@ </button> {{end}} {{if and $.SignedUserID (not $.Repository.IsArchived)}} - <button class="comment-form-reply ui primary tiny labeled icon button tw-ml-1 tw-mr-0"> - {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} + <button class="comment-form-reply ui primary icon tiny button"> + {{svg "octicon-reply" 12}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} </button> {{end}} </div> diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull_merge_box.tmpl index 7c53c5edb5..46bcd3b8b3 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull_merge_box.tmpl @@ -1,7 +1,13 @@ {{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}} {{/* Then the merge box will not be displayed because this page already contains enough information */}} {{else}} -<div class="timeline-item comment merge box"> +<div class="timeline-item comment pull-merge-box" + data-global-init="initRepoPullMergeBox" + {{if .PullMergeBoxReloadingInterval}} + data-pull-merge-box-reloading-interval="{{.PullMergeBoxReloadingInterval}}" + data-pull-link="{{.Issue.Link}}" + {{end}} +> <div class="timeline-avatar text {{if .Issue.PullRequest.HasMerged}}purple {{- else if .Issue.IsClosed}}grey {{- else if .IsPullWorkInProgress}}grey @@ -83,13 +89,13 @@ {{ctx.Locale.Tr "repo.pulls.data_broken"}} </div> {{else if .IsPullWorkInProgress}} - <div class="item toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title"> + <div class="item"> <div class="item-section-left flex-text-inline tw-flex-1"> {{svg "octicon-x"}} {{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}} </div> {{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}} - <button class="ui compact button"> + <button class="ui compact button" data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title"> {{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}} </button> {{end}} @@ -97,7 +103,7 @@ {{template "repo/issue/view_content/update_branch_by_merge" $}} {{else if .Issue.PullRequest.IsChecking}} <div class="item"> - {{svg "octicon-sync"}} + {{svg "octicon-sync" 16 "circular-spin"}} {{ctx.Locale.Tr "repo.pulls.is_checking"}} </div> {{else if .Issue.PullRequest.IsAncestor}} @@ -191,10 +197,11 @@ </div> {{end}} {{end}} + {{template "repo/issue/view_content/update_branch_by_merge" $}} + {{if .Issue.PullRequest.IsEmpty}} <div class="divider"></div> - <div class="item"> {{svg "octicon-alert"}} {{ctx.Locale.Tr "repo.pulls.is_empty"}} @@ -216,7 +223,7 @@ const defaultMergeMessage = {{.DefaultMergeBody}}; const defaultSquashMergeMessage = {{.DefaultSquashMergeBody}}; const mergeForm = { - 'baseLink': {{.Link}}, + 'baseLink': {{.Issue.Link}}, 'textCancel': {{ctx.Locale.Tr "cancel"}}, 'textDeleteBranch': {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}}, 'textAutoMergeButtonWhenSucceed': {{ctx.Locale.Tr "repo.pulls.auto_merge_button_when_succeed"}}, @@ -318,7 +325,7 @@ {{if .IsBlockedByApprovals}} <div class="item text red"> {{svg "octicon-x"}} - {{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}} </div> {{else if .IsBlockedByRejection}} <div class="item text red"> @@ -377,7 +384,7 @@ */}} {{if and $.StillCanManualMerge (not $showGeneralMergeForm)}} <div class="divider"></div> - <form class="ui form form-fetch-action" action="{{.Link}}/merge" method="post">{{/* another similar form is in PullRequestMergeForm.vue*/}} + <form class="ui form form-fetch-action" action="{{.Issue.Link}}/merge" method="post">{{/* another similar form is in PullRequestMergeForm.vue*/}} {{.CsrfTokenHtml}} <div class="field"> <input type="text" name="merge_commit_id" placeholder="{{ctx.Locale.Tr "repo.pulls.merge_commit_id"}}"> diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index 9a3e2cb7d7..a1cff41a3a 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -1,55 +1,57 @@ <div class="divider"></div> -<div class="instruct-toggle"> {{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}} </div> -<div class="instruct-content tw-mt-2 tw-hidden"> - <div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div> - {{$localBranch := .PullRequest.HeadBranch}} - {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}} - {{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}} - {{end}} - <div class="ui secondary segment"> - {{if eq .PullRequest.Flow 0}} - <div>git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}<origin-url data-url="{{.PullRequest.HeadRepo.Link}}"></origin-url>{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}</div> - {{else}} - <div>git fetch -u origin {{.PullRequest.GetGitRefName}}:{{$localBranch}}</div> +<details> + <summary>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}}</summary> + <div class="tw-mt-2"> + <div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div> + {{$localBranch := .PullRequest.HeadBranch}} + {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}} + {{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}} {{end}} - <div>git checkout {{$localBranch}}</div> - </div> - {{if .ShowMergeInstructions}} - <div> - <h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3> - {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}} - {{if not .AutodetectManualMerge}} - <div>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</div> - {{end}} - </div> - <div class="ui secondary segment"> - <div data-pull-merge-style="merge"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --no-ff {{$localBranch}}</div> - </div> - <div class="tw-hidden" data-pull-merge-style="rebase"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --ff-only {{$localBranch}}</div> - </div> - <div class="tw-hidden" data-pull-merge-style="rebase-merge"> + <div class="ui secondary segment"> + {{if eq .PullRequest.Flow 0}} + <div>git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}<origin-url data-url="{{.PullRequest.HeadRepo.Link}}"></origin-url>{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}</div> + {{else}} + <div>git fetch -u origin {{.PullRequest.GetGitRefName}}:{{$localBranch}}</div> + {{end}} <div>git checkout {{$localBranch}}</div> - <div>git rebase {{.PullRequest.BaseBranch}}</div> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --no-ff {{$localBranch}}</div> - </div> - <div class="tw-hidden" data-pull-merge-style="squash"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --squash {{$localBranch}}</div> </div> - <div class="tw-hidden" data-pull-merge-style="fast-forward-only"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge --ff-only {{$localBranch}}</div> + {{if .ShowMergeInstructions}} + <div> + <h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3> + {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}} + {{if not .AutodetectManualMerge}} + <div>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</div> + {{end}} </div> - <div class="tw-hidden" data-pull-merge-style="manually-merged"> - <div>git checkout {{.PullRequest.BaseBranch}}</div> - <div>git merge {{$localBranch}}</div> + <div class="ui secondary segment"> + <div data-pull-merge-style="merge"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --no-ff {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="rebase"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --ff-only {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="rebase-merge"> + <div>git checkout {{$localBranch}}</div> + <div>git rebase {{.PullRequest.BaseBranch}}</div> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --no-ff {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="squash"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --squash {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="fast-forward-only"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge --ff-only {{$localBranch}}</div> + </div> + <div class="tw-hidden" data-pull-merge-style="manually-merged"> + <div>git checkout {{.PullRequest.BaseBranch}}</div> + <div>git merge {{$localBranch}}</div> + </div> + <div>git push origin {{.PullRequest.BaseBranch}}</div> </div> - <div>git push origin {{.PullRequest.BaseBranch}}</div> + {{end}} </div> - {{end}} -</div> +</details> diff --git a/templates/repo/issue/view_content/reactions.tmpl b/templates/repo/issue/view_content/reactions.tmpl index 0011efe8b2..286d93a9b1 100644 --- a/templates/repo/issue/view_content/reactions.tmpl +++ b/templates/repo/issue/view_content/reactions.tmpl @@ -1,9 +1,9 @@ <div class="bottom-reactions" data-action-url="{{$.ActionURL}}"> {{range $key, $value := .Reactions}} {{$hasReacted := $value.HasUser ctx.RootData.SignedUserID}} - <a role="button" class="ui label basic{{if $hasReacted}} primary{{end}}{{if not ctx.RootData.IsSigned}} disabled{{end}} comment-reaction-button" - data-tooltip-content - title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{ctx.Locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" + <a role="button" class="ui label basic{{if $hasReacted}} primary{{end}}{{if not ctx.RootData.IsSigned}} disabled{{end}}" + data-global-click="onCommentReactionButtonClick" + data-tooltip-content title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{ctx.Locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" aria-label="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{ctx.Locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-tooltip-placement="bottom-start" data-reaction-content="{{$key}}" data-has-reacted="{{$hasReacted}}"> diff --git a/templates/repo/issue/view_content/reference_issue_dialog.tmpl b/templates/repo/issue/view_content/reference_issue_dialog.tmpl index d6c9081001..0b28bdc811 100644 --- a/templates/repo/issue/view_content/reference_issue_dialog.tmpl +++ b/templates/repo/issue/view_content/reference_issue_dialog.tmpl @@ -7,7 +7,7 @@ {{.CsrfTokenHtml}} <div class="field"> <label><strong>{{ctx.Locale.Tr "repository"}}</strong></label> - <div class="ui search selection dropdown issue_reference_repository_search ellipsis-items-nowrap"> + <div class="ui search selection dropdown issue_reference_repository_search ellipsis-text-items"> <div class="default text gt-ellipsis">{{.Repository.FullName}}</div> <div class="menu"></div> </div> @@ -20,7 +20,7 @@ <label><strong>{{ctx.Locale.Tr "repo.issues.reference_issue.body"}}</strong></label> <textarea name="content"></textarea> </div> - <div class="text right"> + <div class="flex-text-block tw-justify-end"> <button class="ui primary button">{{ctx.Locale.Tr "repo.issues.create"}}</button> </div> </form> diff --git a/templates/repo/issue/view_content/update_branch_by_merge.tmpl b/templates/repo/issue/view_content/update_branch_by_merge.tmpl index adce052dee..5d959bf0b3 100644 --- a/templates/repo/issue/view_content/update_branch_by_merge.tmpl +++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl @@ -8,8 +8,8 @@ <div class="item-section-right"> {{if and $.UpdateAllowed $.UpdateByRebaseAllowed}} <div class="tw-inline-block"> - <div class="ui buttons update-button"> - <button class="ui button" data-do="{{$.Link}}/update" data-redirect="{{$.Link}}"> + <div id="update-pr-branch-with-base" class="ui buttons"> + <button class="ui button" data-do="{{$.Issue.Link}}/update" data-redirect="{{$.Issue.Link}}"> <span class="button-text"> {{ctx.Locale.Tr "repo.pulls.update_branch"}} </span> @@ -17,15 +17,15 @@ <div class="ui dropdown icon button"> {{svg "octicon-triangle-down"}} <div class="menu"> - <a class="item active selected" data-do="{{$.Link}}/update">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</a> - <a class="item" data-do="{{$.Link}}/update?style=rebase">{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</a> + <a class="item active selected" data-do="{{$.Issue.Link}}/update">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</a> + <a class="item" data-do="{{$.Issue.Link}}/update?style=rebase">{{ctx.Locale.Tr "repo.pulls.update_branch_rebase"}}</a> </div> </div> </div> </div> {{end}} {{if and $.UpdateAllowed (not $.UpdateByRebaseAllowed)}} - <form action="{{$.Link}}/update" method="post" class="ui update-branch-form"> + <form action="{{$.Issue.Link}}/update" method="post" class="ui update-branch-form"> {{$.CsrfTokenHtml}} <button class="ui compact button"> <span class="ui text">{{ctx.Locale.Tr "repo.pulls.update_branch"}}</span> diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 0354f6ef22..b8f28dfd9b 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -13,7 +13,7 @@ {{$canEditIssueTitle := and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} <div class="issue-title" id="issue-title-display"> <h1 class="tw-break-anywhere"> - {{ctx.RenderUtils.RenderIssueTitle .Issue.Title ($.Repository.ComposeMetas ctx)}} + {{ctx.RenderUtils.RenderIssueTitle .Issue.Title $.Repository}} <span class="index">#{{.Issue.Index}}</span> </h1> <div class="issue-title-buttons"> @@ -42,7 +42,7 @@ {{if .HasMerged}} <div class="ui purple label issue-state-label">{{svg "octicon-git-merge" 16 "tw-mr-1"}} {{if eq .Issue.PullRequest.Status 3}}{{ctx.Locale.Tr "repo.pulls.manually_merged"}}{{else}}{{ctx.Locale.Tr "repo.pulls.merged"}}{{end}}</div> {{else if .Issue.IsClosed}} - <div class="ui red label issue-state-label">{{svg (Iif .Issue.IsPull "octicon-git-pull-request" "octicon-issue-closed")}} {{ctx.Locale.Tr "repo.issues.closed_title"}}</div> + <div class="ui red label issue-state-label">{{svg (Iif .Issue.IsPull "octicon-git-pull-request-closed" "octicon-issue-closed")}} {{ctx.Locale.Tr "repo.issues.closed_title"}}</div> {{else if .Issue.IsPull}} {{if .IsPullWorkInProgress}} <div class="ui grey label issue-state-label">{{svg "octicon-git-pull-request-draft"}} {{ctx.Locale.Tr "repo.issues.draft_title"}}</div> diff --git a/templates/repo/latest_commit.tmpl b/templates/repo/latest_commit.tmpl index c62efc8e88..cff338949f 100644 --- a/templates/repo/latest_commit.tmpl +++ b/templates/repo/latest_commit.tmpl @@ -21,10 +21,10 @@ {{template "repo/commit_statuses" dict "Status" .LatestCommitStatus "Statuses" .LatestCommitStatuses}} {{$commitLink:= printf "%s/commit/%s" .RepoLink (PathEscape .LatestCommit.ID.String)}} - <span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .LatestCommit.Message $commitLink ($.Repository.ComposeMetas ctx)}}</span> + <span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .LatestCommit.Message $commitLink $.Repository}}</span> {{if IsMultilineCommitMessage .LatestCommit.Message}} - <button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button> - <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .LatestCommit.Message ($.Repository.ComposeMetas ctx)}}</pre> + <button class="ui button ellipsis-button" aria-expanded="false" data-global-click="onRepoEllipsisButtonClick">...</button> + <pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .LatestCommit.Message $.Repository}}</pre> {{end}} </span> {{end}} diff --git a/templates/repo/migrate/codebase.tmpl b/templates/repo/migrate/codebase.tmpl index c8059b7c7b..f4de8ff236 100644 --- a/templates/repo/migrate/codebase.tmpl +++ b/templates/repo/migrate/codebase.tmpl @@ -1,114 +1,114 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> - <div id="migrate_items"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> - </div> - </div> - </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> - <div class="divider"></div> + {{template "repo/migrate/options" .}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> + <div id="migrate_items"> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> + </div> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> </div> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <label></label> <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> - {{end}} + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> + </div> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="divider"></div> + + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} + </div> </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/codecommit.tmpl b/templates/repo/migrate/codecommit.tmpl index d1cebd0e48..275a2aef09 100644 --- a/templates/repo/migrate/codecommit.tmpl +++ b/templates/repo/migrate/codecommit.tmpl @@ -1,115 +1,115 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="aws_access_key_id">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_access_key_id"}}</label> - <input id="aws_access_key_id" name="aws_access_key_id" value="{{.aws_access_key_id}}" required> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="aws_secret_access_key">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_secret_access_key"}}</label> - <input id="aws_secret_access_key" name="aws_secret_access_key" type="password" value="{{.aws_secret_access_key}}" required> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" required> - </div> - <div class="inline required field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}" required> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> + + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="aws_access_key_id">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_access_key_id"}}</label> + <input id="aws_access_key_id" name="aws_access_key_id" value="{{.aws_access_key_id}}" required> + </div> + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="aws_secret_access_key">{{ctx.Locale.Tr "repo.migrate.codecommit.aws_secret_access_key"}}</label> + <input id="aws_secret_access_key" name="aws_secret_access_key" type="password" value="{{.aws_secret_access_key}}" required> + </div> + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" required> + </div> + <div class="inline required field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "repo.migrate.codecommit.https_git_credentials_password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}" required> + </div> + + {{if not .DisableNewPullMirrors}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_options"}}</label> + <div class="ui checkbox"> + <input id="mirror" name="mirror" type="checkbox" {{if .mirror}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_options_mirror_helper"}}</label> </div> + </div> + {{end}} - {{if not .DisableNewPullMirrors}} + <div id="migrate_items"> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_options"}}</label> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> <div class="ui checkbox"> - <input id="mirror" name="mirror" type="checkbox" {{if .mirror}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_options_mirror_helper"}}</label> - </div> - </div> - {{end}} - - <div id="migrate_items"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl index 9c5f0d7d6d..41139d4fd6 100644 --- a/templates/repo/migrate/git.tmpl +++ b/templates/repo/migrate/git.tmpl @@ -1,88 +1,88 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> - {{template "repo/migrate/options" .}} + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - <div class="divider"></div> + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar .}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> - </div> - </div> + {{template "repo/migrate/options" .}} - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + <div class="divider"></div> + + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gitbucket.tmpl b/templates/repo/migrate/gitbucket.tmpl index b667fa828a..c89aa6c744 100644 --- a/templates/repo/migrate/gitbucket.tmpl +++ b/templates/repo/migrate/gitbucket.tmpl @@ -1,130 +1,130 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> + + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> - {{template "repo/migrate/options" .}} + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> + + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gitea.tmpl b/templates/repo/migrate/gitea.tmpl index 3b8f377096..55cf61a77f 100644 --- a/templates/repo/migrate/gitea.tmpl +++ b/templates/repo/migrate/gitea.tmpl @@ -1,126 +1,126 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> - <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> + <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> + </div> + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> + <div class="ui checkbox"> + <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar .}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + {{.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/github.tmpl b/templates/repo/migrate/github.tmpl index 3535eddfc2..86b585b861 100644 --- a/templates/repo/migrate/github.tmpl +++ b/templates/repo/migrate/github.tmpl @@ -1,128 +1,128 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> - <a target="_blank" href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">{{svg "octicon-question"}}</a> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.github_token_desc"}} - </span> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}} + </span> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> + <a target="_blank" href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">{{svg "octicon-question"}}</a> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.github_token_desc"}} + </span> + </div> + + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> + <div class="ui checkbox"> + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gitlab.tmpl b/templates/repo/migrate/gitlab.tmpl index f705fb3090..edd69f0027 100644 --- a/templates/repo/migrate/gitlab.tmpl +++ b/templates/repo/migrate/gitlab.tmpl @@ -1,125 +1,125 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> - <a target="_blank" href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html">{{svg "octicon-question"}}</a> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}> + <a target="_blank" href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html">{{svg "octicon-question"}}</a> + </div> + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> </div> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/gogs.tmpl b/templates/repo/migrate/gogs.tmpl index eca83b1636..9149c43239 100644 --- a/templates/repo/migrate/gogs.tmpl +++ b/templates/repo/migrate/gogs.tmpl @@ -1,128 +1,128 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> - <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> - <!-- <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> --> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> + + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_token">{{ctx.Locale.Tr "access_token"}}</label> + <input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}> + <!-- <a target="_blank" href="https://docs.gitea.com/development/api-usage">{{svg "octicon-question"}}</a> --> + </div> + {{template "repo/migrate/options" .}} + + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + </div> + </div> + + <div id="migrate_items" class="inline field"> + <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <label></label> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_wiki"}}</label> + <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> + </div> + <div class="ui checkbox"> + <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> </div> </div> - - <div id="migrate_items"> - <span class="help">{{ctx.Locale.Tr "repo.migrate.migrate_items_options"}}</span> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> + </div> + <!-- Gogs do not support it + <div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> </div> - <!-- Gogs do not support it - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_merge_requests"}}</label> - </div> - <div class="ui checkbox"> - <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> - </div> + <div class="ui checkbox"> + <input name="releases" type="checkbox" {{if .releases}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_releases"}}</label> </div> - --> </div> + --> + </div> - <div class="divider"></div> + <div class="divider"></div> - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar .}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + {{.ShortName 40}} </div> - </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}} checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> - </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl index c5c697edff..79ac5cc8a1 100644 --- a/templates/repo/migrate/migrate.tmpl +++ b/templates/repo/migrate/migrate.tmpl @@ -19,7 +19,7 @@ <div class="header tw-text-center"> {{.Title}} </div> - <div class="description tw-text-center"> + <div class="description tw-text-center tw-text-balance"> {{ctx.Locale.Tr (printf "repo.migrate.%s.description" .Name)}} </div> </div> diff --git a/templates/repo/migrate/migrating.tmpl b/templates/repo/migrate/migrating.tmpl index bc07b488f2..e73e3a9790 100644 --- a/templates/repo/migrate/migrating.tmpl +++ b/templates/repo/migrate/migrating.tmpl @@ -7,19 +7,19 @@ {{template "base/alert" .}} <div class="home"> <div class="ui stackable middle very relaxed page grid"> - <div id="repo_migrating" class="sixteen wide center aligned centered column" data-migrating-repo-link="{{.Link}}"> + <div id="repo_migrating" class="sixteen wide tw-text-center centered column" data-migrating-repo-link="{{.Link}}"> <div> - <img src="{{AssetUrlPrefix}}/img/loading.png"> + <img alt src="{{AssetUrlPrefix}}/img/loading.png"> </div> </div> - <div id="repo_migrating_failed_image" class="sixteen wide center aligned centered column tw-hidden"> + <div id="repo_migrating_failed_image" class="sixteen wide tw-text-center centered column tw-hidden"> <div> - <img src="{{AssetUrlPrefix}}/img/failed.png"> + <img alt src="{{AssetUrlPrefix}}/img/failed.png"> </div> </div> </div> <div class="ui stackable middle very relaxed page grid"> - <div class="sixteen wide center aligned centered column"> + <div class="sixteen wide tw-text-center centered column"> <div id="repo_migrating_progress"> <p>{{ctx.Locale.Tr "repo.migrate.migrating" .CloneAddr}}</p> <p id="repo_migrating_progress_message"></p> @@ -77,7 +77,7 @@ <input id="repo_name_to_delete" name="repo_name" required> </div> - <div class="text right actions"> + <div class="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> diff --git a/templates/repo/migrate/onedev.tmpl b/templates/repo/migrate/onedev.tmpl index e1aad96ba4..a25ccf9438 100644 --- a/templates/repo/migrate/onedev.tmpl +++ b/templates/repo/migrate/onedev.tmpl @@ -1,114 +1,115 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new migrate"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form left-right-form" action="{{.Link}}" method="post"> {{template "base/disable_form_autofill"}} {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}} - <input id="service_type" type="hidden" name="service" value="{{.service}}"> - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> - <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> - <span class="help"> - {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} - </span> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> - <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> - </div> - <div class="inline field {{if .Err_Auth}}error{{end}}"> - <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> - <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> - </div> + <input id="service_type" type="hidden" name="service" value="{{.service}}"> - {{template "repo/migrate/options" .}} + <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> + <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> + <span class="help"> + {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} + </span> + </div> - <div id="migrate_items"> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> - <div class="ui checkbox"> - <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> - </div> - <div class="ui checkbox"> - <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> - </div> - </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> - </div> - <div class="ui checkbox"> - <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> - </div> - </div> - </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_username">{{ctx.Locale.Tr "username"}}</label> + <input id="auth_username" name="auth_username" value="{{.auth_username}}" {{if not .auth_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="auth_password">{{ctx.Locale.Tr "password"}}</label> + <input id="auth_password" name="auth_password" type="password" value="{{.auth_password}}"> + </div> - <div class="divider"></div> + {{template "repo/migrate/options" .}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu" title="{{.SignedUser.Name}}"> - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> + <div id="migrate_items" class="inline field"> + <label></label> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.migrate_items"}}</label> + <div class="ui checkbox"> + <input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_milestones"}}</label> + </div> + <div class="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_labels"}}</label> </div> - </div> - - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> </div> <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <label></label> <div class="ui checkbox"> - {{if .IsForcedPrivate}} - <input name="private" type="checkbox" checked disabled> - <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> - {{else}} - <input name="private" type="checkbox" {{if .private}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> - {{end}} + <input name="issues" type="checkbox" {{if .issues}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_issues"}}</label> + </div> + <div class="ui checkbox"> + <input name="pull_requests" type="checkbox" {{if .pull_requests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_items_pullrequests"}}</label> </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="divider"></div> + + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu" title="{{.SignedUser.Name}}"> + <div class="item" data-value="{{.SignedUser.ID}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} + </div> </div> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button"> - {{ctx.Locale.Tr "repo.migrate_repo"}} - </button> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required maxlength="100"> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + {{if .IsForcedPrivate}} + <input name="private" type="checkbox" checked disabled> + <label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label> + {{else}} + <input name="private" type="checkbox" {{if .private}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + {{end}} </div> </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" maxlength="2048">{{.description}}</textarea> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.migrate_repo"}} + </button> + </div> </form> </div> </div> diff --git a/templates/repo/navbar.tmpl b/templates/repo/navbar.tmpl index b2471dc17e..e004c5254b 100644 --- a/templates/repo/navbar.tmpl +++ b/templates/repo/navbar.tmpl @@ -1,14 +1,19 @@ +{{$canReadCode := $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} + <div class="ui fluid vertical menu"> + {{/* the default activity page "pulse" could work with any permission: code, issue, pr, release*/}} <a class="{{if .PageIsPulse}}active {{end}}item" href="{{.RepoLink}}/activity"> {{ctx.Locale.Tr "repo.activity.navbar.pulse"}} </a> - <a class="{{if .PageIsContributors}}active {{end}}item" href="{{.RepoLink}}/activity/contributors"> - {{ctx.Locale.Tr "repo.activity.navbar.contributors"}} - </a> - <a class="{{if .PageIsCodeFrequency}}active{{end}} item" href="{{.RepoLink}}/activity/code-frequency"> - {{ctx.Locale.Tr "repo.activity.navbar.code_frequency"}} - </a> - <a class="{{if .PageIsRecentCommits}}active{{end}} item" href="{{.RepoLink}}/activity/recent-commits"> - {{ctx.Locale.Tr "repo.activity.navbar.recent_commits"}} - </a> + {{if $canReadCode}} + <a class="{{if .PageIsContributors}}active {{end}}item" href="{{.RepoLink}}/activity/contributors"> + {{ctx.Locale.Tr "repo.activity.navbar.contributors"}} + </a> + <a class="{{if .PageIsCodeFrequency}}active{{end}} item" href="{{.RepoLink}}/activity/code-frequency"> + {{ctx.Locale.Tr "repo.activity.navbar.code_frequency"}} + </a> + <a class="{{if .PageIsRecentCommits}}active{{end}} item" href="{{.RepoLink}}/activity/recent-commits"> + {{ctx.Locale.Tr "repo.activity.navbar.recent_commits"}} + </a> + {{end}} </div> diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl index 05ad7264bf..1acaaf8b4b 100644 --- a/templates/repo/projects/view.tmpl +++ b/templates/repo/projects/view.tmpl @@ -2,14 +2,13 @@ <div role="main" aria-label="{{.Title}}" class="page-content repository projects view-project"> {{template "repo/header" .}} <div class="ui container padded"> - <div class="tw-flex tw-justify-between tw-items-center tw-mb-4"> - {{template "repo/issue/navbar" .}} + <div class="flex-text-block tw-justify-end tw-mb-4"> + <a class="ui small button" href="{{.RepoLink}}/labels">{{ctx.Locale.Tr "repo.labels"}}</a> + <a class="ui small button" href="{{.RepoLink}}/milestones">{{ctx.Locale.Tr "repo.milestones"}}</a> <a class="ui small primary button" href="{{.RepoLink}}/issues/new/choose?project={{.Project.ID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a> </div> </div> - <div class="ui container fluid padded"> - {{template "projects/view" .}} - </div> + {{template "projects/view" .}} </div> {{template "base/footer" .}} diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl index 7af535f1d3..0d775ed6a0 100644 --- a/templates/repo/pulls/fork.tmpl +++ b/templates/repo/pulls/fork.tmpl @@ -1,85 +1,83 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content repository new fork"> - <div class="ui middle very relaxed page grid"> - <div class="column"> - <form class="ui form" action="{{.Link}}" method="post"> + <div class="ui container medium-width"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "new_fork"}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <form class="ui form form-fetch-action left-right-form" action="{{.Link}}" method="post"> {{.CsrfTokenHtml}} - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "new_fork"}} - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <div class="inline required field {{if .Err_Owner}}error{{end}}"> - <label>{{ctx.Locale.Tr "repo.owner"}}</label> - <div class="ui selection owner dropdown"> - <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> - <span class="text truncated-item-container" title="{{.ContextUser.Name}}"> - {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> - </span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - {{if .CanForkToUser}} - <div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> - {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> - </div> - {{end}} - {{range .Orgs}} - <div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}"> - {{ctx.AvatarUtils.Avatar . 28 "mini"}} - <span class="truncated-item-name">{{.ShortName 40}}</span> - </div> - {{end}} - </div> + <div class="inline required field {{if .Err_Owner}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.owner"}}</label> + <div class="ui selection owner dropdown ellipsis-text-items"> + <input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required> + <span class="text" title="{{.ContextUser.Name}}"> + {{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}} + {{.ContextUser.ShortName 40}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{if .CanForkToUser}} + <div class="item" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}} + {{.SignedUser.ShortName 40}} + </div> + {{end}} + {{range .Orgs}} + <div class="item" data-value="{{.ID}}" title="{{.Name}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + {{.ShortName 40}} + </div> + {{end}} </div> </div> + </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.fork_from"}}</label> - <a href="{{.ForkRepo.Link}}" class="tw-inline-block">{{.ForkRepo.FullName}}</a> - </div> - <div class="inline required field {{if .Err_RepoName}}error{{end}}"> - <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> - <input id="repo_name" name="repo_name" value="{{.repo_name}}" required> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.fork_from"}}</label> + <a href="{{.ForkRepo.Link}}" class="tw-inline-block">{{.ForkRepo.FullName}}</a> + </div> + <div class="inline required field {{if .Err_RepoName}}error{{end}}"> + <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input id="repo_name" name="repo_name" value="{{.repo_name}}" required> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui disabled checkbox"> + <input type="checkbox" disabled {{if .IsPrivate}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.visibility"}}</label> - <div class="ui disabled checkbox"> - <input type="checkbox" disabled {{if .IsPrivate}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.fork_visibility_helper"}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.fork_branch"}}</label> + <div class="ui selection dropdown ellipsis-text-items"> + <input type="hidden" id="fork_single_branch" name="fork_single_branch" value="" required> + <div class="text" title="{{ctx.Locale.Tr "repo.all_branches"}}"> + {{ctx.Locale.Tr "repo.all_branches"}} </div> - <span class="help">{{ctx.Locale.Tr "repo.fork_visibility_helper"}}</span> - </div> - <div class="inline field"> - <label>{{ctx.Locale.Tr "repo.fork_branch"}}</label> - <div class="ui selection dropdown ellipsis-items-nowrap"> - <input type="hidden" id="fork_single_branch" name="fork_single_branch" value="" required> - <div class="text" title="{{ctx.Locale.Tr "repo.all_branches"}}"> - <span class="truncated-item-name">{{ctx.Locale.Tr "repo.all_branches"}}</span> - </div> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu"> - <div class="item" data-value="" title="{{ctx.Locale.Tr "repo.all_branches"}}"> - {{ctx.Locale.Tr "repo.all_branches"}} - </div> - {{range .Branches}} - <div class="item" data-value="{{.}}" title="{{.}}">{{.}}</div> - {{end}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="" title="{{ctx.Locale.Tr "repo.all_branches"}}"> + {{ctx.Locale.Tr "repo.all_branches"}} </div> + {{range .Branches}} + <div class="item" data-value="{{.}}" title="{{.}}">{{.}}</div> + {{end}} </div> </div> - <div class="inline field {{if .Err_Description}}error{{end}}"> - <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> - <textarea id="description" name="description">{{.description}}</textarea> - </div> + </div> + <div class="inline field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description">{{.description}}</textarea> + </div> - <div class="inline field"> - <label></label> - <button class="ui primary button{{if not .CanForkRepo}} disabled{{end}}"> - {{ctx.Locale.Tr "repo.fork_repo"}} - </button> - </div> + <div class="inline field"> + <label></label> + <button class="ui primary button{{if not .CanForkRepoInNewOwner}} disabled{{end}}"> + {{ctx.Locale.Tr "repo.fork_repo"}} + </button> </div> </form> </div> diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl index 8b192c44db..a0ecdf96cd 100644 --- a/templates/repo/pulls/tab_menu.tmpl +++ b/templates/repo/pulls/tab_menu.tmpl @@ -15,11 +15,11 @@ {{template "shared/misc/tabtitle" (ctx.Locale.Tr "repo.pulls.tab_files")}} <span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span> </a> - {{if or .Diff.TotalAddition .Diff.TotalDeletion}} + {{if or .DiffShortStat.TotalAddition .DiffShortStat.TotalDeletion}} <span class="tw-ml-auto tw-pl-3 tw-whitespace-nowrap tw-pr-0 tw-font-bold tw-flex tw-items-center tw-gap-2"> - <span><span class="text green">{{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}}</span> <span class="text red">{{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}</span></span> + <span><span class="text green">{{if .DiffShortStat.TotalAddition}}+{{.DiffShortStat.TotalAddition}}{{end}}</span> <span class="text red">{{if .DiffShortStat.TotalDeletion}}-{{.DiffShortStat.TotalDeletion}}{{end}}</span></span> <span class="diff-stats-bar"> - <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div> + <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .DiffShortStat.TotalAddition "/" "(" .DiffShortStat.TotalAddition "+" .DiffShortStat.TotalDeletion "+" 0.0 ")"}}%"></div> </span> </span> {{end}} diff --git a/templates/repo/pulse.tmpl b/templates/repo/pulse.tmpl index 5222633507..cbafee9ba9 100644 --- a/templates/repo/pulse.tmpl +++ b/templates/repo/pulse.tmpl @@ -1,12 +1,12 @@ <h2 class="ui header activity-header"> <span>{{DateUtils.AbsoluteLong .DateFrom}} - {{DateUtils.AbsoluteLong .DateUntil}}</span> <!-- Period --> - <div class="ui floating dropdown jump filter"> + <div class="ui floating dropdown jump"> <div class="ui basic compact button"> {{ctx.Locale.Tr "repo.activity.period.filter_label"}} <strong>{{.PeriodText}}</strong> {{svg "octicon-triangle-down" 14 "dropdown icon"}} </div> - <div class="menu"> + <div class="left menu"> <a class="{{if eq .Period "daily"}}active {{end}}item" href="{{$.RepoLink}}/activity/daily">{{ctx.Locale.Tr "repo.activity.period.daily"}}</a> <a class="{{if eq .Period "halfweekly"}}active {{end}}item" href="{{$.RepoLink}}/activity/halfweekly">{{ctx.Locale.Tr "repo.activity.period.halfweekly"}}</a> <a class="{{if eq .Period "weekly"}}active {{end}}item" href="{{$.RepoLink}}/activity/weekly">{{ctx.Locale.Tr "repo.activity.period.weekly"}}</a> @@ -49,7 +49,7 @@ </div> {{else}} <div class="stats-table"> - <a class="table-cell tiny background light grey"></a> + <a class="table-cell tiny tw-bg-grey"></a> </div> {{end}} {{ctx.Locale.TrN .Activity.ActiveIssueCount "repo.activity.active_issues_count_1" "repo.activity.active_issues_count_n" .Activity.ActiveIssueCount}} @@ -82,7 +82,7 @@ {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}} {{if eq .Activity.Code.CommitCountInAllBranches 0}} - <div class="ui center aligned segment"> + <div class="ui tw-text-center segment"> <h4 class="ui header">{{ctx.Locale.Tr "repo.activity.no_git_activity"}}</h4> </div> {{end}} diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 99934d2118..882ffe40b7 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -21,10 +21,11 @@ {{$compareTarget = $release.Sha1}} {{end}} {{template "repo/branch_dropdown" dict + "ContainerClasses" "release-branch-tag-selector" "Repository" $.Repository "ShowTabTags" true "DropdownFixedText" (ctx.Locale.Tr "repo.release.compare") - "RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}..." (PathEscapeSegments $compareTarget)) + "RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}" "..." (PathEscapeSegments $compareTarget)) }} {{end}} </div> @@ -49,7 +50,11 @@ {{svg (MigrationIcon $release.Repo.GetOriginalURLHostname) 20 "tw-mr-1"}}{{$release.OriginalAuthor}} {{else if $release.Publisher}} {{ctx.AvatarUtils.Avatar $release.Publisher 20 "tw-mr-1"}} - <a href="{{$release.Publisher.HomeLink}}">{{$release.Publisher.GetDisplayName}}</a> + {{if gt $release.PublisherID 0}} + <a href="{{$release.Publisher.HomeLink}}">{{$release.Publisher.GetDisplayName}}</a> + {{else}} + {{$release.Publisher.GetDisplayName}} + {{end}} {{else}} Ghost {{end}} @@ -60,11 +65,11 @@ {{if $release.CreatedUnix}} <span class="time">{{DateUtils.TimeSince $release.CreatedUnix}}</span> {{end}} - {{if and (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} + {{if and (gt $release.NumCommits 0) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} | <span class="ahead"><a href="{{$.RepoLink}}/compare/{{$release.TagName | PathEscapeSegments}}...{{$release.TargetBehind | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.release.ahead.commits" $release.NumCommitsBehind}}</a> {{ctx.Locale.Tr "repo.release.ahead.target" $release.TargetBehind}}</span> {{end}} </p> - <div class="markup desc"> + <div class="render-content markup"> {{$release.RenderedNote}} </div> <div class="divider"></div> @@ -72,25 +77,31 @@ <summary> {{ctx.Locale.Tr "repo.release.downloads"}} </summary> - <ul class="list"> + <ul class="ui divided list attachment-list"> {{if and (not $.DisableDownloadSourceArchives) (not $release.IsDraft) ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}} - <li> - <a class="archive-link" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong></a> + <li class="item"> + <a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow"> + <strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong> + </a> </li> - <li> - <a class="archive-link" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong></a> + <li class="item"> + <a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"> + <strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "download-icon"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong> + </a> </li> {{end}} - {{range $release.Attachments}} - <li> - <a target="_blank" rel="nofollow" href="{{.DownloadURL}}" download> - <strong>{{svg "octicon-package" 16 "download-icon"}}{{.Name}}</strong> + {{range $att := $release.Attachments}} + <li class="item"> + <a target="_blank" class="tw-flex-1 gt-ellipsis" rel="nofollow" download href="{{$att.DownloadURL}}"> + <strong class="flex-text-inline">{{svg "octicon-package" 16 "download-icon"}}<span class="gt-ellipsis">{{$att.Name}}</span></strong> </a> - <div> - <span class="text grey">{{.Size | FileSize}}</span> - <span data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber .DownloadCount)}}"> + <div class="attachment-right-info flex-text-inline"> + <span class="tw-pl-5">{{$att.Size | FileSize}}</span> + <span class="flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber $att.DownloadCount)}}"> {{svg "octicon-info"}} </span> + <div class="tw-flex-1"></div> + {{DateUtils.TimeSince $att.CreatedUnix}} </div> </li> {{end}} diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index 574b0d0311..109a18fa0e 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -100,32 +100,26 @@ </div> <span class="help">{{ctx.Locale.Tr "repo.release.prerelease_helper"}}</span> <div class="divider tw-mt-0"></div> - <div class="tw-flex tw-justify-end"> + <div class="flex-text-block tw-justify-end"> {{if .PageIsEditRelease}} <a class="ui small button" href="{{.RepoLink}}/releases"> {{ctx.Locale.Tr "repo.release.cancel"}} </a> - <a class="ui small red button delete-button" data-url="{{$.RepoLink}}/releases/delete" data-id="{{.ID}}"> + <a class="ui small red button link-action" data-modal-confirm="#repo-release-delete-modal" data-url="{{$.RepoLink}}/releases/delete?id={{.ID}}"> {{ctx.Locale.Tr "repo.release.delete_release"}} </a> {{if .IsDraft}} - <button class="ui small button" type="submit" name="draft" value="{{ctx.Locale.Tr "repo.release.save_draft"}}">{{ctx.Locale.Tr "repo.release.save_draft"}}</button> - <button class="ui small primary button"> - {{ctx.Locale.Tr "repo.release.publish"}} - </button> + <button class="ui small button" type="submit" name="draft" value="1">{{ctx.Locale.Tr "repo.release.save_draft"}}</button> + <button class="ui small primary button">{{ctx.Locale.Tr "repo.release.publish"}}</button> {{else}} - <button class="ui small primary button"> - {{ctx.Locale.Tr "repo.release.edit_release"}} - </button> + <button class="ui small primary button">{{ctx.Locale.Tr "repo.release.edit_release"}}</button> {{end}} {{else}} - {{if not .tag_name}} + {{if .ShowCreateTagOnlyButton}} <button class="ui small button" name="tag_only" value="1">{{ctx.Locale.Tr "repo.release.add_tag"}}</button> {{end}} <button class="ui small button" name="draft" value="1">{{ctx.Locale.Tr "repo.release.save_draft"}}</button> - <button class="ui small primary button"> - {{ctx.Locale.Tr "repo.release.publish"}} - </button> + <button class="ui small primary button">{{ctx.Locale.Tr "repo.release.publish"}}</button> {{end}} </div> </div> @@ -135,15 +129,11 @@ </div> {{if .PageIsEditRelease}} - <div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.release.deletion"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.release.deletion_desc"}}</p> - </div> + <div class="ui small modal" id="repo-release-delete-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.release.deletion"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.release.deletion_desc"}}</p></div> {{template "base/modal_actions_confirm" .}} </div> {{end}} + {{template "base/footer" .}} diff --git a/templates/repo/release_tag_header.tmpl b/templates/repo/release_tag_header.tmpl index f96c76864f..12acf4bfeb 100644 --- a/templates/repo/release_tag_header.tmpl +++ b/templates/repo/release_tag_header.tmpl @@ -2,7 +2,7 @@ {{$canReadCode := $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} {{if $canReadReleases}} - <div class="tw-flex"> + <div class="flex-text-block"> <div class="tw-flex-1 tw-flex tw-items-center"> <h2 class="ui compact small menu small-menu-items"> <a class="{{if and .PageIsReleaseList (not .PageIsSingleTag)}}active {{end}}item" href="{{.RepoLink}}/releases">{{ctx.Locale.PrettyNumber .NumReleases}} {{ctx.Locale.TrN .NumReleases "repo.release" "repo.releases"}}</a> @@ -17,7 +17,7 @@ </a> {{end}} {{if and (not .PageIsTagList) .CanCreateRelease}} - <a class="ui small primary button" href="{{$.RepoLink}}/releases/new{{if .PageIsSingleTag}}?tag={{.TagName}}{{end}}"> + <a class="ui small primary button" href="{{$.RepoLink}}/releases/new{{if .PageIsSingleTag}}?tag={{.SingleReleaseTagName}}{{end}}"> {{ctx.Locale.Tr "repo.release.new_release"}} </a> {{end}} diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl index 57d9f2c5a8..e8e7a3f1c2 100644 --- a/templates/repo/settings/branches.tmpl +++ b/templates/repo/settings/branches.tmpl @@ -49,14 +49,14 @@ </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}}"> + <a class="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 link-action" data-modal-confirm="#repo-branch-protection-delete-modal" data-url="{{$.Repository.Link}}/settings/branches/{{.ID}}/delete?id={{.ID}}"> {{ctx.Locale.Tr "repo.settings.protected_branch.delete_rule"}} </button> </div> </div> {{else}} - <div class="flex-item center aligned"> + <div class="flex-item tw-text-center"> {{ctx.Locale.Tr "repo.settings.no_protected_branch"}} </div> {{end}} @@ -65,14 +65,9 @@ {{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> +<div class="ui small modal" id="repo-branch-protection-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> diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl index 9f90f0a2b9..62903e1cfb 100644 --- a/templates/repo/settings/collaboration.tmpl +++ b/templates/repo/settings/collaboration.tmpl @@ -29,7 +29,7 @@ </div> </div> </div> - <button class="ui red tiny button inline delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + <button class="ui red tiny button link-action" data-modal-confirm="#repo-collaborator-delete-modal" data-url="{{$.Link}}/delete?id={{.ID}}"> {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} </button> </div> @@ -48,69 +48,84 @@ </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}} + {{if $.Repository.Owner.IsOrganization}} + <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"> + {{/*FIXME: TEAM-UNIT-PERMISSION this display is not right, search the fixme keyword to see more details */}} + {{svg "octicon-shield-lock"}} + {{if eq .AccessMode 0}} + {{ctx.Locale.Tr "repo.settings.collaboration.per_unit"}} + {{else 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 0) (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"}}"> + Units: + {{range $u, $unit := $.Units}} + {{- if and ($.Repo.UnitEnabled ctx $unit.Type) ($team.UnitEnabled ctx $unit.Type) -}} + {{- Iif $first "" ", "}}{{ctx.Locale.Tr $unit.NameKey -}} + {{- $first = false -}} + {{- end -}} + {{end}} + {{if $first}}None{{end}} + </div> + {{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 ctx $unit.Type) ($team.UnitEnabled ctx $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{ctx.Locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}} + {{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 link-action {{if .IncludesAllRepositories}}disabled{{end}}" data-modal-confirm="#repo-collaborator-delete-modal" data-url="{{$.Link}}/team/delete?id={{.ID}}"> + {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} + </button> </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}} + {{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" 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> - </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> +<div class="ui small modal" id="repo-collaborator-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> diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index 5eb2a47e5a..b82d584b22 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -59,7 +59,7 @@ </div> </div> <div class="flex-item-trailing"> - <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + <button class="ui red tiny button link-action" data-modal-confirm="#repo-deploy-key-delete-modal" data-url="{{$.Link}}/delete?id={{.ID}}"> {{ctx.Locale.Tr "settings.delete_key"}} </button> </div> @@ -72,14 +72,9 @@ </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> +<div class="ui small modal" id="repo-deploy-key-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> diff --git a/templates/repo/settings/githooks.tmpl b/templates/repo/settings/githooks.tmpl index 1a603f9fe8..9b17af1406 100644 --- a/templates/repo/settings/githooks.tmpl +++ b/templates/repo/settings/githooks.tmpl @@ -4,18 +4,14 @@ {{ctx.Locale.Tr "repo.settings.githooks"}} </h4> <div class="ui attached segment"> - <div class="ui list"> + <div class="ui list flex-items-block"> + <div class="item"><span>{{ctx.Locale.Tr "repo.settings.githooks_desc"}}</span></div> + {{range .Hooks}} <div class="item"> - {{ctx.Locale.Tr "repo.settings.githooks_desc"}} + <span class="text {{if .IsActive}}green{{else}}grey{{end}}">{{svg "octicon-dot-fill" 22}}</span> + <span class="gt-ellipsis tw-flex-1">{{.Name}}</span> + <a class="muted tw-p-2" href="{{$.RepoLink}}/settings/hooks/git/{{.Name|PathEscape}}">{{svg "octicon-pencil"}}</a> </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> diff --git a/templates/repo/settings/lfs.tmpl b/templates/repo/settings/lfs.tmpl index c1878d2853..4b46aeed95 100644 --- a/templates/repo/settings/lfs.tmpl +++ b/templates/repo/settings/lfs.tmpl @@ -12,13 +12,13 @@ {{range .LFSFiles}} <tr> <td> - <a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui brown button tw-font-mono"> + <a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui button tw-font-mono"> {{ShortSha .Oid}} </a> </td> <td>{{FileSize .Size}}</td> <td>{{DateUtils.TimeSince .CreatedUnix}}</td> - <td class="right aligned"> + <td class="tw-text-right"> <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> diff --git a/templates/repo/settings/lfs_file.tmpl b/templates/repo/settings/lfs_file.tmpl index f6fac05b69..cd1b168401 100644 --- a/templates/repo/settings/lfs_file.tmpl +++ b/templates/repo/settings/lfs_file.tmpl @@ -13,7 +13,7 @@ </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}}"> + <div class="file-view {{if .IsPlainText}}plain-text{{else if .IsTextFile}}code-view{{end}}"> {{if .IsFileTooLarge}} {{template "shared/filetoolarge" dict "RawFileLink" .RawFileLink}} {{else if not .FileSize}} @@ -21,7 +21,7 @@ {{else if not .IsTextFile}} <div class="view-raw"> {{if .IsImageFile}} - <img src="{{$.RawFileLink}}"> + <img loading="lazy" alt="{{$.RawFileLink}}" src="{{$.RawFileLink}}"> {{else if .IsVideoFile}} <video controls src="{{$.RawFileLink}}"> <strong>{{ctx.Locale.Tr "repo.video_not_supported_in_browser"}}</strong> @@ -30,8 +30,6 @@ <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" class="tw-p-4">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> {{end}} diff --git a/templates/repo/settings/lfs_locks.tmpl b/templates/repo/settings/lfs_locks.tmpl index 64c6b3a550..dfbae0633e 100644 --- a/templates/repo/settings/lfs_locks.tmpl +++ b/templates/repo/settings/lfs_locks.tmpl @@ -36,7 +36,7 @@ </a> </td> <td>{{DateUtils.TimeSince .Created}}</td> - <td class="right aligned"> + <td class="tw-text-right"> <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> diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl index 3e127ccbb3..3dd86d1f6a 100644 --- a/templates/repo/settings/navbar.tmpl +++ b/templates/repo/settings/navbar.tmpl @@ -4,6 +4,11 @@ <a class="{{if .PageIsSettingsOptions}}active {{end}}item" href="{{.RepoLink}}/settings"> {{ctx.Locale.Tr "repo.settings.options"}} </a> + {{if or .Repository.IsPrivate .Permission.HasAnyUnitPublicAccess}} + <a class="{{if .PageIsSettingsPublicAccess}}active {{end}}item" href="{{.RepoLink}}/settings/public_access"> + {{ctx.Locale.Tr "repo.settings.public_access"}} + </a> + {{end}} <a class="{{if .PageIsSettingsCollaboration}}active {{end}}item" href="{{.RepoLink}}/settings/collaboration"> {{ctx.Locale.Tr "repo.settings.collaboration"}} </a> diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 21eaf6a651..fc42056e0a 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -10,7 +10,7 @@ <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> + <input name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" required> </div> <div class="inline field"> <label>{{ctx.Locale.Tr "repo.repo_size"}}</label> @@ -40,8 +40,7 @@ <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"> + {{template "shared/avatar_upload_crop" dict "LabelText" (ctx.Locale.Tr "settings.choose_new_avatar")}} </div> <div class="field"> <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button> @@ -118,7 +117,7 @@ <td>{{.PullMirror.RemoteAddress}}</td> <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td> <td>{{DateUtils.FullTime .PullMirror.UpdatedUnix}}</td> - <td class="right aligned"> + <td class="tw-text-right"> <form method="post" class="tw-inline-block"> {{.CsrfTokenHtml}} <input type="hidden" name="action" value="mirror-sync"> @@ -204,9 +203,18 @@ {{range .PushMirrors}} <tr> <td class="tw-break-anywhere">{{.RemoteAddress}}</td> - <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td> - <td>{{if .LastUpdateUnix}}{{DateUtils.FullTime .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"> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}} ({{.Interval}})</td> + <td> + <span class="flex-text-block"> + {{if .LastUpdateUnix}} + {{DateUtils.FullTime .LastUpdateUnix}} + {{else}} + {{ctx.Locale.Tr "never"}} + {{end}} + {{if .LastError}}<span class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</span>{{end}} + </span> + </td> + <td class="tw-text-right"> <button class="ui tiny button show-modal" data-modal="#push-mirror-edit-modal" @@ -329,16 +337,6 @@ <label>{{ctx.Locale.Tr "repo.settings.default_wiki_branch_name"}}</label> <input name="default_wiki_branch" value="{{.Repository.DefaultWikiBranch}}"> </div> - <div class="inline field"> - {{$unitInternalWiki := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeWiki}} - <label>{{ctx.Locale.Tr "repo.settings.default_wiki_everyone_access"}}</label> - <select name="default_wiki_everyone_access" class="ui selection dropdown"> - {{/* everyone access mode is different from others, none means it is unset and won't be applied */}} - <option value="none" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 0) "selected"}}>{{ctx.Locale.Tr "settings.permission_not_set"}}</option> - <option value="read" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 1) "selected"}}>{{ctx.Locale.Tr "settings.permission_read"}}</option> - <option value="write" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 2) "selected"}}>{{ctx.Locale.Tr "settings.permission_write"}}</option> - </select> - </div> </div> <div class="field"> <div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> @@ -804,7 +802,7 @@ </div> </div> {{end}} - {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + {{if .CanConvertFork}} <div class="flex-item"> <div class="flex-item-main"> <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</div> @@ -910,7 +908,7 @@ <input name="repo_name" required maxlength="100"> </div> - <div class="text right actions"> + <div class="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> @@ -918,7 +916,7 @@ </div> </div> {{end}} - {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + {{if .CanConvertFork}} <div class="ui small modal" id="convert-fork-repo-modal"> <div class="header"> {{ctx.Locale.Tr "repo.settings.convert_fork"}} @@ -941,7 +939,7 @@ <input name="repo_name" required> </div> - <div class="text right actions"> + <div class="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> @@ -978,7 +976,7 @@ <input id="new_owner_name" name="new_owner_name" required> </div> - <div class="text right actions"> + <div class="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> @@ -1012,7 +1010,7 @@ <input id="repo_name_to_delete" name="repo_name" required> </div> - <div class="text right actions"> + <div class="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> @@ -1072,7 +1070,7 @@ <input name="repo_name" required> </div> - <div class="text right actions"> + <div class="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> diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 61cc6077a1..3c311c18c3 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -2,13 +2,17 @@ <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}} + {{if .Rule.RuleName}} + {{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}} + {{else}} + {{ctx.Locale.Tr "repo.settings.branches.add_new_rule"}} + {{end}} </h4> <div class="ui attached segment branch-protection"> <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.protect_patterns"}}</h5> - <div class="field"> + <div class="field required"> <label>{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern"}}</label> - <input name="rule_name" type="text" value="{{.Rule.RuleName}}"> + <input name="rule_name" type="text" value="{{.Rule.RuleName}}" required> <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" "https://github.com/gobwas/glob"}}</p> </div> diff --git a/templates/repo/settings/public_access.tmpl b/templates/repo/settings/public_access.tmpl new file mode 100644 index 0000000000..c1c198bcce --- /dev/null +++ b/templates/repo/settings/public_access.tmpl @@ -0,0 +1,54 @@ +{{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.public_access"}} + </h4> + <div class="ui attached segment"> + <p> + {{ctx.Locale.Tr "repo.settings.public_access_desc"}} + </p> + {{$paNotSet := "not-set"}} + {{$paAnonymousRead := "anonymous-read"}} + {{$paEveryoneRead := "everyone-read"}} + {{$paEveryoneWrite := "everyone-write"}} + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <table class="ui table unstackable tw-my-2"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "units.unit"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_not_set"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_anonymous_read"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_everyone_read"}}</th> + <th class="tw-text-center">{{ctx.Locale.Tr "settings.permission_everyone_write"}}</th> + </tr> + </thead> + <tbody> + {{range $ua := .RepoUnitPublicAccesses}} + <tr> + <td>{{$ua.DisplayName}}</td> + <td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paNotSet}}" {{Iif (eq $paNotSet $ua.UnitPublicAccess) "checked"}}></label></td> + <td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paAnonymousRead}}" {{Iif (eq $paAnonymousRead $ua.UnitPublicAccess) "checked"}}></label></td> + <td class="tw-text-center"><label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneRead}}" {{Iif (eq $paEveryoneRead $ua.UnitPublicAccess) "checked"}}></label></td> + <td class="tw-text-center"> + {{if SliceUtils.Contains $ua.PublicAccessTypes $paEveryoneWrite}} + <label><input type="radio" name="{{$ua.FormKey}}" value="{{$paEveryoneWrite}}" {{Iif (eq $paEveryoneWrite $ua.UnitPublicAccess) "checked"}}></label> + {{else}} + - + {{end}} + </td> + </tr> + {{end}} + </tbody> + </table> + <ul class="tw-my-3 tw-pl-5 tw-flex tw-flex-col tw-gap-3"> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.not_set"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.anonymous_read"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.everyone_read"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.public_access.docs.everyone_write"}}</li> + </ul> + <button class="ui primary button {{if .GlobalForcePrivate}}disabled{{end}}">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </form> + </div> +</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 index e8dad61a48..3bd624fab7 100644 --- a/templates/repo/settings/push_mirror_sync_modal.tmpl +++ b/templates/repo/settings/push_mirror_sync_modal.tmpl @@ -2,31 +2,27 @@ <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> + <form class="content 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>{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label> + <span id="push-mirror-edit-address"></span> + </div> + <div class="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" class="tw-w-auto"> + </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> diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 27b0f519a8..12ec9102b7 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -104,7 +104,7 @@ {{ctx.Locale.Tr "repo.settings.tags.protection.allowed.noone"}} {{end}} </td> - <td class="right aligned"> + <td class="tw-text-right"> <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}} @@ -114,7 +114,7 @@ </td> </tr> {{else}} - <tr class="center aligned"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr> + <tr class="tw-text-center"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr> {{end}} </tbody> </table> diff --git a/templates/repo/settings/webhook/base.tmpl b/templates/repo/settings/webhook/base.tmpl index d524722454..39bb7a9fe0 100644 --- a/templates/repo/settings/webhook/base.tmpl +++ b/templates/repo/settings/webhook/base.tmpl @@ -1,5 +1,5 @@ {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings webhooks")}} <div class="repo-setting-content"> - {{template "repo/settings/webhook/list" .}} + {{template "repo/settings/webhook/base_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 index 36e75a7eb5..a808d4122f 100644 --- a/templates/repo/settings/webhook/base_list.tmpl +++ b/templates/repo/settings/webhook/base_list.tmpl @@ -8,18 +8,19 @@ </div> </h4> <div class="ui attached segment"> - <div class="ui list"> - <div class="item"> - {{.Description}} - </div> + <div class="ui list flex-items-block"> + <div class="item"><span>{{.Description}}</span></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"> + <div class="item"> + <span class="text {{if eq .LastStatus 1}}green{{else if eq .LastStatus 2}}red{{else}}grey{{end}}">{{svg "octicon-dot-fill" 22}}</span> + <div class="gt-ellipsis tw-flex-1"> <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> + <a class="text red tw-p-2 link-action" + data-url="{{$.Link}}/delete?id={{.ID}}" + data-modal-confirm="{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}" + >{{svg "octicon-trash"}}</a> </div> {{end}} </div> diff --git a/templates/repo/settings/webhook/delete_modal.tmpl b/templates/repo/settings/webhook/delete_modal.tmpl deleted file mode 100644 index 9955ed3a2f..0000000000 --- a/templates/repo/settings/webhook/delete_modal.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -<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/dingtalk.tmpl b/templates/repo/settings/webhook/dingtalk.tmpl index 0ba99e98ee..dd208cde17 100644 --- a/templates/repo/settings/webhook/dingtalk.tmpl +++ b/templates/repo/settings/webhook/dingtalk.tmpl @@ -6,6 +6,7 @@ <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/discord.tmpl b/templates/repo/settings/webhook/discord.tmpl index 104346e042..fa66249fa5 100644 --- a/templates/repo/settings/webhook/discord.tmpl +++ b/templates/repo/settings/webhook/discord.tmpl @@ -14,6 +14,7 @@ <label for="icon_url">{{ctx.Locale.Tr "repo.settings.discord_icon_url"}}</label> <input id="icon_url" name="icon_url" value="{{.DiscordHook.IconURL}}" placeholder="https://example.com/assets/img/logo.svg"> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/feishu.tmpl b/templates/repo/settings/webhook/feishu.tmpl index d80deab26f..13bd0d92a1 100644 --- a/templates/repo/settings/webhook/feishu.tmpl +++ b/templates/repo/settings/webhook/feishu.tmpl @@ -1,12 +1,14 @@ {{if eq .HookType "feishu"}} - <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}}</p> - <p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}}</p> + <p> + {{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu")}} + {{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite")}} + </p> <form class="ui form" action="{{.BaseLink}}/feishu/{{or .Webhook.ID "new"}}" method="post"> {{.CsrfTokenHtml}} <div class="required field {{if .Err_PayloadURL}}error{{end}}"> <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseRequestSecret" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/gitea.tmpl b/templates/repo/settings/webhook/gitea.tmpl index e6eb61ea92..30f14d609b 100644 --- a/templates/repo/settings/webhook/gitea.tmpl +++ b/templates/repo/settings/webhook/gitea.tmpl @@ -31,10 +31,11 @@ </div> </div> </div> - <div class="field {{if .Err_Secret}}error{{end}}"> - <label for="secret">{{ctx.Locale.Tr "repo.settings.secret"}}</label> - <input id="secret" name="secret" type="password" value="{{.Webhook.Secret}}" autocomplete="off"> - </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict + "BaseLink" .BaseLink + "Webhook" .Webhook + "UseAuthorizationHeader" "optional" + "UseRequestSecret" "optional" + }} </form> {{end}} diff --git a/templates/repo/settings/webhook/gogs.tmpl b/templates/repo/settings/webhook/gogs.tmpl index e91a3279e4..c0e054602a 100644 --- a/templates/repo/settings/webhook/gogs.tmpl +++ b/templates/repo/settings/webhook/gogs.tmpl @@ -19,10 +19,11 @@ </div> </div> </div> - <div class="field {{if .Err_Secret}}error{{end}}"> - <label for="secret">{{ctx.Locale.Tr "repo.settings.secret"}}</label> - <input id="secret" name="secret" type="password" value="{{.Webhook.Secret}}" autocomplete="off"> - </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict + "BaseLink" .BaseLink + "Webhook" .Webhook + "UseAuthorizationHeader" "optional" + "UseRequestSecret" "optional" + }} </form> {{end}} diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl index ea3c037813..953ba69670 100644 --- a/templates/repo/settings/webhook/history.tmpl +++ b/templates/repo/settings/webhook/history.tmpl @@ -26,7 +26,7 @@ {{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> + <button class="btn interact-bg tw-p-2 toggle show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</button> </div> <span class="text grey"> {{DateUtils.TimeSince .Delivered}} diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl deleted file mode 100644 index b24159fccb..0000000000 --- a/templates/repo/settings/webhook/list.tmpl +++ /dev/null @@ -1,4 +0,0 @@ - -{{template "repo/settings/webhook/base_list" .}} - -{{template "repo/settings/webhook/delete_modal" .}} diff --git a/templates/repo/settings/webhook/matrix.tmpl b/templates/repo/settings/webhook/matrix.tmpl index 7f1c9f08e6..e0aad2d807 100644 --- a/templates/repo/settings/webhook/matrix.tmpl +++ b/templates/repo/settings/webhook/matrix.tmpl @@ -22,6 +22,6 @@ </div> </div> </div> - {{template "repo/settings/webhook/settings" .}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "required"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/msteams.tmpl b/templates/repo/settings/webhook/msteams.tmpl index 62ea24e763..17718a1064 100644 --- a/templates/repo/settings/webhook/msteams.tmpl +++ b/templates/repo/settings/webhook/msteams.tmpl @@ -6,6 +6,7 @@ <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/packagist.tmpl b/templates/repo/settings/webhook/packagist.tmpl index 25aba2a435..c813e7c2af 100644 --- a/templates/repo/settings/webhook/packagist.tmpl +++ b/templates/repo/settings/webhook/packagist.tmpl @@ -14,6 +14,7 @@ <label for="package_url">{{ctx.Locale.Tr "repo.settings.packagist_package_url"}}</label> <input id="package_url" name="package_url" value="{{.PackagistHook.PackageURL}}" placeholder="https://packagist.org/packages/laravel/framework" required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/settings.tmpl b/templates/repo/settings/webhook/settings.tmpl index cf3b0eb053..a8ad1d6c9e 100644 --- a/templates/repo/settings/webhook/settings.tmpl +++ b/templates/repo/settings/webhook/settings.tmpl @@ -1,4 +1,52 @@ -{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}} +{{/* Template attributes: +- BaseLink: Base URL for the repository settings +- WebHook: Webhook object containing details about the webhook +- UseAuthorizationHeader: optional or required +- UseRequestSecret: optional or required +*/}} +{{$isNew := not .Webhook.ID}} + +<div class="inline field"> + <div class="ui checkbox"> + <input name="active" type="checkbox" {{if or $isNew .Webhook.IsActive}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.active"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.active_helper"}}</span> + </div> +</div> + +<!-- Authorization Header --> +{{if .UseAuthorizationHeader}} + {{$attributeValid := or (eq .UseAuthorizationHeader "optional") (eq .UseAuthorizationHeader "required")}} + {{if not $attributeValid}}<div class="ui error message">Invalid UseAuthorizationHeader: {{.UseAuthorizationHeader}}}</div>{{end}} + {{$required := eq .UseAuthorizationHeader "required"}} + <div class="field {{if $required}}required{{end}}"> + <label>{{ctx.Locale.Tr "repo.settings.authorization_header"}}</label> + <input name="authorization_header" type="text" value="{{.Webhook.HeaderAuthorization}}" {{if $required}}required placeholder="Bearer $access_token"{{end}}> + {{if not $required}} + <span class="help">{{ctx.Locale.Tr "repo.settings.authorization_header_desc" (HTMLFormat "<code>%s</code>, <code>%s</code>" "Bearer token123456" "Basic YWxhZGRpbjpvcGVuc2VzYW1l")}}</span> + {{end}} + </div> +{{end}} + +<!-- Secret --> +{{if .UseRequestSecret}} + {{$attributeValid := or (eq .UseRequestSecret "optional") (eq .UseRequestSecret "required")}} + {{if not $attributeValid}}<div class="ui error message">Invalid UseRequestSecret: {{.UseRequestSecret}}}</div>{{end}} + {{$required := eq .UseRequestSecret "required"}} + <div class="field {{if $required}}required{{end}}"> + <label>{{ctx.Locale.Tr "repo.settings.secret"}}</label> + <input name="secret" type="password" value="{{.Webhook.Secret}}" autocomplete="off" {{if $required}}required{{end}}> + <span class="help">{{ctx.Locale.Tr "repo.settings.webhook_secret_desc"}}</span> + </div> +{{end}} + +<!-- Branch filter --> +<div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label> + <input name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}"> + <span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</span> +</div> + <div class="field"> <h4>{{ctx.Locale.Tr "repo.settings.event_desc"}}</h4> <div class="grouped event type fields"> @@ -31,7 +79,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="create" type="checkbox" {{if .Webhook.Create}}checked{{end}}> + <input name="create" type="checkbox" {{if .Webhook.HookEvents.Get "create"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_create"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_create_desc"}}</span> </div> @@ -41,7 +89,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="delete" type="checkbox" {{if .Webhook.Delete}}checked{{end}}> + <input name="delete" type="checkbox" {{if .Webhook.HookEvents.Get "delete"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_delete"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_delete_desc"}}</span> </div> @@ -51,7 +99,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="fork" type="checkbox" {{if .Webhook.Fork}}checked{{end}}> + <input name="fork" type="checkbox" {{if .Webhook.HookEvents.Get "fork"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_fork"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_fork_desc"}}</span> </div> @@ -61,7 +109,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="push" type="checkbox" {{if .Webhook.Push}}checked{{end}}> + <input name="push" type="checkbox" {{if .Webhook.HookEvents.Get "push"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_push"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_push_desc"}}</span> </div> @@ -71,7 +119,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="repository" type="checkbox" {{if .Webhook.Repository}}checked{{end}}> + <input name="repository" type="checkbox" {{if .Webhook.HookEvents.Get "repository"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_repository"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_repository_desc"}}</span> </div> @@ -81,7 +129,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="release" type="checkbox" {{if .Webhook.Release}}checked{{end}}> + <input name="release" type="checkbox" {{if .Webhook.HookEvents.Get "release"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_release"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_release_desc"}}</span> </div> @@ -91,7 +139,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="package" type="checkbox" {{if .Webhook.Package}}checked{{end}}> + <input name="package" type="checkbox" {{if .Webhook.HookEvents.Get "package"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_package"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_package_desc"}}</span> </div> @@ -102,13 +150,24 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="wiki" type="checkbox" {{if .Webhook.Wiki}}checked{{end}}> + <input name="wiki" type="checkbox" {{if .Webhook.HookEvents.Get "wiki"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_wiki"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_wiki_desc"}}</span> </div> </div> </div> + <!-- Status --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="status" type="checkbox" {{if .Webhook.HookEvents.Get "status"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_statuses"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.event_statuses_desc"}}</span> + </div> + </div> + </div> + <!-- Issue Events --> <div class="fourteen wide column"> <label>{{ctx.Locale.Tr "repo.settings.event_header_issue"}}</label> @@ -117,7 +176,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issues" type="checkbox" {{if .Webhook.Issues}}checked{{end}}> + <input name="issues" type="checkbox" {{if .Webhook.HookEvents.Get "issues"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issues"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issues_desc"}}</span> </div> @@ -127,7 +186,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_assign" type="checkbox" {{if .Webhook.IssueAssign}}checked{{end}}> + <input name="issue_assign" type="checkbox" {{if .Webhook.HookEvents.Get "issue_assign"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_assign"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_assign_desc"}}</span> </div> @@ -137,7 +196,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_label" type="checkbox" {{if .Webhook.IssueLabel}}checked{{end}}> + <input name="issue_label" type="checkbox" {{if .Webhook.HookEvents.Get "issue_label"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_label"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_label_desc"}}</span> </div> @@ -147,7 +206,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_milestone" type="checkbox" {{if .Webhook.IssueMilestone}}checked{{end}}> + <input name="issue_milestone" type="checkbox" {{if .Webhook.HookEvents.Get "issue_milestone"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_milestone"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_milestone_desc"}}</span> </div> @@ -157,7 +216,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="issue_comment" type="checkbox" {{if .Webhook.IssueComment}}checked{{end}}> + <input name="issue_comment" type="checkbox" {{if .Webhook.HookEvents.Get "issue_comment"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_issue_comment"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_issue_comment_desc"}}</span> </div> @@ -172,7 +231,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request" type="checkbox" {{if .Webhook.PullRequest}}checked{{end}}> + <input name="pull_request" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_desc"}}</span> </div> @@ -182,7 +241,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_assign" type="checkbox" {{if .Webhook.PullRequestAssign}}checked{{end}}> + <input name="pull_request_assign" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_assign"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_assign"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_assign_desc"}}</span> </div> @@ -192,7 +251,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_label" type="checkbox" {{if .Webhook.PullRequestLabel}}checked{{end}}> + <input name="pull_request_label" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_label"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_label"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_label_desc"}}</span> </div> @@ -202,7 +261,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_milestone" type="checkbox" {{if .Webhook.PullRequestMilestone}}checked{{end}}> + <input name="pull_request_milestone" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_milestone"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_milestone_desc"}}</span> </div> @@ -212,7 +271,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_comment" type="checkbox" {{if .Webhook.PullRequestComment}}checked{{end}}> + <input name="pull_request_comment" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_comment"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_comment"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_comment_desc"}}</span> </div> @@ -222,7 +281,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_review" type="checkbox" {{if .Webhook.PullRequestReview}}checked{{end}}> + <input name="pull_request_review" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_review"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_review"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_desc"}}</span> </div> @@ -232,7 +291,7 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_sync" type="checkbox" {{if .Webhook.PullRequestSync}}checked{{end}}> + <input name="pull_request_sync" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_sync"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_sync"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_sync_desc"}}</span> </div> @@ -242,47 +301,47 @@ <div class="seven wide column"> <div class="field"> <div class="ui checkbox"> - <input name="pull_request_review_request" type="checkbox" {{if .Webhook.PullRequestReviewRequest}}checked{{end}}> + <input name="pull_request_review_request" type="checkbox" {{if .Webhook.HookEvents.Get "pull_request_review_request"}}checked{{end}}> <label>{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request"}}</label> <span class="help">{{ctx.Locale.Tr "repo.settings.event_pull_request_review_request_desc"}}</span> </div> </div> </div> + <!-- Workflow Events --> + <div class="fourteen wide column"> + <label>{{ctx.Locale.Tr "repo.settings.event_header_workflow"}}</label> + </div> + <!-- Workflow Run Event --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="workflow_run" type="checkbox" {{if .Webhook.HookEvents.Get "workflow_run"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_workflow_run"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.event_workflow_run_desc"}}</span> + </div> + </div> + </div> + <!-- Workflow Job Event --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="workflow_job" type="checkbox" {{if .Webhook.HookEvents.Get "workflow_job"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_workflow_job"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.event_workflow_job_desc"}}</span> + </div> + </div> + </div> </div> </div> -<!-- Branch filter --> -<div class="field"> - <label for="branch_filter">{{ctx.Locale.Tr "repo.settings.branch_filter"}}</label> - <input id="branch_filter" name="branch_filter" type="text" value="{{or .Webhook.BranchFilter "*"}}"> - <span class="help">{{ctx.Locale.Tr "repo.settings.branch_filter_desc" "https://pkg.go.dev/github.com/gobwas/glob#Compile" "github.com/gobwas/glob"}}</span> -</div> - -<!-- Authorization Header --> -<div class="field{{if eq .HookType "matrix"}} required{{end}}"> - <label for="authorization_header">{{ctx.Locale.Tr "repo.settings.authorization_header"}}</label> - <input id="authorization_header" name="authorization_header" type="text" value="{{.Webhook.HeaderAuthorization}}"{{if eq .HookType "matrix"}} placeholder="Bearer $access_token" required{{end}}> - {{if ne .HookType "matrix"}}{{/* Matrix doesn't make the authorization optional but it is implied by the help string, should be changed.*/}} - <span class="help">{{ctx.Locale.Tr "repo.settings.authorization_header_desc" ("<code>Bearer token123456</code>, <code>Basic YWxhZGRpbjpvcGVuc2VzYW1l</code>" | SafeHTML)}}</span> - {{end}} -</div> - -<div class="divider"></div> - -<div class="inline field"> - <div class="ui checkbox"> - <input name="active" type="checkbox" {{if or $isNew .Webhook.IsActive}}checked{{end}}> - <label>{{ctx.Locale.Tr "repo.settings.active"}}</label> - <span class="help">{{ctx.Locale.Tr "repo.settings.active_helper"}}</span> - </div> -</div> <div class="field"> {{if $isNew}} <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</button> {{else}} <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_webhook"}}</button> - <a class="ui red delete-button button" data-url="{{.BaseLink}}/delete" data-id="{{.Webhook.ID}}">{{ctx.Locale.Tr "repo.settings.delete_webhook"}}</a> + <a class="ui red button link-action" + data-url="{{.BaseLink}}/delete?id={{.Webhook.ID}}" + data-modal-confirm="{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}" + >{{ctx.Locale.Tr "repo.settings.delete_webhook"}}</a> {{end}} </div> - -{{template "repo/settings/webhook/delete_modal" .}} diff --git a/templates/repo/settings/webhook/slack.tmpl b/templates/repo/settings/webhook/slack.tmpl index e7cae92d4b..519d6afa1a 100644 --- a/templates/repo/settings/webhook/slack.tmpl +++ b/templates/repo/settings/webhook/slack.tmpl @@ -23,6 +23,7 @@ <label for="color">{{ctx.Locale.Tr "repo.settings.slack_color"}}</label> <input id="color" name="color" value="{{.SlackHook.Color}}" placeholder="#dd4b39, good, warning, danger"> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/telegram.tmpl b/templates/repo/settings/webhook/telegram.tmpl index f92c2be0db..5ab89b72cc 100644 --- a/templates/repo/settings/webhook/telegram.tmpl +++ b/templates/repo/settings/webhook/telegram.tmpl @@ -14,6 +14,7 @@ <label for="thread_id">{{ctx.Locale.Tr "repo.settings.thread_id"}}</label> <input id="thread_id" name="thread_id" type="text" value="{{.TelegramHook.ThreadID}}"> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/settings/webhook/wechatwork.tmpl b/templates/repo/settings/webhook/wechatwork.tmpl index 78a1617123..cbc29b4610 100644 --- a/templates/repo/settings/webhook/wechatwork.tmpl +++ b/templates/repo/settings/webhook/wechatwork.tmpl @@ -6,6 +6,7 @@ <label for="payload_url">{{ctx.Locale.Tr "repo.settings.payload_url"}}</label> <input id="payload_url" name="payload_url" type="url" value="{{.Webhook.URL}}" autofocus required> </div> - {{template "repo/settings/webhook/settings" .}} + {{/* FIXME: support authorization header or not? */}} + {{template "repo/settings/webhook/settings" dict "BaseLink" .BaseLink "Webhook" .Webhook "UseAuthorizationHeader" "optional"}} </form> {{end}} diff --git a/templates/repo/star_unstar.tmpl b/templates/repo/star_unstar.tmpl index 9234a0d196..dea965ab30 100644 --- a/templates/repo/star_unstar.tmpl +++ b/templates/repo/star_unstar.tmpl @@ -1,10 +1,10 @@ -<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}unstar{{else}}star{{end}}"> +<form class="flex-text-inline" hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}unstar{{else}}star{{end}}"> <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.star_guest_user"}}"{{end}}> {{$buttonText := ctx.Locale.Tr "repo.star"}} {{if $.IsStaringRepo}}{{$buttonText = ctx.Locale.Tr "repo.unstar"}}{{end}} <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}"> {{svg (Iif $.IsStaringRepo "octicon-star-fill" "octicon-star")}} - <span aria-hidden="true">{{$buttonText}}</span> + <span class="not-mobile" aria-hidden="true">{{$buttonText}}</span> </button> <a hx-boost="false" class="ui basic label" href="{{$.RepoLink}}/stars"> {{CountFmt .Repository.NumStars}} diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl index ccb98b94ad..66ab86cb55 100644 --- a/templates/repo/sub_menu.tmpl +++ b/templates/repo/sub_menu.tmpl @@ -1,8 +1,8 @@ {{if and (not .HideRepoInfo) (not .IsBlame)}} -<div class="ui segments repository-summary tw-mt-1 tw-mb-0"> +<div class="ui segments repository-summary tw-my-0"> <div class="ui segment sub-menu repository-menu"> {{if and (.Permission.CanRead ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} - <a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}"> + <a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.RefFullName.RefWebLinkPath}}"> {{svg "octicon-history"}} <b>{{ctx.Locale.PrettyNumber .CommitsCount}}</b> {{ctx.Locale.TrN .CommitsCount "repo.commit" "repo.commits"}} </a> <a class="item muted {{if .PageIsBranches}}active{{end}}" href="{{.RepoLink}}/branches"> @@ -13,11 +13,6 @@ {{svg "octicon-tag"}} <b>{{ctx.Locale.PrettyNumber .NumTags}}</b> {{ctx.Locale.TrN .NumTags "repo.tag" "repo.tags"}} </a> {{end}} - <span class="item not-mobile" {{if not (eq .Repository.Size 0)}}data-tooltip-placement="top" data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}> - {{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}} - {{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}} - {{svg "octicon-database"}} <b>{{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}} - </span> {{end}} </div> </div> diff --git a/templates/repo/tag/list.tmpl b/templates/repo/tag/list.tmpl index 9789943b49..8b33b96f86 100644 --- a/templates/repo/tag/list.tmpl +++ b/templates/repo/tag/list.tmpl @@ -5,9 +5,7 @@ {{template "base/alert" .}} {{template "repo/release_tag_header" .}} <h4 class="ui top attached header"> - <div class="five wide column tw-flex tw-items-center"> - {{.TagCount}} {{ctx.Locale.Tr "repo.release.tags"}} - </div> + {{.TagCount}} {{ctx.Locale.Tr "repo.release.tags"}} </h4> {{$canReadReleases := $.Permission.CanRead ctx.Consts.RepoUnitTypeReleases}} <div class="ui attached segment"> @@ -15,53 +13,49 @@ {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.tag_kind") "Tooltip" (ctx.Locale.Tr "search.tag_tooltip")}} </form> </div> - <div class="ui attached table segment"> + <div class="ui attached segment tw-p-0"> {{if .Releases}} - <table class="ui very basic striped fixed table single line" id="tags-table"> - <tbody class="tag-list"> - {{range $idx, $release := .Releases}} - <tr> - <td class="tag-list-row"> - <h3 class="tag-list-row-title tw-mb-2"> - {{if $canReadReleases}} - <a class="tag-list-row-link tw-flex tw-items-center" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> - {{else}} - <a class="tag-list-row-link tw-flex tw-items-center" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> - {{end}} - </h3> - <div class="download tw-flex tw-items-center"> - {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} - {{if .CreatedUnix}} - <span class="tw-mr-2">{{svg "octicon-clock" 16 "tw-mr-1"}}{{DateUtils.TimeSince .CreatedUnix}}</span> - {{end}} + <div class="ui divided list" id="tags-table"> + {{range $idx, $release := .Releases}} + <div class="item tag-list-row tw-p-4"> + <h3 class="tag-list-row-title tw-mb-2"> + {{if $canReadReleases}} + <a class="tag-list-row-link" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{else}} + <a class="tag-list-row-link" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{end}} + </h3> + <div class="flex-text-block muted-links tw-gap-4 tw-flex-wrap"> + {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}} + {{if .CreatedUnix}} + <span class="flex-text-inline">{{svg "octicon-clock"}}{{DateUtils.TimeSince .CreatedUnix}}</span> + {{end}} - <a class="tw-mr-2 tw-font-mono muted" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha .Sha1}}</a> + <a class="flex-text-inline tw-font-mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit"}}{{ShortSha .Sha1}}</a> - {{if not $.DisableDownloadSourceArchives}} - <a class="archive-link tw-mr-2 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-1"}}ZIP</a> - <a class="archive-link tw-mr-2 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-1"}}TAR.GZ</a> - {{end}} + {{if not $.DisableDownloadSourceArchives}} + <a class="archive-link flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}ZIP</a> + <a class="archive-link flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}TAR.GZ</a> + {{end}} - {{if (and $canReadReleases $.CanCreateRelease $release.IsTag)}} - <a class="tw-mr-2 muted" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.new_release"}}</a> - {{end}} + {{if (and $canReadReleases $.CanCreateRelease $release.IsTag)}} + <a class="flex-text-inline" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag"}}{{ctx.Locale.Tr "repo.release.new_release"}}</a> + {{end}} - {{if (and ($.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) $release.IsTag)}} - <a class="ui delete-button tw-mr-2 muted" data-url="{{$.RepoLink}}/tags/delete" data-id="{{.ID}}"> - {{svg "octicon-trash" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.delete_tag"}} - </a> - {{end}} + {{if (and ($.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) $release.IsTag)}} + <a class="flex-text-inline link-action" data-url="{{$.RepoLink}}/tags/delete?id={{.ID}}" data-modal-confirm="#confirm-delete-tag-modal"> + {{svg "octicon-trash"}}{{ctx.Locale.Tr "repo.release.delete_tag"}} + </a> + {{end}} - {{if and $canReadReleases (not $release.IsTag)}} - <a class="tw-mr-2 muted" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.detail"}}</a> - {{end}} - {{end}} - </div> - </td> - </tr> - {{end}} - </tbody> - </table> + {{if and $canReadReleases (not $release.IsTag)}} + <a class="flex-text-inline" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag"}}{{ctx.Locale.Tr "repo.release.detail"}}</a> + {{end}} + {{end}} + </div> + </div> + {{end}} + </div> {{else}} {{if .NumTags}} <p class="tw-p-4">{{ctx.Locale.Tr "no_results_found"}}</p> @@ -73,9 +67,8 @@ </div> {{if $.Permission.CanWrite ctx.Consts.RepoUnitTypeCode}} -<div class="ui g-modal-confirm delete modal"> +<div id="confirm-delete-tag-modal" class="ui small modal"> <div class="header"> - {{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.release.delete_tag"}} </div> <div class="content"> diff --git a/templates/repo/tag/name.tmpl b/templates/repo/tag/name.tmpl index c3042014d3..24e7de046d 100644 --- a/templates/repo/tag/name.tmpl +++ b/templates/repo/tag/name.tmpl @@ -1,3 +1,3 @@ -<a class="ui label basic tiny button{{if .IsRelease}} primary{{end}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}"> +<a class="ui basic label {{if .IsRelease}}primary{{end}} {{.AdditionalClasses}}" href="{{.RepoLink}}/src/tag/{{.TagName|PathEscape}}"> {{svg "octicon-tag"}} {{.TagName}} </a> diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl index 8bceafa8bb..f8226ec728 100644 --- a/templates/repo/unicode_escape_prompt.tmpl +++ b/templates/repo/unicode_escape_prompt.tmpl @@ -1,22 +1,22 @@ {{if .EscapeStatus}} {{if .EscapeStatus.HasInvisible}} - <div class="ui warning message unicode-escape-prompt tw-text-left"> + <div class="ui warning message unicode-escape-prompt"> <button class="btn close icon hide-panel" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</button> <div class="header"> {{ctx.Locale.Tr "repo.invisible_runes_header"}} </div> - <p>{{ctx.Locale.Tr "repo.invisible_runes_description"}}</p> + <div>{{ctx.Locale.Tr "repo.invisible_runes_description"}}</div> {{if .EscapeStatus.HasAmbiguous}} - <p>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</p> + <div>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</div> {{end}} </div> {{else if .EscapeStatus.HasAmbiguous}} - <div class="ui warning message unicode-escape-prompt tw-text-left"> + <div class="ui warning message unicode-escape-prompt"> <button class="btn close icon hide-panel" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</button> <div class="header"> {{ctx.Locale.Tr "repo.ambiguous_runes_header"}} </div> - <p>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</p> + <div>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</div> </div> {{end}} {{end}} diff --git a/templates/repo/view.tmpl b/templates/repo/view.tmpl new file mode 100644 index 0000000000..85d09d03a1 --- /dev/null +++ b/templates/repo/view.tmpl @@ -0,0 +1,29 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file list {{if .IsBlame}}blame{{end}}"> + {{template "repo/header" .}} + <div class="ui container {{if or .TreeNames .IsBlame}}fluid padded{{end}}"> + {{template "base/alert" .}} + + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{if .Repository.ArchivedUnix.IsZero}} + {{ctx.Locale.Tr "repo.archive.title"}} + {{else}} + {{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} + {{end}} + </div> + {{end}} + + {{template "repo/code/recently_pushed_new_branches" .}} + + <div class="repo-view-container"> + <div class="tw-flex tw-flex-col repo-view-file-tree-container not-mobile {{if not .UserSettingCodeViewShowFileTree}}tw-hidden{{end}}" {{if .IsSigned}}data-user-is-signed-in{{end}}> + {{template "repo/view_file_tree" .}} + </div> + <div class="repo-view-content"> + {{template "repo/view_content" .}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/view_content.tmpl b/templates/repo/view_content.tmpl new file mode 100644 index 0000000000..3ba04a9974 --- /dev/null +++ b/templates/repo/view_content.tmpl @@ -0,0 +1,111 @@ +{{$isTreePathRoot := not .TreeNames}} + +{{template "repo/sub_menu" .}} +<div class="repo-button-row"> + <div class="repo-button-row-left"> + {{if not $isTreePathRoot}} + <button class="repo-view-file-tree-toggle-show ui compact basic button icon not-mobile {{if .UserSettingCodeViewShowFileTree}}tw-hidden{{end}}" + data-global-click="onRepoViewFileTreeToggle" data-toggle-action="show" + data-tooltip-content="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}"> + {{svg "octicon-sidebar-collapse"}} + </button> + {{end}} + + {{template "repo/branch_dropdown" dict + "Repository" .Repository + "ShowTabBranches" true + "ShowTabTags" true + "CurrentRefType" .RefFullName.RefType + "CurrentRefShortName" .RefFullName.ShortName + "CurrentTreePath" .TreePath + "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" + "AllowCreateNewRef" .CanCreateBranch + "ShowViewAllRefsEntry" true + }} + + {{if and .CanCompareOrPull .RefFullName.IsBranch (not .Repository.IsArchived)}} + {{$cmpBranch := ""}} + {{if ne .Repository.ID .BaseRepo.ID}} + {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} + {{end}} + {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} + {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}} + <a id="new-pull-request" role="button" class="ui compact basic button" href="{{QueryBuild $compareLink "expand" 1}}" + data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}"> + {{svg "octicon-git-pull-request"}} + </a> + {{end}} + + <!-- Show go to file if on home page --> + {{if $isTreePathRoot}} + <a href="{{.Repository.Link}}/find/{{.RefTypeNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a> + {{end}} + + {{if and .RefFullName.IsBranch (not .IsViewFile)}} + <button class="ui dropdown basic compact jump button repo-add-file" {{if not .Repository.CanEnableEditor}}disabled{{end}}> + {{ctx.Locale.Tr "repo.editor.add_file"}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> + {{ctx.Locale.Tr "repo.editor.new_file"}} + </a> + {{if .RepositoryUploadEnabled}} + <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> + {{ctx.Locale.Tr "repo.editor.upload_file"}} + </a> + {{end}} + <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> + {{ctx.Locale.Tr "repo.editor.patch"}} + </a> + </div> + </button> + {{end}} + + {{if and $isTreePathRoot .Repository.IsTemplate}} + <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}"> + {{ctx.Locale.Tr "repo.use_template"}} + </a> + {{end}} + + {{if not $isTreePathRoot}} + {{$treeNameIdxLast := Eval (len .TreeNames) "-" 1}} + <span class="breadcrumb"> + <a class="section" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a> + {{- range $i, $v := .TreeNames -}} + <span class="breadcrumb-divider">/</span> + {{- if eq $i $treeNameIdxLast -}} + <span class="active section" title="{{$v}}">{{$v}}</span> + <button class="btn interact-fg tw-mx-1" data-clipboard-text="{{$.TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> + {{- else -}} + {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{$v}}</a></span> + {{- end -}} + {{- end -}} + </span> + {{end}} + </div> + + <div class="repo-button-row-right"> + <!-- Only show clone panel in repository home page --> + {{if $isTreePathRoot}} + {{template "repo/clone_panel" .}} + {{end}} + {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} + <a class="ui button" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> + {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} + </a> + {{end}} + </div> +</div> +{{if .IsViewFile}} + {{template "repo/view_file" .}} +{{else if .IsBlame}} + {{template "repo/blame" .}} +{{else}}{{/* IsViewDirectory */}} + {{if $isTreePathRoot}} + {{template "repo/code/upstream_diverging_info" .}} + {{end}} + {{template "repo/view_list" .}} + {{if and .ReadmeExist (or .IsMarkup .IsPlainText)}} + {{template "repo/view_file" .}} + {{end}} +{{end}} diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index 0a43e3db54..1486d7181d 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -1,4 +1,6 @@ -<div {{if .ReadmeInList}}id="readme" {{end}}class="{{TabSizeClass .Editorconfig .FileName}} non-diff-file-content"> +<div {{if .ReadmeInList}}id="readme"{{end}} class="{{TabSizeClass .Editorconfig .FileTreePath}} non-diff-file-content" + data-global-init="initRepoFileView" data-raw-file-link="{{.RawFileLink}}"> + {{- if .FileError}} <div class="ui error message"> <div class="text left tw-whitespace-pre">{{.FileError}}</div> @@ -27,37 +29,41 @@ <div class="file-header-left tw-flex tw-items-center tw-py-2 tw-pr-4"> {{if .ReadmeInList}} {{svg "octicon-book" 16 "tw-mr-2"}} - <strong><a class="muted" href="#readme">{{.FileName}}</a></strong> + <strong><a class="muted" href="#readme">{{.ReadmeInList}}</a></strong> {{else}} {{template "repo/file_info" .}} {{end}} </div> - <div class="file-header-right file-actions tw-flex tw-items-center tw-flex-wrap"> - {{if .HasSourceRenderedToggle}} - <div class="ui compact icon buttons"> - <a href="?display=source" class="ui mini basic button {{if .IsDisplayingSource}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_source"}}">{{svg "octicon-code" 15}}</a> - <a href="{{$.Link}}" class="ui mini basic button {{if .IsDisplayingRendered}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_rendered"}}">{{svg "octicon-file" 15}}</a> - </div> - {{end}} + <div class="file-header-right file-actions flex-text-block tw-flex-wrap"> + {{/* this componment is also controlled by frontend plugin renders */}} + <div class="ui compact icon buttons file-view-toggle-buttons {{Iif .HasSourceRenderedToggle "" "tw-hidden"}}"> + {{if .IsRepresentableAsText}} + <a href="?display=source" class="ui mini basic button file-view-toggle-source {{if .IsDisplayingSource}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_source"}}">{{svg "octicon-code" 15}}</a> + {{end}} + <a href="?display=rendered" class="ui mini basic button file-view-toggle-rendered {{if not .IsDisplayingSource}}active{{end}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_rendered"}}">{{svg "octicon-file" 15}}</a> + </div> {{if not .ReadmeInList}} <div class="ui buttons tw-mr-1"> <a class="ui mini basic button" href="{{$.RawFileLink}}">{{ctx.Locale.Tr "repo.file_raw"}}</a> - {{if not .IsViewCommit}} + {{if or .RefFullName.IsBranch .RefFullName.IsTag}} <a class="ui mini basic button" href="{{.RepoLink}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.file_permalink"}}</a> {{end}} {{if .IsRepresentableAsText}} - <a class="ui mini basic button" href="{{.RepoLink}}/blame/{{.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.blame"}}</a> + <a class="ui mini basic button" href="{{.RepoLink}}/blame/{{.RefTypeNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.blame"}}</a> {{end}} - <a class="ui mini basic button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.file_history"}}</a> + <a class="ui mini basic button" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.file_history"}}</a> {{if .EscapeStatus.Escaped}} <button class="ui mini basic button unescape-button tw-hidden">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> <button class="ui mini basic button escape-button">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> {{end}} </div> <a download class="btn-octicon" data-tooltip-content="{{ctx.Locale.Tr "repo.download_file"}}" href="{{$.RawFileLink}}">{{svg "octicon-download"}}</a> - <a id="copy-content" class="btn-octicon {{if not .CanCopyContent}} disabled{{end}}"{{if or .IsImageFile (and .HasSourceRenderedToggle (not .IsDisplayingSource))}} data-link="{{$.RawFileLink}}"{{end}} data-tooltip-content="{{if .CanCopyContent}}{{ctx.Locale.Tr "copy_content"}}{{else}}{{ctx.Locale.Tr "copy_type_unsupported"}}{{end}}">{{svg "octicon-copy"}}</a> + <a class="btn-octicon {{if not .CanCopyContent}}disabled{{end}}" data-global-click="onCopyContentButtonClick" + {{if not .IsDisplayingSource}}data-raw-file-link="{{$.RawFileLink}}"{{end}} + data-tooltip-content="{{if .CanCopyContent}}{{ctx.Locale.Tr "copy_content"}}{{else}}{{ctx.Locale.Tr "copy_type_unsupported"}}{{end}}" + >{{svg "octicon-copy"}}</a> {{if .EnableFeed}} - <a class="btn-octicon" href="{{$.FeedURL}}/rss/{{$.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}"> + <a class="btn-octicon" href="{{$.RepoLink}}/rss/{{$.RefTypeNameSubURL}}/{{PathEscapeSegments .TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}"> {{svg "octicon-rss"}} </a> {{end}} @@ -78,45 +84,28 @@ <button class="ui mini basic button escape-button tw-mr-1">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> {{end}} {{if and .ReadmeInList .CanEditReadmeFile}} - <a class="btn-octicon" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.edit_this_file"}}" href="{{.RepoLink}}/_edit/{{PathEscapeSegments .BranchName}}/{{PathEscapeSegments .TreePath}}/{{PathEscapeSegments .FileName}}">{{svg "octicon-pencil"}}</a> + <a class="btn-octicon" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.edit_this_file"}}" href="{{.RepoLink}}/_edit/{{PathEscapeSegments .BranchName}}/{{PathEscapeSegments .FileTreePath}}">{{svg "octicon-pencil"}}</a> {{end}} </div> </h4> + <div class="ui bottom attached table unstackable segment"> - {{if not (or .IsMarkup .IsRenderedHTML)}} - {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} + {{if not .IsMarkup}} + {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus}} {{end}} - <div class="file-view{{if .IsMarkup}} markup {{.MarkupType}}{{else if .IsPlainText}} plain-text{{else if .IsTextSource}} code-view{{end}}"> + <div class="file-view {{if .IsMarkup}}markup {{.MarkupType}}{{else if .IsPlainText}}plain-text{{else if .IsDisplayingSource}}code-view{{end}}"> {{if .IsFileTooLarge}} {{template "shared/filetoolarge" dict "RawFileLink" .RawFileLink}} {{else if not .FileSize}} {{template "shared/fileisempty"}} {{else if .IsMarkup}} - {{if .FileContent}}{{.FileContent}}{{end}} + {{.FileContent}} {{else if .IsPlainText}} <pre>{{if .FileContent}}{{.FileContent}}{{end}}</pre> - {{else if not .IsTextSource}} - <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 "repo.diff.view_file"}}"></div> - {{else}} - <a href="{{$.RawFileLink}}" rel="nofollow" class="tw-p-4">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> - {{end}} - </div> - {{else if .FileSize}} + {{else if .FileContent}} <table> <tbody> - {{range $idx, $code := .FileContent}} + {{range $idx, $code := .FileContent}} {{$line := Eval $idx "+" 1}} <tr> <td id="L{{$line}}" class="lines-num"><span id="L{{$line}}" data-line-number="{{$line}}"></span></td> @@ -125,17 +114,38 @@ {{end}} <td rel="L{{$line}}" class="lines-code chroma"><code class="code-inner">{{$code}}</code></td> </tr> - {{end}} + {{end}} </tbody> </table> - <div class="code-line-menu tippy-target"> - {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} - <a class="item ref-in-new-issue" role="menuitem" data-url-issue-new="{{.RepoLink}}/issues/new" data-url-param-body-link="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}" rel="nofollow noindex">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</a> + {{else}} + <div class="view-raw"> + {{if .IsImageFile}} + <img alt="{{$.RawFileLink}}" 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}} + <div class="file-view-render-container"> + <div class="file-view-raw-prompt tw-p-4"> + <a href="{{$.RawFileLink}}" rel="nofollow">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> + </div> + </div> {{end}} - <a class="item view_git_blame" role="menuitem" href="{{.Repository.Link}}/blame/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.view_git_blame"}}</a> - <a class="item copy-line-permalink" role="menuitem" data-url="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}">{{ctx.Locale.Tr "repo.file_copy_permalink"}}</a> </div> {{end}} </div> + + <div class="code-line-menu tippy-target"> + {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} + <a class="item ref-in-new-issue" role="menuitem" data-url-issue-new="{{.RepoLink}}/issues/new" data-url-param-body-link="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}" rel="nofollow noindex">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</a> + {{end}} + <a class="item view_git_blame" role="menuitem" href="{{.Repository.Link}}/blame/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.view_git_blame"}}</a> + <a class="item copy-line-permalink" role="menuitem" data-url="{{.Repository.Link}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}{{if $.HasSourceRenderedToggle}}?display=source{{end}}">{{ctx.Locale.Tr "repo.file_copy_permalink"}}</a> + </div> </div> </div> diff --git a/templates/repo/view_file_tree.tmpl b/templates/repo/view_file_tree.tmpl new file mode 100644 index 0000000000..8aed05f346 --- /dev/null +++ b/templates/repo/view_file_tree.tmpl @@ -0,0 +1,15 @@ +<div class="flex-text-block repo-button-row"> + <button class="ui compact basic icon button" + data-global-click="onRepoViewFileTreeToggle" data-toggle-action="hide" + data-tooltip-content="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}"> + {{svg "octicon-sidebar-expand"}} + </button> + <b>{{ctx.Locale.Tr "files"}}</b> +</div> + +{{/* TODO: Dynamically move components such as refSelector and createPR here */}} +<div id="view-file-tree" class="tw-overflow-auto tw-h-full is-loading" + data-repo-link="{{.RepoLink}}" + data-tree-path="{{$.TreePath}}" + data-current-ref-name-sub-url="{{.RefTypeNameSubURL}}" +></div> diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index c8e97d2617..b655f735a3 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -4,30 +4,32 @@ {{template "repo/latest_commit" .}} <div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div> </div> + {{$.FileIconPoolHTML}} {{if .HasParentPath}} <a class="repo-file-line parent-link silenced" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}"> - {{svg "octicon-file-directory-fill"}} .. + {{index $.FileIcons ".."}} .. </a> {{end}} {{range $item := .Files}} <div class="repo-file-item"> {{$entry := $item.Entry}} {{$commit := $item.Commit}} - {{$subModuleFile := $item.SubModuleFile}} - <div class="repo-file-cell name {{if not $commit}}notready{{end}}"> + {{$submoduleFile := $item.SubmoduleFile}} + <div class="repo-file-cell name muted-links {{if not $commit}}notready{{end}}"> + {{index $.FileIcons $entry.Name}} {{if $entry.IsSubModule}} - {{svg "octicon-file-submodule"}} - {{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}} - {{if $refURL}} - <a class="muted" href="{{$refURL}}">{{$entry.Name}}</a> <span class="at">@</span> <a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a> + {{$submoduleLink := $submoduleFile.SubmoduleWebLink ctx}} + {{if $submoduleLink}} + <a class="entry-name" href="{{$submoduleLink.RepoWebLink}}" title="{{$entry.Name}}">{{$entry.Name}}</a> + @ <a class="text primary" href="{{$submoduleLink.CommitWebLink}}">{{ShortSha $submoduleFile.RefID}}</a> {{else}} - {{$entry.Name}} <span class="at">@</span> {{ShortSha $subModuleFile.RefID}} + <span class="entry-name" title="{{$entry.Name}}">{{$entry.Name}}</span> + @ {{ShortSha $submoduleFile.RefID}} {{end}} {{else}} {{if $entry.IsDir}} {{$subJumpablePathName := $entry.GetSubJumpablePathName}} - {{svg "octicon-file-directory-fill"}} - <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}"> + <a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}"> {{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}} {{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}} {{if eq $subJumpablePathFieldLast 0}} @@ -38,15 +40,17 @@ {{end}} </a> {{else}} - {{svg (printf "octicon-%s" (EntryIcon $entry))}} - <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> + <a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> + {{if $entry.IsLink}} + <a class="entry-symbol-link flex-text-inline" data-tooltip-content title="{{ctx.Locale.Tr "repo.find_file.follow_symlink"}}" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}?follow_symlink=1">{{svg "octicon-link" 12}}</a> + {{end}} {{end}} {{end}} </div> <div class="repo-file-cell message loading-icon-2px"> {{if $commit}} {{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}} - {{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}} + {{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink $.Repository}} {{else}} โฆ {{/* will be loaded again by LastCommitLoaderURL */}} {{end}} diff --git a/templates/repo/watch_unwatch.tmpl b/templates/repo/watch_unwatch.tmpl index 465cd91c2b..6f2e5b7a19 100644 --- a/templates/repo/watch_unwatch.tmpl +++ b/templates/repo/watch_unwatch.tmpl @@ -1,10 +1,10 @@ -<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}unwatch{{else}}watch{{end}}"> +<form class="flex-text-inline" hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}unwatch{{else}}watch{{end}}"> <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.watch_guest_user"}}"{{end}}> {{$buttonText := ctx.Locale.Tr "repo.watch"}} {{if $.IsWatchingRepo}}{{$buttonText = ctx.Locale.Tr "repo.unwatch"}}{{end}} <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}"> {{svg "octicon-eye"}} - <span aria-hidden="true">{{$buttonText}}</span> + <span class="not-mobile" aria-hidden="true">{{$buttonText}}</span> </button> <a hx-boost="false" class="ui basic label" href="{{.RepoLink}}/watchers"> {{CountFmt .Repository.NumWatches}} diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl index ea2913c0fd..12f0983904 100644 --- a/templates/repo/wiki/new.tmpl +++ b/templates/repo/wiki/new.tmpl @@ -18,7 +18,7 @@ {{ctx.Locale.Tr "repo.wiki.page_name_desc"}} </div> - {{$content := .content}} + {{$content := .WikiEditContent}} {{if not .PageIsWikiEdit}} {{$content = ctx.Locale.Tr "repo.wiki.welcome"}} {{end}} @@ -35,7 +35,7 @@ <input name="message" aria-label="{{ctx.Locale.Tr "repo.wiki.default_commit_message"}}" placeholder="{{ctx.Locale.Tr "repo.wiki.default_commit_message"}}"> </div> <div class="divider"></div> - <div class="text right"> + <div class="flex-text-block tw-justify-end"> <a class="ui basic cancel button" href="{{.Link}}">{{ctx.Locale.Tr "cancel"}}</a> <button class="ui primary button">{{ctx.Locale.Tr "repo.wiki.save_page"}}</button> </div> diff --git a/templates/repo/wiki/pages.tmpl b/templates/repo/wiki/pages.tmpl index 38d6d6f944..5ceb8a4d5b 100644 --- a/templates/repo/wiki/pages.tmpl +++ b/templates/repo/wiki/pages.tmpl @@ -10,7 +10,7 @@ {{end}} </span> </h2> - {{if .IsRepositoryAdmin}}<div>{{ctx.Locale.Tr "repo.default_branch"}}: {{.Repository.DefaultWikiBranch}}</div>{{end}} + {{if $.Permission.IsAdmin}}<div>{{ctx.Locale.Tr "repo.default_branch"}}: {{.Repository.DefaultWikiBranch}}</div>{{end}} <table class="ui table wiki-pages-list"> <tbody> {{range .Pages}} @@ -21,7 +21,7 @@ <a class="wiki-git-entry" href="{{$.RepoLink}}/wiki/{{.GitEntryName | PathEscape}}" data-tooltip-content="{{ctx.Locale.Tr "repo.wiki.original_git_entry_tooltip"}}">{{svg "octicon-chevron-right"}}</a> </td> {{$timeSince := DateUtils.TimeSince .UpdatedUnix}} - <td class="text right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td> + <td class="tw-text-right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td> </tr> {{end}} </tbody> diff --git a/templates/repo/wiki/revision.tmpl b/templates/repo/wiki/revision.tmpl index ca8954928d..108e378937 100644 --- a/templates/repo/wiki/revision.tmpl +++ b/templates/repo/wiki/revision.tmpl @@ -3,18 +3,18 @@ {{template "repo/header" .}} {{$title := .title}} <div class="ui container"> - <div class="ui stackable grid"> - <div class="ui eight wide column"> - <div class="ui header"> - <a class="file-revisions-btn ui basic button" title="{{ctx.Locale.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}"><span>{{.revision}}</span> {{svg "octicon-home"}}</a> + <div class="ui dividing header flex-text-block tw-flex-wrap tw-justify-between"> + <div class="flex-text-block"> + <a class="ui basic button tw-px-3" title="{{ctx.Locale.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}">{{svg "octicon-home"}}</a> + <div class="tw-flex-1 gt-ellipsis"> {{$title}} - <div class="ui sub header tw-break-anywhere"> + <div class="ui sub header gt-ellipsis"> {{$timeSince := DateUtils.TimeSince .Author.When}} {{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince}} </div> </div> </div> - <div class="ui eight wide column text right"> + <div class="flex-text-block"> {{template "repo/clone_panel" .}} </div> </div> diff --git a/templates/repo/wiki/start.tmpl b/templates/repo/wiki/start.tmpl index 1b3c3d538a..e622db5eb5 100644 --- a/templates/repo/wiki/start.tmpl +++ b/templates/repo/wiki/start.tmpl @@ -7,7 +7,7 @@ <h2>{{ctx.Locale.Tr "repo.wiki.welcome"}}</h2> <p>{{ctx.Locale.Tr "repo.wiki.welcome_desc"}}</p> {{if and .CanWriteWiki (not .Repository.IsMirror)}} - <a class="ui primary button" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.create_first_page"}}</a> + <a class="ui primary button tw-mr-0" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.create_first_page"}}</a> {{end}} </div> </div> diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index 843a977e3e..4c7ef364d2 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -33,7 +33,7 @@ <div class="ui dividing header"> <div class="flex-text-block tw-flex-wrap tw-justify-end"> <div class="flex-text-block tw-flex-1 tw-min-w-[300px]"> - <a class="file-revisions-btn ui basic button" title="{{ctx.Locale.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" ><span>{{.CommitCount}}</span> {{svg "octicon-history"}}</a> + <a class="ui basic button tw-px-3 tw-gap-3" title="{{ctx.Locale.Tr "repo.wiki.file_revision"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_revision" >{{if .CommitCount}}<span>{{.CommitCount}}</span> {{end}}{{svg "octicon-history"}}</a> <div class="tw-flex-1 gt-ellipsis"> {{$title}} <div class="ui sub header gt-ellipsis"> @@ -50,7 +50,7 @@ {{if and .CanWriteWiki (not .Repository.IsMirror)}} <a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}?action=_edit">{{ctx.Locale.Tr "repo.wiki.edit_page_button"}}</a> <a class="ui small primary button" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.new_page_button"}}</a> - <a class="ui small red button delete-button" href="" data-url="{{.RepoLink}}/wiki/{{.PageURL}}?action=_delete" data-id="{{.PageURL}}">{{ctx.Locale.Tr "repo.wiki.delete_page_button"}}</a> + <a class="ui small red button link-action" href data-modal-confirm="#repo-wiki-delete-page-modal" data-url="{{.RepoLink}}/wiki/{{.PageURL}}?action=_delete">{{ctx.Locale.Tr "repo.wiki.delete_page_button"}}</a> {{end}} </div> </div> @@ -62,50 +62,43 @@ {{end}} <div class="wiki-content-parts"> - {{if .sidebarTocContent}} - <div class="markup wiki-content-sidebar wiki-content-toc"> - {{.sidebarTocContent | SafeHTML}} + {{if .WikiSidebarTocHTML}} + <div class="render-content markup wiki-content-sidebar wiki-content-toc"> + {{.WikiSidebarTocHTML}} </div> {{end}} - <div class="markup wiki-content-main {{if or .sidebarTocContent .sidebarPresent}}with-sidebar{{end}}"> - {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} - {{.content | SafeHTML}} + <div class="render-content markup wiki-content-main {{if or .WikiSidebarTocHTML .WikiSidebarHTML}}with-sidebar{{end}}"> + {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus}} + {{.WikiContentHTML}} </div> - {{if .sidebarPresent}} - <div class="markup wiki-content-sidebar"> + {{if .WikiSidebarHTML}} + <div class="render-content markup wiki-content-sidebar"> {{if and .CanWriteWiki (not .Repository.IsMirror)}} <a class="tw-float-right muted" href="{{.RepoLink}}/wiki/_Sidebar?action=_edit" aria-label="{{ctx.Locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a> {{end}} - {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .sidebarEscapeStatus "root" $}} - {{.sidebarContent | SafeHTML}} + {{.WikiSidebarHTML}} </div> {{end}} <div class="tw-clear-both"></div> - {{if .footerPresent}} - <div class="markup wiki-content-footer"> + {{if .WikiFooterHTML}} + <div class="render-content markup wiki-content-footer"> {{if and .CanWriteWiki (not .Repository.IsMirror)}} <a class="tw-float-right muted" href="{{.RepoLink}}/wiki/_Footer?action=_edit" aria-label="{{ctx.Locale.Tr "repo.wiki.edit_page_button"}}">{{svg "octicon-pencil"}}</a> {{end}} - {{template "repo/unicode_escape_prompt" dict "footerEscapeStatus" .sidebarEscapeStatus "root" $}} - {{.footerContent | SafeHTML}} + {{.WikiFooterHTML}} </div> {{end}} </div> </div> </div> -<div class="ui g-modal-confirm delete modal"> - <div class="header"> - {{svg "octicon-trash"}} - {{ctx.Locale.Tr "repo.wiki.delete_page_button"}} - </div> - <div class="content"> - <p>{{ctx.Locale.Tr "repo.wiki.delete_page_notice_1" $title}}</p> - </div> +<div class="ui small modal" id="repo-wiki-delete-page-modal"> + <div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.wiki.delete_page_button"}}</div> + <div class="content"><p>{{ctx.Locale.Tr "repo.wiki.delete_page_notice_1" $title}}</p></div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/shared/actions/runner_badge.tmpl b/templates/shared/actions/runner_badge.tmpl deleted file mode 100644 index 816e87e177..0000000000 --- a/templates/shared/actions/runner_badge.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{{.Badge.Width}}" height="18" - role="img" aria-label="{{.Badge.Label.Text}}: {{.Badge.Message.Text}}"> - <title>{{.Badge.Label.Text}}: {{.Badge.Message.Text}}</title> - <linearGradient id="s" x2="0" y2="100%"> - <stop offset="0" stop-color="#fff" stop-opacity=".7" /> - <stop offset=".1" stop-color="#aaa" stop-opacity=".1" /> - <stop offset=".9" stop-color="#000" stop-opacity=".3" /> - <stop offset="1" stop-color="#000" stop-opacity=".5" /> - </linearGradient> - <clipPath id="r"> - <rect width="{{.Badge.Width}}" height="18" rx="4" fill="#fff" /> - </clipPath> - <g clip-path="url(#r)"> - <rect width="{{.Badge.Label.Width}}" height="18" fill="#555" /> - <rect x="{{.Badge.Label.Width}}" width="{{.Badge.Message.Width}}" height="18" fill="{{.Badge.Color}}" /> - <rect width="{{.Badge.Width}}" height="18" fill="url(#s)" /> - </g> - <g fill="#fff" text-anchor="middle" font-family="Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" - font-size="{{.Badge.FontSize}}"><text aria-hidden="true" x="{{.Badge.Label.X}}" y="140" fill="#010101" fill-opacity=".3" - transform="scale(.1)" textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text><text x="{{.Badge.Label.X}}" y="130" - transform="scale(.1)" fill="#fff" textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text><text aria-hidden="true" - x="{{.Badge.Message.X}}" y="140" fill="#010101" fill-opacity=".3" transform="scale(.1)" - textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text><text x="{{.Badge.Message.X}}" y="130" transform="scale(.1)" - fill="#fff" textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text></g> -</svg> diff --git a/templates/shared/actions/runner_badge_flat-square.tmpl b/templates/shared/actions/runner_badge_flat-square.tmpl new file mode 100644 index 0000000000..cc1dc1e8f3 --- /dev/null +++ b/templates/shared/actions/runner_badge_flat-square.tmpl @@ -0,0 +1,15 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{{.Badge.Width}}" height="20" + role="img" aria-label="{{.Badge.Label.Text}}: {{.Badge.Message.Text}}"> + <title>{{.Badge.Label.Text}}: {{.Badge.Message.Text}}</title> + <g shape-rendering="crispEdges"> + <rect width="{{.Badge.Label.Width}}" height="20" fill="#555" /> + <rect x="{{.Badge.Label.Width}}" width="{{.Badge.Message.Width}}" height="20" fill="{{.Badge.Color}}" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="{{.Badge.FontFamily}}" + text-rendering="geometricPrecision" font-size="{{.Badge.FontSize}}"> + <text x="{{.Badge.Label.X}}" y="140" + transform="scale(.1)" fill="#fff" textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text> + <text x="{{.Badge.Message.X}}" y="140" transform="scale(.1)" fill="#fff" + textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text> + </g> +</svg> diff --git a/templates/shared/actions/runner_badge_flat.tmpl b/templates/shared/actions/runner_badge_flat.tmpl new file mode 100644 index 0000000000..1ba9be09fb --- /dev/null +++ b/templates/shared/actions/runner_badge_flat.tmpl @@ -0,0 +1,27 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{{.Badge.Width}}" height="20" + role="img" aria-label="{{.Badge.Label.Text}}: {{.Badge.Message.Text}}"> + <title>{{.Badge.Label.Text}}: {{.Badge.Message.Text}}</title> + <linearGradient id="{{.Badge.IDPrefix}}s" x2="0" y2="100%"> + <stop offset="0" stop-color="#bbb" stop-opacity=".1" /> + <stop offset="1" stop-opacity=".1" /> + </linearGradient> + <clipPath id="{{.Badge.IDPrefix}}r"> + <rect width="{{.Badge.Width}}" height="20" rx="3" fill="#fff" /> + </clipPath> + <g clip-path="url(#{{.Badge.IDPrefix}}r)"> + <rect width="{{.Badge.Label.Width}}" height="20" fill="#555" /> + <rect x="{{.Badge.Label.Width}}" width="{{.Badge.Message.Width}}" height="20" fill="{{.Badge.Color}}" /> + <rect width="{{.Badge.Width}}" height="20" fill="url(#{{.Badge.IDPrefix}}s)" /> + </g> + <g fill="#fff" text-anchor="middle" font-family="{{.Badge.FontFamily}}" + text-rendering="geometricPrecision" font-size="{{.Badge.FontSize}}"> + <text aria-hidden="true" x="{{.Badge.Label.X}}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" + textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text> + <text x="{{.Badge.Label.X}}" y="140" + transform="scale(.1)" fill="#fff" textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text> + <text aria-hidden="true" x="{{.Badge.Message.X}}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" + textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text> + <text x="{{.Badge.Message.X}}" y="140" transform="scale(.1)" fill="#fff" + textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text> + </g> +</svg> diff --git a/templates/shared/actions/runner_edit.tmpl b/templates/shared/actions/runner_edit.tmpl index 54250f830b..d452d69f7a 100644 --- a/templates/shared/actions/runner_edit.tmpl +++ b/templates/shared/actions/runner_edit.tmpl @@ -40,7 +40,7 @@ <div class="field"> <button class="ui primary button" data-url="{{.Link}}">{{ctx.Locale.Tr "actions.runners.update_runner"}}</button> - <button class="ui red button delete-button show-modal" data-url="{{.Link}}/delete" data-modal="#runner-delete-modal"> + <button class="ui red button delete-button" data-url="{{.Link}}/delete" data-modal="#runner-delete-modal"> {{ctx.Locale.Tr "actions.runners.delete_runner"}}</button> </div> </form> diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl index e5907da8e8..43321a8dc5 100644 --- a/templates/shared/actions/runner_list.tmpl +++ b/templates/shared/actions/runner_list.tmpl @@ -16,7 +16,7 @@ <div class="header"> Registration Token </div> - <div class="ui input"> + <div class="ui action input"> <input type="text" value="{{.RegistrationToken}}" readonly> <button class="ui basic label button" aria-label="{{ctx.Locale.Tr "copy"}}" data-clipboard-text="{{.RegistrationToken}}"> {{svg "octicon-copy" 14}} @@ -64,30 +64,26 @@ </tr> </thead> <tbody> - {{if .Runners}} - {{range .Runners}} + {{range .Runners}} <tr> - <td> - <span class="ui {{if .IsOnline}}green{{end}} label">{{.StatusLocaleName ctx.Locale}}</span> - </td> + <td><span class="ui label {{if .IsOnline}}green{{end}}">{{.StatusLocaleName ctx.Locale}}</span></td> <td>{{.ID}}</td> <td><p data-tooltip-content="{{.Description}}">{{.Name}}</p></td> <td>{{if .Version}}{{.Version}}{{else}}{{ctx.Locale.Tr "unknown"}}{{end}}</td> <td><span data-tooltip-content="{{.BelongsToOwnerName}}">{{.BelongsToOwnerType.LocaleString ctx.Locale}}</span></td> - <td class="tw-flex tw-flex-wrap tw-gap-2 runner-tags"> - {{range .AgentLabels}}<span class="ui label">{{.}}</span>{{end}} + <td> + <span class="flex-text-inline">{{range .AgentLabels}}<span class="ui label">{{.}}</span>{{end}}</span> </td> <td>{{if .LastOnline}}{{DateUtils.TimeSince .LastOnline}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</td> - <td class="runner-ops"> - {{if .Editable $.RunnerOwnerID $.RunnerRepoID}} - <a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a> + <td> + {{if .EditableInContext $.RunnerOwnerID $.RunnerRepoID}} + <a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a> {{end}} </td> </tr> - {{end}} {{else}} <tr> - <td class="center aligned" colspan="8">{{ctx.Locale.Tr "actions.runners.none"}}</td> + <td class="tw-text-center" colspan="8">{{ctx.Locale.Tr "actions.runners.none"}}</td> </tr> {{end}} </tbody> diff --git a/templates/shared/avatar_upload_crop.tmpl b/templates/shared/avatar_upload_crop.tmpl new file mode 100644 index 0000000000..3bc012dd99 --- /dev/null +++ b/templates/shared/avatar_upload_crop.tmpl @@ -0,0 +1,8 @@ +{{- /* we do not need to set for/id here, global aria init code will add them automatically */ -}} +<label>{{.LabelText}}</label> +<input class="avatar-file-with-cropper" name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp" data-global-init="initAvatarUploader"> +{{- /* the cropper-panel must be next sibling of the input "avatar" */ -}} +<div class="cropper-panel tw-hidden"> + <div class="tw-my-2">{{ctx.Locale.Tr "settings.cropper_prompt"}}</div> + <div class="cropper-wrapper"><img class="cropper-source" src alt></div> +</div> diff --git a/templates/shared/combomarkdowneditor.tmpl b/templates/shared/combomarkdowneditor.tmpl index b1c3b29cf3..fa3e6c6ade 100644 --- a/templates/shared/combomarkdowneditor.tmpl +++ b/templates/shared/combomarkdowneditor.tmpl @@ -81,7 +81,7 @@ } </script> </div> - <div class="ui tab markup" data-tab-panel="markdown-previewer"> + <div class="ui tab" data-tab-panel="markdown-previewer"> {{ctx.Locale.Tr "loading"}} </div> <div class="markdown-add-table-panel tippy-target"> diff --git a/templates/shared/issueicon.tmpl b/templates/shared/issueicon.tmpl index f828de5c66..bb6247c708 100644 --- a/templates/shared/issueicon.tmpl +++ b/templates/shared/issueicon.tmpl @@ -1,3 +1,4 @@ +{{/* the logic should be kept the same as getIssueIcon/getIssueColor in JS code */}} {{- if .IsPull -}} {{- if not .PullRequest -}} No PullRequest @@ -6,7 +7,7 @@ {{- if .PullRequest.HasMerged -}} {{- svg "octicon-git-merge" 16 "text purple" -}} {{- else -}} - {{- svg "octicon-git-pull-request" 16 "text red" -}} + {{- svg "octicon-git-pull-request-closed" 16 "text red" -}} {{- end -}} {{- else -}} {{- if .PullRequest.IsWorkInProgress ctx -}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index e8015b40ea..98c26b32dc 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -3,11 +3,14 @@ {{range .Issues}} <div class="flex-item"> - <div class="flex-item-icon"> - {{if $.CanWriteIssuesOrPulls}} - <input type="checkbox" autocomplete="off" class="issue-checkbox tw-mr-4" data-issue-id={{.ID}} aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}} "{{.Title}}""> - {{end}} - {{template "shared/issueicon" .}} + <div class="flex-item-leading"> + {{/* using some tw helpers is the only way to align the checkbox */}} + <div class="flex-text-inline tw-mt-[2px]"> + {{if $.CanWriteIssuesOrPulls}} + <input type="checkbox" autocomplete="off" class="issue-checkbox tw-mr-[14px]" data-issue-id={{.ID}} aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}} "{{.Title}}""> + {{end}} + {{template "shared/issueicon" .}} + </div> </div> <div class="flex-item-main"> @@ -19,7 +22,7 @@ {{template "repo/commit_statuses" dict "Status" (index $.CommitLastStatus .PullRequest.ID) "Statuses" (index $.CommitStatuses .PullRequest.ID)}} {{end}} {{end}} - <span class="labels-list tw-ml-1"> + <span class="labels-list"> {{range .Labels}} <a href="?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.RenderUtils.RenderLabel .}}</a> {{end}} @@ -28,7 +31,7 @@ {{if .TotalTrackedTime}} <div class="text grey flex-text-block"> {{svg "octicon-clock" 16}} - {{.TotalTrackedTime | Sec2Time}} + {{.TotalTrackedTime | Sec2Hour}} </div> {{end}} </div> @@ -153,6 +156,11 @@ </div> {{end}} </div> + {{else}} + <div class="tw-text-center tw-p-8"> + <h3 class="tw-my-4">{{ctx.Locale.Tr "repo.issues.filter_no_results"}}</h3> + <p class="tw-text-placeholder-text">{{ctx.Locale.Tr "repo.issues.filter_no_results_placeholder"}}</p> + </div> {{end}} {{if .IssueIndexerUnavailable}} <div class="ui error message"> diff --git a/templates/explore/repo_list.tmpl b/templates/shared/repo/list.tmpl index 219b1255c0..2c8af14f9c 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/shared/repo/list.tmpl @@ -2,12 +2,16 @@ {{range .Repos}} <div class="flex-item"> <div class="flex-item-leading"> - {{template "repo/icon" .}} + {{if $.ShowRepoOwnerAvatar}} + {{ctx.AvatarUtils.Avatar .Owner 24}} + {{else}} + {{template "repo/icon" .}} + {{end}} </div> <div class="flex-item-main"> <div class="flex-item-header"> <div class="flex-item-title"> - {{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}} + {{if and $.ShowRepoOwnerOnList .Owner}} <a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/ {{end}} <a class="text primary name" href="{{.Link}}">{{.Name}}</a> @@ -39,12 +43,12 @@ {{end}} {{if not $.DisableStars}} <a class="flex-text-inline" href="{{.Link}}/stars"> - <span aria-label="{{ctx.Locale.Tr "repo.stars"}}">{{svg "octicon-star" 16}}</span> + <span class="tw-contents" aria-label="{{ctx.Locale.Tr "repo.stars"}}">{{svg "octicon-star" 16}}</span> <span {{if ge .NumStars 1000}}data-tooltip-content="{{.NumStars}}"{{end}}>{{CountFmt .NumStars}}</span> </a> {{end}} <a class="flex-text-inline" href="{{.Link}}/forks"> - <span aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-git-branch" 16}}</span> + <span class="tw-contents" aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-git-branch" 16}}</span> <span {{if ge .NumForks 1000}}data-tooltip-content="{{.NumForks}}"{{end}}>{{CountFmt .NumForks}}</span> </a> </div> diff --git a/templates/shared/repo_search.tmpl b/templates/shared/repo/search.tmpl index 7fcb5d2361..a909061184 100644 --- a/templates/shared/repo_search.tmpl +++ b/templates/shared/repo/search.tmpl @@ -1,5 +1,5 @@ <div class="ui small secondary filter menu"> - <form id="repo-search-form" class="ui form ignore-dirty tw-flex-1 tw-flex tw-gap-x-2"> + <form id="repo-search-form" class="ui form ignore-dirty tw-flex-1 tw-flex tw-items-center tw-gap-x-2"> {{if .Language}}<input type="hidden" name="language" value="{{.Language}}">{{end}} {{if .PageIsExploreRepositories}}<input type="hidden" name="only_show_relevant" value="{{.OnlyShowRelevant}}">{{end}} {{if .TabName}}<input type="hidden" name="tab" value="{{.TabName}}">{{end}} diff --git a/templates/shared/search/code/results.tmpl b/templates/shared/search/code/results.tmpl index a98a662654..8a08f5c25c 100644 --- a/templates/shared/search/code/results.tmpl +++ b/templates/shared/search/code/results.tmpl @@ -1,7 +1,7 @@ <div class="flex-text-block tw-flex-wrap"> {{range $term := .SearchResultLanguages}} <a class="ui {{if eq $.Language $term.Language}}primary{{end}} basic label tw-m-0" - href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&fuzzy={{$.IsFuzzy}}"> + href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&search_mode={{$.SelectedSearchMode}}"> <i class="color-icon tw-mr-2" style="background-color: {{$term.Color}}"></i> {{$term.Language}} <div class="detail">{{$term.Count}}</div> @@ -11,7 +11,7 @@ <div class="repository search"> {{range $result := .SearchResults}} {{$repo := or $.Repo (index $.RepoMaps .RepoID)}} - <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result"> + <div class="diff-file-box file-content non-diff-file-content repo-search-result"> <h4 class="ui top attached header tw-font-normal tw-flex tw-flex-wrap"> {{if not $.Repo}} <span class="file tw-flex-1"> diff --git a/templates/shared/search/code/search.tmpl b/templates/shared/search/code/search.tmpl index dde45c0fbf..2041213e19 100644 --- a/templates/shared/search/code/search.tmpl +++ b/templates/shared/search/code/search.tmpl @@ -1,5 +1,11 @@ <form class="ui form ignore-dirty"> - {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "Disabled" .CodeIndexerUnavailable "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.code_kind")}} + {{template "shared/search/combo" (dict + "Disabled" .CodeIndexerUnavailable + "Value" .Keyword + "Placeholder" (ctx.Locale.Tr "search.code_kind") + "SearchModes" .SearchModes + "SelectedSearchMode" .SelectedSearchMode + )}} </form> <div class="divider"></div> <div class="ui list"> diff --git a/templates/shared/search/combo.tmpl b/templates/shared/search/combo.tmpl index 788db95cc1..3aba9a7f04 100644 --- a/templates/shared/search/combo.tmpl +++ b/templates/shared/search/combo.tmpl @@ -1,8 +1,30 @@ -{{/* Value - value of the search field (for search results page) */}} -{{/* Disabled (optional) - if search field/button has to be disabled */}} -{{/* Placeholder (optional) - placeholder text to be used */}} -{{/* Tooltip (optional) - a tooltip to be displayed on button hover */}} +{{/* Attributes: +* Value - value of the search field (for search results page) +* Disabled (optional) - if search field/button has to be disabled +* Placeholder (optional) - placeholder text to be used +* Tooltip (optional) - a tooltip to be displayed on button hover +* SearchModes - a list of search modes to be displayed in the dropdown +* SelectedSearchMode - the currently selected search mode +*/}} <div class="ui small fluid action input"> {{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}} + {{if .SearchModes}} + <div class="ui small dropdown selection {{if .Disabled}}disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}"> + <div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <input name="search_mode" type="hidden" value=" + {{- if .SelectedSearchMode -}} + {{- .SelectedSearchMode -}} + {{- else -}} + {{- $defaultSearchMode := index .SearchModes 0 -}} + {{- $defaultSearchMode.ModeValue -}} + {{- end -}} + "> + <div class="menu"> + {{range $mode := .SearchModes}} + <div class="item" data-value="{{$mode.ModeValue}}" data-tooltip-content="{{ctx.Locale.Tr $mode.TooltipTrKey}}">{{ctx.Locale.Tr $mode.TitleTrKey}}</div> + {{end}} + </div> + </div> + {{end}} {{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}} </div> diff --git a/templates/shared/search/combo_fuzzy.tmpl b/templates/shared/search/combo_fuzzy.tmpl deleted file mode 100644 index 3540a89ecb..0000000000 --- a/templates/shared/search/combo_fuzzy.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -{{/* Value - value of the search field (for search results page) */}} -{{/* Disabled (optional) - if search field/button has to be disabled */}} -{{/* Placeholder (optional) - placeholder text to be used */}} -{{/* IsFuzzy - state of the fuzzy search toggle */}} -{{/* Tooltip (optional) - a tooltip to be displayed on button hover */}} -<div class="ui small fluid action input"> - {{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}} - {{template "shared/search/fuzzy" dict "Disabled" .Disabled "IsFuzzy" .IsFuzzy}} - {{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}} -</div> diff --git a/templates/shared/search/fuzzy.tmpl b/templates/shared/search/fuzzy.tmpl deleted file mode 100644 index 5c09d3c150..0000000000 --- a/templates/shared/search/fuzzy.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -{{/* Disabled (optional) - if dropdown has to be disabled */}} -{{/* IsFuzzy - state of the fuzzy search toggle */}} -<div class="ui small dropdown selection {{if .Disabled}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}"> - <input name="fuzzy" type="hidden"{{if .Disabled}} disabled{{end}} value="{{.IsFuzzy}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="text">{{if .IsFuzzy}}{{ctx.Locale.Tr "search.fuzzy"}}{{else}}{{ctx.Locale.Tr "search.exact"}}{{end}}</div> - <div class="menu"> - <div class="item" data-value="true" data-tooltip-content="{{ctx.Locale.Tr "search.fuzzy_tooltip"}}">{{ctx.Locale.Tr "search.fuzzy"}}</div> - <div class="item" data-value="false" data-tooltip-content="{{ctx.Locale.Tr "search.exact_tooltip"}}">{{ctx.Locale.Tr "search.exact"}}</div> - </div> -</div> diff --git a/templates/shared/secrets/add_list.tmpl b/templates/shared/secrets/add_list.tmpl index 59596d1013..44305e9502 100644 --- a/templates/shared/secrets/add_list.tmpl +++ b/templates/shared/secrets/add_list.tmpl @@ -4,9 +4,13 @@ <button class="ui primary tiny button show-modal" data-modal="#add-secret-modal" data-modal-form.action="{{.Link}}" - data-modal-header="{{ctx.Locale.Tr "secrets.creation"}}" + data-modal-header="{{ctx.Locale.Tr "secrets.add_secret"}}" + data-modal-secret-name.value="" + data-modal-secret-name.read-only="false" + data-modal-secret-data="" + data-modal-secret-description="" > - {{ctx.Locale.Tr "secrets.creation"}} + {{ctx.Locale.Tr "secrets.add_secret"}} </button> </div> </h4> @@ -23,6 +27,9 @@ {{.Name}} </div> <div class="flex-item-body"> + {{if .Description}}{{.Description}}{{else}}-{{end}} + </div> + <div class="flex-item-body"> ****** </div> </div> @@ -30,7 +37,19 @@ <span class="color-text-light-2"> {{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} </span> - <button class="ui btn interact-bg link-action tw-p-2" + <button class="btn interact-bg show-modal tw-p-2" + data-modal="#add-secret-modal" + data-modal-form.action="{{$.Link}}" + data-modal-header="{{ctx.Locale.Tr "secrets.edit_secret"}}" + data-tooltip-content="{{ctx.Locale.Tr "secrets.edit_secret"}}" + data-modal-secret-name.value="{{.Name}}" + data-modal-secret-name.read-only="true" + data-modal-secret-data="" + data-modal-secret-description="{{if .Description}}{{.Description}}{{end}}" + > + {{svg "octicon-pencil"}} + </button> + <button class="btn interact-bg link-action tw-p-2" data-url="{{$.Link}}/delete?id={{.ID}}" data-modal-confirm="{{ctx.Locale.Tr "secrets.deletion.description"}}" data-tooltip-content="{{ctx.Locale.Tr "secrets.deletion"}}" @@ -48,9 +67,7 @@ {{/* Add secret dialog */}} <div class="ui small modal" id="add-secret-modal"> - <div class="header"> - <span id="actions-modal-header"></span> - </div> + <div class="header"></div> <form class="ui form form-fetch-action" method="post"> <div class="content"> {{.CsrfTokenHtml}} @@ -72,9 +89,20 @@ <textarea required id="secret-data" name="data" + maxlength="{{.DataMaxLength}}" placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}" ></textarea> </div> + <div class="field"> + <label for="secret-description">{{ctx.Locale.Tr "secrets.creation.description"}}</label> + <textarea + id="secret-description" + name="description" + rows="2" + maxlength="{{.DescriptionMaxLength}}" + placeholder="{{ctx.Locale.Tr "secrets.creation.description_placeholder"}}" + ></textarea> + </div> </div> {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} </form> diff --git a/templates/shared/user/authorlink.tmpl b/templates/shared/user/authorlink.tmpl index d57a635b4b..abfee6aae3 100644 --- a/templates/shared/user/authorlink.tmpl +++ b/templates/shared/user/authorlink.tmpl @@ -1 +1 @@ -<a class="author text black tw-font-semibold muted"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a>{{if .IsBot}}<span class="ui basic label tw-p-1">bot</span>{{end}} +<a class="author text black tw-font-semibold muted"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a>{{if .IsTypeBot}}<span class="ui basic label tw-p-1 tw-align-baseline">bot</span>{{end}} diff --git a/templates/shared/user/block_user_dialog.tmpl b/templates/shared/user/block_user_dialog.tmpl index c6db4ca1e4..e1fa939945 100644 --- a/templates/shared/user/block_user_dialog.tmpl +++ b/templates/shared/user/block_user_dialog.tmpl @@ -14,7 +14,7 @@ <input id="block-note" name="note"> <p class="help">{{ctx.Locale.Tr "user.block.note.info"}}</p> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button> <button class="ui red button">{{ctx.Locale.Tr "user.block.block"}}</button> </div> diff --git a/templates/shared/user/blocked_users.tmpl b/templates/shared/user/blocked_users.tmpl index e83a039ef5..a4c74c46ac 100644 --- a/templates/shared/user/blocked_users.tmpl +++ b/templates/shared/user/blocked_users.tmpl @@ -74,7 +74,7 @@ <input name="note" class="modal-note" /> <p class="help">{{ctx.Locale.Tr "user.block.note.info"}}</p> </div> - <div class="text right actions"> + <div class="actions"> <button class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "save"}}</button> </div> diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl index 91f04e0b53..1190dc54ec 100644 --- a/templates/shared/user/profile_big_avatar.tmpl +++ b/templates/shared/user/profile_big_avatar.tmpl @@ -103,7 +103,7 @@ <ul class="user-badges"> {{range .Badges}} <li> - <img width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}"> + <img loading="lazy" width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}"> </li> {{end}} </ul> diff --git a/templates/shared/variables/variable_list.tmpl b/templates/shared/variables/variable_list.tmpl index 7a0ab48cef..2edca431c1 100644 --- a/templates/shared/variables/variable_list.tmpl +++ b/templates/shared/variables/variable_list.tmpl @@ -7,6 +7,7 @@ data-modal-header="{{ctx.Locale.Tr "actions.variables.creation"}}" data-modal-dialog-variable-name="" data-modal-dialog-variable-data="" + data-modal-dialog-variable-description="" > {{ctx.Locale.Tr "actions.variables.creation"}} </button> @@ -25,6 +26,9 @@ {{.Name}} </div> <div class="flex-item-body"> + {{if .Description}}{{.Description}}{{else}}-{{end}} + </div> + <div class="flex-item-body"> {{.Data}} </div> </div> @@ -39,6 +43,7 @@ data-modal-header="{{ctx.Locale.Tr "actions.variables.edit"}}" data-modal-dialog-variable-name="{{.Name}}" data-modal-dialog-variable-data="{{.Data}}" + data-modal-dialog-variable-description="{{.Description}}" > {{svg "octicon-pencil"}} </button> @@ -82,9 +87,20 @@ <textarea required name="data" id="dialog-variable-data" + maxlength="{{.DataMaxLength}}" placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}" ></textarea> </div> + <div class="field"> + <label for="dialog-variable-description">{{ctx.Locale.Tr "secrets.creation.description"}}</label> + <textarea + name="description" + id="dialog-variable-description" + rows="2" + maxlength="{{.DescriptionMaxLength}}" + placeholder="{{ctx.Locale.Tr "secrets.creation.description_placeholder"}}" + ></textarea> + </div> </div> {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} </form> diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl index 0f80787c57..105212eb56 100644 --- a/templates/shared/webhook/icon.tmpl +++ b/templates/shared/webhook/icon.tmpl @@ -5,23 +5,23 @@ {{if eq .HookType "gitea"}} {{svg "gitea-gitea" $size "img"}} {{else if eq .HookType "gogs"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gogs.ico"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gogs.ico"> {{else if eq .HookType "slack"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/slack.png"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/slack.png"> {{else if eq .HookType "discord"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/discord.png"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/discord.png"> {{else if eq .HookType "dingtalk"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/dingtalk.ico"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/dingtalk.ico"> {{else if eq .HookType "telegram"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/telegram.png"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/telegram.png"> {{else if eq .HookType "msteams"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/msteams.png"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/msteams.png"> {{else if eq .HookType "feishu"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/feishu.png"> + {{svg "gitea-feishu" $size "img"}} {{else if eq .HookType "matrix"}} {{svg "gitea-matrix" $size "img"}} {{else if eq .HookType "wechatwork"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/wechatwork.png"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/wechatwork.png"> {{else if eq .HookType "packagist"}} - <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/packagist.png"> + <img alt width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/packagist.png"> {{end}} diff --git a/templates/status/404.tmpl b/templates/status/404.tmpl index 6cfc88a0d7..e83dcf463b 100644 --- a/templates/status/404.tmpl +++ b/templates/status/404.tmpl @@ -2,6 +2,7 @@ <div role="main" aria-label="{{.Title}}" class="page-content {{if .IsRepo}}repository{{end}}"> {{if .IsRepo}}{{template "repo/header" .}}{{end}} <div class="ui container"> + {{template "base/alert" .}} <div class="status-page-error"> <div class="status-page-error-title">404 Not Found</div> <div class="tw-text-center"> diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl index 198f1ea898..6dfa2d8a8c 100644 --- a/templates/status/500.tmpl +++ b/templates/status/500.tmpl @@ -38,7 +38,7 @@ {{if .ErrorMsg}} <div class="tw-mt-8"> <p>{{ctx.Locale.Tr "error.occurred"}}:</p> - <pre class="tw-whitespace-pre-wrap tw-break-all">{{.ErrorMsg}}</pre> + <pre class="tw-whitespace-pre-wrap tw-wrap-anywhere">{{.ErrorMsg}}</pre> </div> {{end}} <div class="tw-mt-8 tw-text-center"> diff --git a/templates/status/503.tmpl b/templates/status/503.tmpl new file mode 100644 index 0000000000..5b1db9fc07 --- /dev/null +++ b/templates/status/503.tmpl @@ -0,0 +1,12 @@ +{{template "base/head" .}} +<div role="main" aria-label="503 Service Unavailable" class="page-content"> + <div class="ui container"> + <div class="status-page-error"> + <div class="status-page-error-title">503 Service Unavailable</div> + <div class="tw-text-center"> + <div class="tw-my-4">{{ctx.Locale.Tr "error503"}}</div> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/swagger/ui.tmpl b/templates/swagger/ui.tmpl index 9935ab9c5a..c48ba82fe0 100644 --- a/templates/swagger/ui.tmpl +++ b/templates/swagger/ui.tmpl @@ -7,6 +7,7 @@ <body> <a class="swagger-back-link" href="{{AppSubUrl}}/">{{svg "octicon-reply"}}{{ctx.Locale.Tr "return_to_gitea"}}</a> <div id="swagger-ui" data-source="{{AppSubUrl}}/swagger.{{.APIJSONVersion}}.json"></div> + <footer class="page-footer"></footer> <script src="{{AssetUrlPrefix}}/js/swagger.js?v={{AssetVersion}}"></script> </body> </html> diff --git a/templates/swagger/v1_input.json b/templates/swagger/v1_input.json new file mode 100644 index 0000000000..e74c8fc9c4 --- /dev/null +++ b/templates/swagger/v1_input.json @@ -0,0 +1,6 @@ +{ + "info": { + "version": "{{.SwaggerAppVer}}" + }, + "basePath": "{{.SwaggerAppSubUrl}}/api/v1" +} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 82a301da2f..1cc3735b2b 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -19,9 +19,9 @@ "name": "MIT", "url": "http://opensource.org/licenses/MIT" }, - "version": "{{AppVer | JSEscape}}" + "version": "{{.SwaggerAppVer}}" }, - "basePath": "{{AppSubUrl | JSEscape}}/api/v1", + "basePath": "{{.SwaggerAppSubUrl}}/api/v1", "paths": { "/activitypub/user-id/{user-id}": { "get": { @@ -75,6 +75,218 @@ } } }, + "/admin/actions/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Lists all jobs", + "operationId": "listAdminWorkflowJobs", + "parameters": [ + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowJobsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/admin/actions/runners": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Get all runners", + "operationId": "getAdminRunners", + "responses": { + "200": { + "$ref": "#/definitions/ActionRunnersResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/admin/actions/runners/registration-token": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Get an global actions runner registration token", + "operationId": "adminCreateRunnerRegistrationToken", + "responses": { + "200": { + "$ref": "#/responses/RegistrationToken" + } + } + } + }, + "/admin/actions/runners/{runner_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Get an global runner", + "operationId": "getAdminRunner", + "parameters": [ + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/definitions/ActionRunner" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Delete an global runner", + "operationId": "deleteAdminRunner", + "parameters": [ + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "runner has been deleted" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/admin/actions/runs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Lists all runs", + "operationId": "listAdminWorkflowRuns", + "parameters": [ + { + "type": "string", + "description": "workflow event name", + "name": "event", + "in": "query" + }, + { + "type": "string", + "description": "workflow branch", + "name": "branch", + "in": "query" + }, + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "triggered by user", + "name": "actor", + "in": "query" + }, + { + "type": "string", + "description": "triggering sha of the workflow run", + "name": "head_sha", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowRunsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/admin/cron": { "get": { "produces": [ @@ -234,6 +446,18 @@ "description": "page size of results", "name": "limit", "in": "query" + }, + { + "enum": [ + "system", + "default", + "all" + ], + "type": "string", + "default": "system", + "description": "system, default or both kinds of webhooks", + "name": "type", + "in": "query" } ], "responses": { @@ -542,7 +766,7 @@ }, { "type": "string", - "description": "user's login name to search for", + "description": "identifier of the user, provided by the external authenticator", "name": "login_name", "in": "query" }, @@ -618,7 +842,7 @@ "parameters": [ { "type": "string", - "description": "username of user to delete", + "description": "username of the user to delete", "name": "username", "in": "path", "required": true @@ -660,7 +884,7 @@ "parameters": [ { "type": "string", - "description": "username of user to edit", + "description": "username of the user whose data is to be edited", "name": "username", "in": "path", "required": true @@ -702,7 +926,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose badges are to be listed", "name": "username", "in": "path", "required": true @@ -732,7 +956,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user to whom a badge is to be added", "name": "username", "in": "path", "required": true @@ -766,7 +990,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose badge is to be deleted", "name": "username", "in": "path", "required": true @@ -808,7 +1032,7 @@ "parameters": [ { "type": "string", - "description": "username of the user", + "description": "username of the user who is to receive a public key", "name": "username", "in": "path", "required": true @@ -847,7 +1071,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose public key is to be deleted", "name": "username", "in": "path", "required": true @@ -890,7 +1114,7 @@ "parameters": [ { "type": "string", - "description": "username of the user that will own the created organization", + "description": "username of the user who will own the created organization", "name": "username", "in": "path", "required": true @@ -930,7 +1154,7 @@ "parameters": [ { "type": "string", - "description": "existing username of user", + "description": "current username of the user", "name": "username", "in": "path", "required": true @@ -973,7 +1197,7 @@ "parameters": [ { "type": "string", - "description": "username of the user. This user will own the created repository", + "description": "username of the user who will own the created repository", "name": "username", "in": "path", "required": true @@ -1685,6 +1909,88 @@ } } }, + "/orgs/{org}/actions/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get org-level workflow jobs", + "operationId": "getOrgWorkflowJobs", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowJobsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/actions/runners": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get org-level runners", + "operationId": "getOrgRunners", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/definitions/ActionRunnersResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/orgs/{org}/actions/runners/registration-token": { "get": { "produces": [ @@ -1709,6 +2015,180 @@ "$ref": "#/responses/RegistrationToken" } } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get an organization's actions runner registration token", + "operationId": "orgCreateRunnerRegistrationToken", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/RegistrationToken" + } + } + } + }, + "/orgs/{org}/actions/runners/{runner_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get an org-level runner", + "operationId": "getOrgRunner", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/definitions/ActionRunner" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Delete an org-level runner", + "operationId": "deleteOrgRunner", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "runner has been deleted" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/actions/runs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get org-level workflow runs", + "operationId": "getOrgWorkflowRuns", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "workflow event name", + "name": "event", + "in": "query" + }, + { + "type": "string", + "description": "workflow branch", + "name": "branch", + "in": "query" + }, + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "triggered by user", + "name": "actor", + "in": "query" + }, + { + "type": "string", + "description": "triggering sha of the workflow run", + "name": "head_sha", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowRunsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } } }, "/orgs/{org}/actions/secrets": { @@ -2013,16 +2493,16 @@ ], "responses": { "201": { - "description": "response when creating an org-level variable" - }, - "204": { - "description": "response when creating an org-level variable" + "description": "successfully created the org-level variable" }, "400": { "$ref": "#/responses/error" }, - "404": { - "$ref": "#/responses/notFound" + "409": { + "description": "variable name already exists." + }, + "500": { + "$ref": "#/responses/error" } } }, @@ -2236,7 +2716,7 @@ }, { "type": "string", - "description": "user to check", + "description": "username of the user to check", "name": "username", "in": "path", "required": true @@ -2267,7 +2747,7 @@ }, { "type": "string", - "description": "user to block", + "description": "username of the user to block", "name": "username", "in": "path", "required": true @@ -2307,7 +2787,7 @@ }, { "type": "string", - "description": "user to unblock", + "description": "username of the user to unblock", "name": "username", "in": "path", "required": true @@ -2778,7 +3258,7 @@ }, { "type": "string", - "description": "username of the user", + "description": "username of the user to check for an organization membership", "name": "username", "in": "path", "required": true @@ -2815,7 +3295,7 @@ }, { "type": "string", - "description": "username of the user", + "description": "username of the user to remove from the organization", "name": "username", "in": "path", "required": true @@ -2889,7 +3369,7 @@ }, { "type": "string", - "description": "username of the user", + "description": "username of the user to check for a public organization membership", "name": "username", "in": "path", "required": true @@ -2923,7 +3403,7 @@ }, { "type": "string", - "description": "username of the user", + "description": "username of the user whose membership is to be publicized", "name": "username", "in": "path", "required": true @@ -2960,7 +3440,7 @@ }, { "type": "string", - "description": "username of the user", + "description": "username of the user whose membership is to be concealed", "name": "username", "in": "path", "required": true @@ -2979,6 +3459,46 @@ } } }, + "/orgs/{org}/rename": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Rename an organization", + "operationId": "renameOrg", + "parameters": [ + { + "type": "string", + "description": "existing org name", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RenameOrgOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, "/orgs/{org}/repos": { "get": { "produces": [ @@ -3287,6 +3807,191 @@ } } }, + "/packages/{owner}/{type}/{name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "package" + ], + "summary": "Gets all versions of a package", + "operationId": "listPackageVersions", + "parameters": [ + { + "type": "string", + "description": "owner of the package", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "type of the package", + "name": "type", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the package", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/PackageList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/packages/{owner}/{type}/{name}/-/latest": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "package" + ], + "summary": "Gets the latest version of a package", + "operationId": "getLatestPackageVersion", + "parameters": [ + { + "type": "string", + "description": "owner of the package", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "type of the package", + "name": "type", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the package", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Package" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/packages/{owner}/{type}/{name}/-/link/{repo_name}": { + "post": { + "tags": [ + "package" + ], + "summary": "Link a package to a repository", + "operationId": "linkPackage", + "parameters": [ + { + "type": "string", + "description": "owner of the package", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "type of the package", + "name": "type", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the package", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository to link.", + "name": "repo_name", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/packages/{owner}/{type}/{name}/-/unlink": { + "post": { + "tags": [ + "package" + ], + "summary": "Unlink a package from a repository", + "operationId": "unlinkPackage", + "parameters": [ + { + "type": "string", + "description": "owner of the package", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "type of the package", + "name": "type", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the package", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/packages/{owner}/{type}/{name}/{version}": { "get": { "produces": [ @@ -3867,6 +4572,375 @@ } } }, + "/repos/{owner}/{repo}/actions/artifacts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Lists all artifacts for a repository", + "operationId": "getArtifacts", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the artifact", + "name": "name", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/ArtifactsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/artifacts/{artifact_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets a specific artifact for a workflow run", + "operationId": "getArtifact", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the artifact", + "name": "artifact_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Artifact" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Deletes a specific artifact for a workflow run", + "operationId": "deleteArtifact", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the artifact", + "name": "artifact_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/zip": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Downloads a specific artifact for a workflow run redirects to blob url", + "operationId": "downloadArtifact", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the artifact", + "name": "artifact_id", + "in": "path", + "required": true + } + ], + "responses": { + "302": { + "description": "redirect to the blob download" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Lists all jobs for a repository", + "operationId": "listWorkflowJobs", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowJobsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/jobs/{job_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets a specific workflow job for a workflow run", + "operationId": "getWorkflowJob", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the job", + "name": "job_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowJob" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/jobs/{job_id}/logs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Downloads the job logs for a workflow run", + "operationId": "downloadActionsRunJobLogs", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "id of the job", + "name": "job_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "output blob content" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/runners": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get repo-level runners", + "operationId": "getRepoRunners", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/definitions/ActionRunnersResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/repos/{owner}/{repo}/actions/runners/registration-token": { "get": { "produces": [ @@ -3898,6 +4972,414 @@ "$ref": "#/responses/RegistrationToken" } } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a repository's actions runner registration token", + "operationId": "repoCreateRunnerRegistrationToken", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/RegistrationToken" + } + } + } + }, + "/repos/{owner}/{repo}/actions/runners/{runner_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get an repo-level runner", + "operationId": "getRepoRunner", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/definitions/ActionRunner" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete an repo-level runner", + "operationId": "deleteRepoRunner", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "runner has been deleted" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/runs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Lists all runs for a repository run", + "operationId": "getWorkflowRuns", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "workflow event name", + "name": "event", + "in": "query" + }, + { + "type": "string", + "description": "workflow branch", + "name": "branch", + "in": "query" + }, + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "triggered by user", + "name": "actor", + "in": "query" + }, + { + "type": "string", + "description": "triggering sha of the workflow run", + "name": "head_sha", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/ArtifactsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/runs/{run}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets a specific workflow run", + "operationId": "GetWorkflowRun", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the run", + "name": "run", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowRun" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a workflow run", + "operationId": "deleteActionRun", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "runid of the workflow run", + "name": "run", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/runs/{run}/artifacts": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Lists all artifacts for a repository run", + "operationId": "getArtifactsOfRun", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "runid of the workflow run", + "name": "run", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the artifact", + "name": "name", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/ArtifactsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/runs/{run}/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Lists all jobs for a workflow run", + "operationId": "listWorkflowRunJobs", + "parameters": [ + { + "type": "string", + "description": "name of the owner", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "runid of the workflow run", + "name": "run", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowJobsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } } }, "/repos/{owner}/{repo}/actions/secrets": { @@ -4043,7 +5525,7 @@ ], "responses": { "204": { - "description": "delete one secret of the organization" + "description": "delete one secret of the repository" }, "400": { "$ref": "#/responses/error" @@ -4307,14 +5789,14 @@ "201": { "description": "response when creating a repo-level variable" }, - "204": { - "description": "response when creating a repo-level variable" - }, "400": { "$ref": "#/responses/error" }, - "404": { - "$ref": "#/responses/notFound" + "409": { + "description": "variable name already exists." + }, + "500": { + "$ref": "#/responses/error" } } }, @@ -4369,6 +5851,275 @@ } } }, + "/repos/{owner}/{repo}/actions/workflows": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List repository workflows", + "operationId": "ActionsListRepositoryWorkflows", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActionWorkflowList" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "500": { + "$ref": "#/responses/error" + } + } + } + }, + "/repos/{owner}/{repo}/actions/workflows/{workflow_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a workflow", + "operationId": "ActionsGetWorkflow", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the workflow", + "name": "workflow_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActionWorkflow" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "500": { + "$ref": "#/responses/error" + } + } + } + }, + "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Disable a workflow", + "operationId": "ActionsDisableWorkflow", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the workflow", + "name": "workflow_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a workflow dispatch event", + "operationId": "ActionsDispatchWorkflow", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the workflow", + "name": "workflow_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateActionWorkflowDispatch" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Enable a workflow", + "operationId": "ActionsEnableWorkflow", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "id of the workflow", + "name": "workflow_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/conflict" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, "/repos/{owner}/{repo}/activities/feeds": { "get": { "produces": [ @@ -5179,7 +6930,7 @@ }, { "type": "string", - "description": "username of the collaborator", + "description": "username of the user to check for being a collaborator", "name": "collaborator", "in": "path", "required": true @@ -5223,7 +6974,7 @@ }, { "type": "string", - "description": "username of the collaborator to add", + "description": "username of the user to add or update as a collaborator", "name": "collaborator", "in": "path", "required": true @@ -5323,7 +7074,7 @@ }, { "type": "string", - "description": "username of the collaborator", + "description": "username of the collaborator whose permissions are to be obtained", "name": "collaborator", "in": "path", "required": true @@ -5380,6 +7131,20 @@ "in": "query" }, { + "type": "string", + "format": "date-time", + "description": "Only commits after this date will be returned (ISO 8601 format)", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only commits before this date will be returned (ISO 8601 format)", + "name": "until", + "in": "query" + }, + { "type": "boolean", "description": "include diff stats for every commit (disable for speedup, default 'true')", "name": "stat", @@ -5659,13 +7424,14 @@ }, "/repos/{owner}/{repo}/contents": { "get": { + "description": "This API follows GitHub's design, and it is not easy to use. Recommend users to use our \"contents-ext\" API instead.", "produces": [ "application/json" ], "tags": [ "repository" ], - "summary": "Gets the metadata of all the entries of the root dir", + "summary": "Gets the metadata of all the entries of the root dir.", "operationId": "repoGetContentsList", "parameters": [ { @@ -5684,7 +7450,7 @@ }, { "type": "string", - "description": "The name of the commit/branch/tag. Default the repositoryโs default branch (usually master)", + "description": "The name of the commit/branch/tag. Default to the repositoryโs default branch.", "name": "ref", "in": "query" } @@ -5753,15 +7519,72 @@ } } }, + "/repos/{owner}/{repo}/contents-ext/{filepath}": { + "get": { + "description": "It guarantees that only one of the response fields is set if the request succeeds. Users can pass \"includes=file_content\" or \"includes=lfs_metadata\" to retrieve more fields. \"includes=file_content\" only works for single file, if you need to retrieve file contents in batch, use \"file-contents\" API after listing the directory.", + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "The extended \"contents\" API, to get file metadata and/or content, or list a directory.", + "operationId": "repoGetContentsExt", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "path of the dir, file, symlink or submodule in the repo. Swagger requires path parameter to be \"required\", you can leave it empty or pass a single dot (\".\") to get the root directory.", + "name": "filepath", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "the name of the commit/branch/tag, default to the repositoryโs default branch.", + "name": "ref", + "in": "query" + }, + { + "type": "string", + "description": "By default this API's response only contains file's metadata. Use comma-separated \"includes\" options to retrieve more fields. Option \"file_content\" will try to retrieve the file content, \"lfs_metadata\" will try to retrieve LFS metadata, \"commit_metadata\" will try to retrieve commit metadata, and \"commit_message\" will try to retrieve commit message.", + "name": "includes", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/ContentsExtResponse" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/repos/{owner}/{repo}/contents/{filepath}": { "get": { + "description": "This API follows GitHub's design, and it is not easy to use. Recommend users to use the \"contents-ext\" API instead.", "produces": [ "application/json" ], "tags": [ "repository" ], - "summary": "Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir", + "summary": "Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir.", "operationId": "repoGetContents", "parameters": [ { @@ -5787,7 +7610,7 @@ }, { "type": "string", - "description": "The name of the commit/branch/tag. Default the repositoryโs default branch (usually master)", + "description": "The name of the commit/branch/tag. Default to the repositoryโs default branch.", "name": "ref", "in": "query" } @@ -5979,6 +7802,9 @@ "404": { "$ref": "#/responses/error" }, + "422": { + "$ref": "#/responses/error" + }, "423": { "$ref": "#/responses/repoArchivedError" } @@ -6069,7 +7895,7 @@ }, { "type": "string", - "description": "The name of the commit/branch/tag. Default the repositoryโs default branch (usually master)", + "description": "The name of the commit/branch/tag. Default to the repositoryโs default branch.", "name": "ref", "in": "query" } @@ -6084,6 +7910,105 @@ } } }, + "/repos/{owner}/{repo}/file-contents": { + "get": { + "description": "See the POST method. This GET method supports using JSON encoded request body in query parameter.", + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get the metadata and contents of requested files", + "operationId": "repoGetFileContents", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag. Default to the repositoryโs default branch.", + "name": "ref", + "in": "query" + }, + { + "type": "string", + "description": "The JSON encoded body (see the POST request): {\"files\": [\"filename1\", \"filename2\"]}", + "name": "body", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ContentsListResponse" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "description": "Uses automatic pagination based on default page size and max response size and returns the maximum allowed number of files. Files which could not be retrieved are null. Files which are too large are being returned with `encoding == null`, `content == null` and `size \u003e 0`, they can be requested separately by using the `download_url`.", + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get the metadata and contents of requested files", + "operationId": "repoGetFileContentsPost", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag. Default to the repositoryโs default branch.", + "name": "ref", + "in": "query" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/GetFilesOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/ContentsListResponse" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/repos/{owner}/{repo}/forks": { "get": { "produces": [ @@ -9305,6 +11230,111 @@ } } }, + "/repos/{owner}/{repo}/issues/{index}/lock": { + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Lock an issue", + "operationId": "issueLockIssue", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "index of the issue", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/LockIssueOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Unlock an issue", + "operationId": "issueUnlockIssue", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "index of the issue", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/repos/{owner}/{repo}/issues/{index}/pin": { "post": { "tags": [ @@ -9666,7 +11696,7 @@ "$ref": "#/responses/notFound" }, "409": { - "description": "Cannot cancel a non existent stopwatch" + "description": "Cannot cancel a non-existent stopwatch" } } } @@ -9772,7 +11802,7 @@ "$ref": "#/responses/notFound" }, "409": { - "description": "Cannot stop a non existent stopwatch" + "description": "Cannot stop a non-existent stopwatch" } } } @@ -9921,7 +11951,7 @@ }, { "type": "string", - "description": "user to subscribe", + "description": "username of the user to subscribe the issue to", "name": "user", "in": "path", "required": true @@ -9979,7 +12009,7 @@ }, { "type": "string", - "description": "user witch unsubscribe", + "description": "username of the user to unsubscribe from an issue", "name": "user", "in": "path", "required": true @@ -10849,7 +12879,7 @@ }, { "type": "string", - "description": "The name of the commit/branch/tag. Default the repositoryโs default branch", + "description": "The name of the commit/branch/tag. Default to the repositoryโs default branch", "name": "ref", "in": "query" } @@ -10867,6 +12897,52 @@ } } }, + "/repos/{owner}/{repo}/merge-upstream": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Merge a branch from upstream", + "operationId": "repoMergeUpstream", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/MergeUpstreamRequest" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/MergeUpstreamResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/repos/{owner}/{repo}/milestones": { "get": { "produces": [ @@ -11361,6 +13437,12 @@ "required": true }, { + "type": "string", + "description": "Filter by target base branch of the pull request", + "name": "base_branch", + "in": "query" + }, + { "enum": [ "open", "closed", @@ -11376,6 +13458,7 @@ "enum": [ "oldest", "recentupdate", + "recentclose", "leastupdate", "mostcomment", "leastcomment", @@ -12940,7 +15023,7 @@ }, { "type": "string", - "description": "The name of the commit/branch/tag. Default the repositoryโs default branch", + "description": "The name of the commit/branch/tag. Default to the repositoryโs default branch", "name": "ref", "in": "query" } @@ -13668,6 +15751,42 @@ } } }, + "/repos/{owner}/{repo}/signing-key.pub": { + "get": { + "produces": [ + "text/plain" + ], + "tags": [ + "repository" + ], + "summary": "Get signing-key.pub for given repository", + "operationId": "repoSigningKeySSH", + "parameters": [ + { + "type": "string", + "description": "owner of the repo", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "ssh public key", + "schema": { + "type": "string" + } + } + } + } + }, "/repos/{owner}/{repo}/stargazers": { "get": { "produces": [ @@ -13710,6 +15829,9 @@ "200": { "$ref": "#/responses/UserList" }, + "403": { + "$ref": "#/responses/forbidden" + }, "404": { "$ref": "#/responses/notFound" } @@ -14699,7 +16821,7 @@ }, { "type": "string", - "description": "username of user", + "description": "username of the user whose tracked times are to be listed", "name": "user", "in": "path", "required": true @@ -15498,6 +17620,26 @@ } } }, + "/signing-key.pub": { + "get": { + "produces": [ + "text/plain" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Get default signing-key.pub", + "operationId": "getSigningKeySSH", + "responses": { + "200": { + "description": "ssh public key", + "schema": { + "type": "string" + } + } + } + } + }, "/teams/{id}": { "get": { "produces": [ @@ -15702,7 +17844,7 @@ }, { "type": "string", - "description": "username of the member to list", + "description": "username of the user whose data is to be listed", "name": "username", "in": "path", "required": true @@ -15737,7 +17879,7 @@ }, { "type": "string", - "description": "username of the user to add", + "description": "username of the user to add to a team", "name": "username", "in": "path", "required": true @@ -15775,7 +17917,7 @@ }, { "type": "string", - "description": "username of the user to remove", + "description": "username of the user to remove from a team", "name": "username", "in": "path", "required": true @@ -16029,6 +18171,72 @@ } } }, + "/user/actions/jobs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get workflow jobs", + "operationId": "getUserWorkflowJobs", + "parameters": [ + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowJobsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/actions/runners": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get user-level runners", + "operationId": "getUserRunners", + "responses": { + "200": { + "$ref": "#/definitions/ActionRunnersResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/user/actions/runners/registration-token": { "get": { "produces": [ @@ -16044,6 +18252,150 @@ "$ref": "#/responses/RegistrationToken" } } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get an user's actions runner registration token", + "operationId": "userCreateRunnerRegistrationToken", + "responses": { + "200": { + "$ref": "#/responses/RegistrationToken" + } + } + } + }, + "/user/actions/runners/{runner_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get an user-level runner", + "operationId": "getUserRunner", + "parameters": [ + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/definitions/ActionRunner" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete an user-level runner", + "operationId": "deleteUserRunner", + "parameters": [ + { + "type": "string", + "description": "id of the runner", + "name": "runner_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "runner has been deleted" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/actions/runs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get workflow runs", + "operationId": "getUserWorkflowRuns", + "parameters": [ + { + "type": "string", + "description": "workflow event name", + "name": "event", + "in": "query" + }, + { + "type": "string", + "description": "workflow branch", + "name": "branch", + "in": "query" + }, + { + "type": "string", + "description": "workflow status (pending, queued, in_progress, failure, success, skipped)", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "triggered by user", + "name": "actor", + "in": "query" + }, + { + "type": "string", + "description": "triggering sha of the workflow run", + "name": "head_sha", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WorkflowRunsList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } } }, "/user/actions/secrets/{secretname}": { @@ -16265,16 +18617,13 @@ ], "responses": { "201": { - "description": "response when creating a variable" - }, - "204": { - "description": "response when creating a variable" + "description": "successfully created the user-level variable" }, "400": { "$ref": "#/responses/error" }, - "404": { - "$ref": "#/responses/notFound" + "409": { + "description": "variable name already exists." } } }, @@ -16547,7 +18896,7 @@ "parameters": [ { "type": "string", - "description": "user to check", + "description": "username of the user to check", "name": "username", "in": "path", "required": true @@ -16571,7 +18920,7 @@ "parameters": [ { "type": "string", - "description": "user to block", + "description": "username of the user to block", "name": "username", "in": "path", "required": true @@ -16604,7 +18953,7 @@ "parameters": [ { "type": "string", - "description": "user to unblock", + "description": "username of the user to unblock", "name": "username", "in": "path", "required": true @@ -16766,7 +19115,7 @@ "parameters": [ { "type": "string", - "description": "username of followed user", + "description": "username of the user to check for authenticated followers", "name": "username", "in": "path", "required": true @@ -16790,7 +19139,7 @@ "parameters": [ { "type": "string", - "description": "username of user to follow", + "description": "username of the user to follow", "name": "username", "in": "path", "required": true @@ -16817,7 +19166,7 @@ "parameters": [ { "type": "string", - "description": "username of user to unfollow", + "description": "username of the user to unfollow", "name": "username", "in": "path", "required": true @@ -17448,6 +19797,9 @@ "responses": { "200": { "$ref": "#/responses/RepositoryList" + }, + "403": { + "$ref": "#/responses/forbidden" } } } @@ -17479,6 +19831,9 @@ "204": { "$ref": "#/responses/empty" }, + "403": { + "$ref": "#/responses/forbidden" + }, "404": { "$ref": "#/responses/notFound" } @@ -17544,6 +19899,9 @@ "204": { "$ref": "#/responses/empty" }, + "403": { + "$ref": "#/responses/forbidden" + }, "404": { "$ref": "#/responses/notFound" } @@ -17762,7 +20120,7 @@ "parameters": [ { "type": "string", - "description": "username of user to get", + "description": "username of the user whose data is to be listed", "name": "username", "in": "path", "required": true @@ -17791,7 +20149,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose activity feeds are to be listed", "name": "username", "in": "path", "required": true @@ -17845,7 +20203,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose followers are to be listed", "name": "username", "in": "path", "required": true @@ -17886,7 +20244,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose followed users are to be listed", "name": "username", "in": "path", "required": true @@ -17924,14 +20282,14 @@ "parameters": [ { "type": "string", - "description": "username of following user", + "description": "username of the following user", "name": "username", "in": "path", "required": true }, { "type": "string", - "description": "username of followed user", + "description": "username of the followed user", "name": "target", "in": "path", "required": true @@ -17960,7 +20318,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose GPG key list is to be obtained", "name": "username", "in": "path", "required": true @@ -18001,7 +20359,7 @@ "parameters": [ { "type": "string", - "description": "username of user to get", + "description": "username of the user whose heatmap is to be obtained", "name": "username", "in": "path", "required": true @@ -18030,7 +20388,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose public keys are to be listed", "name": "username", "in": "path", "required": true @@ -18077,7 +20435,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose organizations are to be listed", "name": "username", "in": "path", "required": true @@ -18118,7 +20476,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose permissions are to be obtained", "name": "username", "in": "path", "required": true @@ -18157,7 +20515,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose owned repos are to be listed", "name": "username", "in": "path", "required": true @@ -18198,7 +20556,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose starred repos are to be listed", "name": "username", "in": "path", "required": true @@ -18220,6 +20578,9 @@ "200": { "$ref": "#/responses/RepositoryList" }, + "403": { + "$ref": "#/responses/forbidden" + }, "404": { "$ref": "#/responses/notFound" } @@ -18239,7 +20600,7 @@ "parameters": [ { "type": "string", - "description": "username of the user", + "description": "username of the user whose watched repos are to be listed", "name": "username", "in": "path", "required": true @@ -18280,7 +20641,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of to user whose access tokens are to be listed", "name": "username", "in": "path", "required": true @@ -18322,7 +20683,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose token is to be created", "name": "username", "in": "path", "required": true @@ -18361,7 +20722,7 @@ "parameters": [ { "type": "string", - "description": "username of user", + "description": "username of the user whose token is to be deleted", "name": "username", "in": "path", "required": true @@ -18428,11 +20789,21 @@ "type": "object", "title": "AccessToken represents an API access token.", "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, "id": { "type": "integer", "format": "int64", "x-go-name": "ID" }, + "last_used_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, "name": { "type": "string", "x-go-name": "Name" @@ -18455,6 +20826,150 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ActionArtifact": { + "description": "ActionArtifact represents a ActionArtifact", + "type": "object", + "properties": { + "archive_download_url": { + "type": "string", + "x-go-name": "ArchiveDownloadURL" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "expired": { + "type": "boolean", + "x-go-name": "Expired" + }, + "expires_at": { + "type": "string", + "format": "date-time", + "x-go-name": "ExpiresAt" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "size_in_bytes": { + "type": "integer", + "format": "int64", + "x-go-name": "SizeInBytes" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "UpdatedAt" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "workflow_run": { + "$ref": "#/definitions/ActionWorkflowRun" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionArtifactsResponse": { + "description": "ActionArtifactsResponse returns ActionArtifacts", + "type": "object", + "properties": { + "artifacts": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionArtifact" + }, + "x-go-name": "Entries" + }, + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionRunner": { + "description": "ActionRunner represents a Runner", + "type": "object", + "properties": { + "busy": { + "type": "boolean", + "x-go-name": "Busy" + }, + "ephemeral": { + "type": "boolean", + "x-go-name": "Ephemeral" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionRunnerLabel" + }, + "x-go-name": "Labels" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "status": { + "type": "string", + "x-go-name": "Status" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionRunnerLabel": { + "description": "ActionRunnerLabel represents a Runner Label", + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "type": { + "type": "string", + "x-go-name": "Type" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionRunnersResponse": { + "description": "ActionRunnersResponse returns Runners", + "type": "object", + "properties": { + "runners": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionRunner" + }, + "x-go-name": "Entries" + }, + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "ActionTask": { "description": "ActionTask represents a ActionTask", "type": "object", @@ -18547,6 +21062,11 @@ "type": "string", "x-go-name": "Data" }, + "description": { + "description": "the description of the variable", + "type": "string", + "x-go-name": "Description" + }, "name": { "description": "the name of the variable", "type": "string", @@ -18567,6 +21087,305 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ActionWorkflow": { + "description": "ActionWorkflow represents a ActionWorkflow", + "type": "object", + "properties": { + "badge_url": { + "type": "string", + "x-go-name": "BadgeURL" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "x-go-name": "DeletedAt" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "string", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "path": { + "type": "string", + "x-go-name": "Path" + }, + "state": { + "type": "string", + "x-go-name": "State" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "UpdatedAt" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionWorkflowJob": { + "description": "ActionWorkflowJob represents a WorkflowJob", + "type": "object", + "properties": { + "completed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CompletedAt" + }, + "conclusion": { + "type": "string", + "x-go-name": "Conclusion" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "head_branch": { + "type": "string", + "x-go-name": "HeadBranch" + }, + "head_sha": { + "type": "string", + "x-go-name": "HeadSha" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Labels" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "run_attempt": { + "type": "integer", + "format": "int64", + "x-go-name": "RunAttempt" + }, + "run_id": { + "type": "integer", + "format": "int64", + "x-go-name": "RunID" + }, + "run_url": { + "type": "string", + "x-go-name": "RunURL" + }, + "runner_id": { + "type": "integer", + "format": "int64", + "x-go-name": "RunnerID" + }, + "runner_name": { + "type": "string", + "x-go-name": "RunnerName" + }, + "started_at": { + "type": "string", + "format": "date-time", + "x-go-name": "StartedAt" + }, + "status": { + "type": "string", + "x-go-name": "Status" + }, + "steps": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflowStep" + }, + "x-go-name": "Steps" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionWorkflowJobsResponse": { + "description": "ActionWorkflowJobsResponse returns ActionWorkflowJobs", + "type": "object", + "properties": { + "jobs": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflowJob" + }, + "x-go-name": "Entries" + }, + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionWorkflowRun": { + "description": "ActionWorkflowRun represents a WorkflowRun", + "type": "object", + "properties": { + "actor": { + "$ref": "#/definitions/User" + }, + "completed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CompletedAt" + }, + "conclusion": { + "type": "string", + "x-go-name": "Conclusion" + }, + "display_title": { + "type": "string", + "x-go-name": "DisplayTitle" + }, + "event": { + "type": "string", + "x-go-name": "Event" + }, + "head_branch": { + "type": "string", + "x-go-name": "HeadBranch" + }, + "head_repository": { + "$ref": "#/definitions/Repository" + }, + "head_sha": { + "type": "string", + "x-go-name": "HeadSha" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "path": { + "type": "string", + "x-go-name": "Path" + }, + "repository": { + "$ref": "#/definitions/Repository" + }, + "repository_id": { + "type": "integer", + "format": "int64", + "x-go-name": "RepositoryID" + }, + "run_attempt": { + "type": "integer", + "format": "int64", + "x-go-name": "RunAttempt" + }, + "run_number": { + "type": "integer", + "format": "int64", + "x-go-name": "RunNumber" + }, + "started_at": { + "type": "string", + "format": "date-time", + "x-go-name": "StartedAt" + }, + "status": { + "type": "string", + "x-go-name": "Status" + }, + "trigger_actor": { + "$ref": "#/definitions/User" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionWorkflowRunsResponse": { + "description": "ActionWorkflowRunsResponse returns ActionWorkflowRuns", + "type": "object", + "properties": { + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + }, + "workflow_runs": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflowRun" + }, + "x-go-name": "Entries" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionWorkflowStep": { + "description": "ActionWorkflowStep represents a step of a WorkflowJob", + "type": "object", + "properties": { + "completed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CompletedAt" + }, + "conclusion": { + "type": "string", + "x-go-name": "Conclusion" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "number": { + "type": "integer", + "format": "int64", + "x-go-name": "Number" + }, + "started_at": { + "type": "string", + "format": "date-time", + "x-go-name": "StartedAt" + }, + "status": { + "type": "string", + "x-go-name": "Status" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "Activity": { "type": "object", "properties": { @@ -18704,7 +21523,7 @@ "x-go-name": "Time" }, "user_name": { - "description": "User who spent the time (optional)", + "description": "username of the user who spent the time working on the issue (optional)", "type": "string", "x-go-name": "User" } @@ -19051,7 +21870,7 @@ ], "properties": { "content": { - "description": "new or updated file content, must be base64 encoded", + "description": "new or updated file content, it must be base64 encoded", "type": "string", "x-go-name": "ContentBase64" }, @@ -19061,11 +21880,13 @@ "x-go-name": "FromPath" }, "operation": { - "description": "indicates what to do with the file", + "description": "indicates what to do with the file: \"create\" for creating a new file, \"update\" for updating an existing file,\n\"upload\" for creating or updating a file, \"rename\" for renaming a file, and \"delete\" for deleting an existing file.", "type": "string", "enum": [ "create", "update", + "upload", + "rename", "delete" ], "x-go-name": "Operation" @@ -19076,7 +21897,7 @@ "x-go-name": "Path" }, "sha": { - "description": "sha is the SHA for the file that already exists, required for update or delete", + "description": "the blob ID (SHA) for the file that already exists, required for changing existing files", "type": "string", "x-go-name": "SHA" } @@ -19192,7 +22013,17 @@ "x-go-name": "SHA" }, "state": { - "$ref": "#/definitions/CommitStatusState" + "type": "string", + "enum": [ + "pending", + "success", + "error", + "failure", + "warning", + "skipped" + ], + "x-go-enum-desc": "pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending\nsuccess CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success\nerror CommitStatusError CommitStatusError is for when the CommitStatus is Error\nfailure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure\nwarning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning\nskipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped", + "x-go-name": "State" }, "statuses": { "type": "array", @@ -19420,7 +22251,17 @@ "x-go-name": "ID" }, "status": { - "$ref": "#/definitions/CommitStatusState" + "type": "string", + "enum": [ + "pending", + "success", + "error", + "failure", + "warning", + "skipped" + ], + "x-go-enum-desc": "pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending\nsuccess CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success\nerror CommitStatusError CommitStatusError is for when the CommitStatus is Error\nfailure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure\nwarning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning\nskipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped", + "x-go-name": "State" }, "target_url": { "type": "string", @@ -19438,11 +22279,6 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, - "CommitStatusState": { - "description": "CommitStatusState holds the state of a CommitStatus\nIt can be \"pending\", \"success\", \"error\" and \"failure\"", - "type": "string", - "x-go-package": "code.gitea.io/gitea/modules/structs" - }, "CommitUser": { "type": "object", "title": "CommitUser contains information of a user in the context of a commit.", @@ -19482,6 +22318,22 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "ContentsExtResponse": { + "type": "object", + "properties": { + "dir_contents": { + "type": "array", + "items": { + "$ref": "#/definitions/ContentsResponse" + }, + "x-go-name": "DirContents" + }, + "file_contents": { + "$ref": "#/definitions/ContentsResponse" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "ContentsResponse": { "description": "ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content", "type": "object", @@ -19511,10 +22363,33 @@ "type": "string", "x-go-name": "HTMLURL" }, + "last_author_date": { + "type": "string", + "format": "date-time", + "x-go-name": "LastAuthorDate" + }, + "last_commit_message": { + "type": "string", + "x-go-name": "LastCommitMessage" + }, "last_commit_sha": { "type": "string", "x-go-name": "LastCommitSHA" }, + "last_committer_date": { + "type": "string", + "format": "date-time", + "x-go-name": "LastCommitterDate" + }, + "lfs_oid": { + "type": "string", + "x-go-name": "LfsOid" + }, + "lfs_size": { + "type": "integer", + "format": "int64", + "x-go-name": "LfsSize" + }, "name": { "type": "string", "x-go-name": "Name" @@ -19570,7 +22445,40 @@ "items": { "type": "string" }, - "x-go-name": "Scopes" + "x-go-name": "Scopes", + "example": [ + "all", + "read:activitypub", + "read:issue", + "write:misc", + "read:notification", + "read:organization", + "read:package", + "read:repository", + "read:user" + ] + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateActionWorkflowDispatch": { + "description": "CreateActionWorkflowDispatch represents the payload for triggering a workflow dispatch event", + "type": "object", + "required": [ + "ref" + ], + "properties": { + "inputs": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "Inputs" + }, + "ref": { + "type": "string", + "x-go-name": "Ref", + "example": "refs/heads/main" } }, "x-go-package": "code.gitea.io/gitea/modules/structs" @@ -20117,6 +23025,11 @@ "description": "Data of the secret to update", "type": "string", "x-go-name": "Data" + }, + "description": { + "description": "Description of the secret to update", + "type": "string", + "x-go-name": "Description" } }, "x-go-package": "code.gitea.io/gitea/modules/structs" @@ -20149,6 +23062,7 @@ "x-go-name": "RepoAdminChangeTeamAccess" }, "username": { + "description": "username of the organization", "type": "string", "x-go-name": "UserName" }, @@ -20338,6 +23252,10 @@ "type": "boolean", "x-go-name": "IsPrerelease" }, + "tag_message": { + "type": "string", + "x-go-name": "TagMessage" + }, "tag_name": { "type": "string", "x-go-name": "TagName" @@ -20443,7 +23361,17 @@ "x-go-name": "Description" }, "state": { - "$ref": "#/definitions/CommitStatusState" + "type": "string", + "enum": [ + "pending", + "success", + "error", + "failure", + "warning", + "skipped" + ], + "x-go-enum-desc": "pending CommitStatusPending CommitStatusPending is for when the CommitStatus is Pending\nsuccess CommitStatusSuccess CommitStatusSuccess is for when the CommitStatus is Success\nerror CommitStatusError CommitStatusError is for when the CommitStatus is Error\nfailure CommitStatusFailure CommitStatusFailure is for when the CommitStatus is Failure\nwarning CommitStatusWarning CommitStatusWarning is for when the CommitStatus is Warning\nskipped CommitStatusSkipped CommitStatusSkipped is for when CommitStatus is Skipped", + "x-go-name": "State" }, "target_url": { "type": "string", @@ -20585,7 +23513,9 @@ "x-go-name": "FullName" }, "login_name": { + "description": "identifier of the user, provided by the external authenticator (if configured)", "type": "string", + "default": "empty", "x-go-name": "LoginName" }, "must_change_password": { @@ -20610,6 +23540,7 @@ "x-go-name": "SourceID" }, "username": { + "description": "username of the user", "type": "string", "x-go-name": "Username" }, @@ -20627,6 +23558,11 @@ "value" ], "properties": { + "description": { + "description": "Description of the variable to create", + "type": "string", + "x-go-name": "Description" + }, "value": { "description": "Value of the variable to create", "type": "string", @@ -20734,7 +23670,7 @@ "x-go-name": "NewBranchName" }, "sha": { - "description": "sha is the SHA for the file that already exists", + "description": "the blob ID (SHA) for the file that already exists, it is required for changing existing files", "type": "string", "x-go-name": "SHA" }, @@ -21590,7 +24526,9 @@ "x-go-name": "Location" }, "login_name": { + "description": "identifier of the user, provided by the external authenticator (if configured)", "type": "string", + "default": "empty", "x-go-name": "LoginName" }, "max_repo_creation": { @@ -21649,6 +24587,7 @@ "x-go-name": "UserID" }, "username": { + "description": "username of the user", "type": "string", "x-go-name": "UserName" }, @@ -21910,6 +24849,11 @@ "format": "int64", "x-go-name": "DefaultMaxBlobSize" }, + "default_max_response_size": { + "type": "integer", + "format": "int64", + "x-go-name": "DefaultMaxResponseSize" + }, "default_paging_num": { "type": "integer", "format": "int64", @@ -22076,6 +25020,20 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "GetFilesOptions": { + "description": "GetFilesOptions options for retrieving metadate and content of multiple files", + "type": "object", + "properties": { + "files": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Files" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "GitBlobResponse": { "description": "GitBlobResponse represents a git blob", "type": "object", @@ -22088,6 +25046,15 @@ "type": "string", "x-go-name": "Encoding" }, + "lfs_oid": { + "type": "string", + "x-go-name": "LfsOid" + }, + "lfs_size": { + "type": "integer", + "format": "int64", + "x-go-name": "LfsSize" + }, "sha": { "type": "string", "x-go-name": "SHA" @@ -22730,6 +25697,17 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "LockIssueOption": { + "description": "LockIssueOption options to lock an issue", + "type": "object", + "properties": { + "lock_reason": { + "type": "string", + "x-go-name": "Reason" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "MarkdownOption": { "description": "MarkdownOption markdown options", "type": "object", @@ -22827,6 +25805,30 @@ "x-go-name": "MergePullRequestForm", "x-go-package": "code.gitea.io/gitea/services/forms" }, + "MergeUpstreamRequest": { + "type": "object", + "properties": { + "branch": { + "type": "string", + "x-go-name": "Branch" + }, + "ff_only": { + "type": "boolean", + "x-go-name": "FfOnly" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "MergeUpstreamResponse": { + "type": "object", + "properties": { + "merge_type": { + "type": "string", + "x-go-name": "MergeStyle" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "MigrateRepoOptions": { "description": "MigrateRepoOptions options for migrating repository's\nthis is used to interact with api v1", "type": "object", @@ -22922,7 +25924,8 @@ "gogs", "onedev", "gitbucket", - "codebase" + "codebase", + "codecommit" ], "x-go-name": "Service" }, @@ -23309,7 +26312,7 @@ "x-go-name": "RepoAdminChangeTeamAccess" }, "username": { - "description": "deprecated", + "description": "username of the organization\ndeprecated", "type": "string", "x-go-name": "UserName" }, @@ -23424,10 +26427,6 @@ "description": "PackageFile represents a package file", "type": "object", "properties": { - "Size": { - "type": "integer", - "format": "int64" - }, "id": { "type": "integer", "format": "int64", @@ -23452,6 +26451,11 @@ "sha512": { "type": "string", "x-go-name": "HashSHA512" + }, + "size": { + "type": "integer", + "format": "int64", + "x-go-name": "Size" } }, "x-go-package": "code.gitea.io/gitea/modules/structs" @@ -23552,6 +26556,7 @@ "x-go-name": "Name" }, "username": { + "description": "username of the user", "type": "string", "x-go-name": "UserName" } @@ -23603,6 +26608,11 @@ "type": "string", "x-go-name": "KeyType" }, + "last_used_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, "read_only": { "type": "boolean", "x-go-name": "ReadOnly" @@ -24129,6 +27139,22 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "RenameOrgOption": { + "description": "RenameOrgOption options when renaming an organization", + "type": "object", + "required": [ + "new_name" + ], + "properties": { + "new_name": { + "description": "New username for this org. This name cannot be in use yet by any other user.", + "type": "string", + "uniqueItems": true, + "x-go-name": "NewName" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "RenameUserOption": { "description": "RenameUserOption options when renaming a user", "type": "object", @@ -24233,6 +27259,10 @@ "type": "boolean", "x-go-name": "AllowFastForwardOnly" }, + "allow_manual_merge": { + "type": "boolean", + "x-go-name": "AllowManualMerge" + }, "allow_merge_commits": { "type": "boolean", "x-go-name": "AllowMerge" @@ -24262,6 +27292,10 @@ "format": "date-time", "x-go-name": "ArchivedAt" }, + "autodetect_manual_merge": { + "type": "boolean", + "x-go-name": "AutodetectManualMerge" + }, "avatar_url": { "type": "string", "x-go-name": "AvatarURL" @@ -24552,6 +27586,11 @@ "format": "date-time", "x-go-name": "Created" }, + "description": { + "description": "the secret's description", + "type": "string", + "x-go-name": "Description" + }, "name": { "description": "the secret's name", "type": "string", @@ -24981,6 +28020,7 @@ "x-go-name": "UserID" }, "user_name": { + "description": "username of the user", "type": "string", "x-go-name": "UserName" } @@ -25084,7 +28124,7 @@ "x-go-name": "NewBranchName" }, "sha": { - "description": "sha is the SHA for the file that already exists", + "description": "the blob ID (SHA) for the file that already exists, it is required for changing existing files", "type": "string", "x-go-name": "SHA" }, @@ -25127,6 +28167,11 @@ "value" ], "properties": { + "description": { + "description": "Description of the variable to update", + "type": "string", + "x-go-name": "Description" + }, "name": { "description": "New name for the variable. If the field is empty, the variable name won't be updated.", "type": "string", @@ -25217,12 +28262,12 @@ "x-go-name": "Location" }, "login": { - "description": "the user's username", + "description": "login of the user, same as `username`", "type": "string", "x-go-name": "UserName" }, "login_name": { - "description": "the user's authentication sign-in name.", + "description": "identifier of the user, provided by the external authenticator (if configured)", "type": "string", "default": "empty", "x-go-name": "LoginName" @@ -25538,6 +28583,21 @@ "$ref": "#/definitions/ActionVariable" } }, + "ActionWorkflow": { + "description": "ActionWorkflow", + "schema": { + "$ref": "#/definitions/ActionWorkflow" + } + }, + "ActionWorkflowList": { + "description": "ActionWorkflowList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionWorkflow" + } + } + }, "ActivityFeedsList": { "description": "ActivityFeedsList", "schema": { @@ -25559,6 +28619,18 @@ "$ref": "#/definitions/AnnotatedTag" } }, + "Artifact": { + "description": "Artifact", + "schema": { + "$ref": "#/definitions/ActionArtifact" + } + }, + "ArtifactsList": { + "description": "ArtifactsList", + "schema": { + "$ref": "#/definitions/ActionArtifactsResponse" + } + }, "Attachment": { "description": "Attachment", "schema": { @@ -25731,6 +28803,12 @@ "$ref": "#/definitions/Compare" } }, + "ContentsExtResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/ContentsExtResponse" + } + }, "ContentsListResponse": { "description": "ContentsListResponse", "schema": { @@ -26008,6 +29086,18 @@ "type": "string" } }, + "MergeUpstreamRequest": { + "description": "", + "schema": { + "$ref": "#/definitions/MergeUpstreamRequest" + } + }, + "MergeUpstreamResponse": { + "description": "", + "schema": { + "$ref": "#/definitions/MergeUpstreamResponse" + } + }, "Milestone": { "description": "Milestone", "schema": { @@ -26283,6 +29373,18 @@ } } }, + "Runner": { + "description": "Runner", + "schema": { + "$ref": "#/definitions/ActionRunner" + } + }, + "RunnerList": { + "description": "RunnerList", + "schema": { + "$ref": "#/definitions/ActionRunnersResponse" + } + }, "SearchResults": { "description": "SearchResults", "schema": { @@ -26493,6 +29595,30 @@ } } }, + "WorkflowJob": { + "description": "WorkflowJob", + "schema": { + "$ref": "#/definitions/ActionWorkflowJob" + } + }, + "WorkflowJobsList": { + "description": "WorkflowJobsList", + "schema": { + "$ref": "#/definitions/ActionWorkflowJobsResponse" + } + }, + "WorkflowRun": { + "description": "WorkflowRun", + "schema": { + "$ref": "#/definitions/ActionWorkflowRun" + } + }, + "WorkflowRunsList": { + "description": "WorkflowRunsList", + "schema": { + "$ref": "#/definitions/ActionWorkflowRunsResponse" + } + }, "conflict": { "description": "APIConflict is a conflict empty response" }, @@ -26541,7 +29667,7 @@ "parameterBodies": { "description": "parameterBodies", "schema": { - "$ref": "#/definitions/UpdateVariableOption" + "$ref": "#/definitions/LockIssueOption" } }, "redirect": { @@ -26640,4 +29766,4 @@ "TOTPHeader": [] } ] -} +}
\ No newline at end of file diff --git a/templates/user/auth/captcha.tmpl b/templates/user/auth/captcha.tmpl index 8dd4d1cc51..6779948da5 100644 --- a/templates/user/auth/captcha.tmpl +++ b/templates/user/auth/captcha.tmpl @@ -10,12 +10,12 @@ <div class="inline field tw-text-center required"> <div id="captcha" data-captcha-type="g-recaptcha" class="g-recaptcha-style" data-sitekey="{{.RecaptchaSitekey}}"></div> </div> - <script src='{{URLJoin .RecaptchaURL "api.js"}}'></script> + <script defer src='{{URLJoin .RecaptchaURL "api.js"}}'></script> {{else if eq .CaptchaType "hcaptcha"}} <div class="inline field tw-text-center required"> <div id="captcha" data-captcha-type="h-captcha" class="h-captcha-style" data-sitekey="{{.HcaptchaSitekey}}"></div> </div> - <script src='https://hcaptcha.com/1/api.js'></script> + <script defer src='https://hcaptcha.com/1/api.js'></script> {{else if eq .CaptchaType "mcaptcha"}} <div class="inline field tw-text-center"> <div class="m-captcha-style" id="mcaptcha__widget-container"></div> @@ -25,5 +25,5 @@ <div class="inline field tw-text-center"> <div id="captcha" data-captcha-type="cf-turnstile" data-sitekey="{{.CfTurnstileSitekey}}"></div> </div> - <script src='https://challenges.cloudflare.com/turnstile/v0/api.js'></script> + <script defer src='https://challenges.cloudflare.com/turnstile/v0/api.js'></script> {{end}}{{end}} diff --git a/templates/user/auth/finalize_openid.tmpl b/templates/user/auth/finalize_openid.tmpl deleted file mode 100644 index 1c1dcdb825..0000000000 --- a/templates/user/auth/finalize_openid.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -{{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content user signin"> - <div class="ui container"> - <div class="ui grid"> - {{template "user/auth/finalize_openid_navbar" .}} - <div class="twelve wide column content"> - {{template "base/alert" .}} - <h4 class="ui top attached header"> - {{ctx.Locale.Tr "auth.login_userpass"}} - </h4> - <div class="ui attached segment"> - <form class="ui form" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <div class="required inline field {{if .Err_UserName}}error{{end}}"> - <label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label> - <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required> - </div> - <div class="required inline field {{if .Err_Password}}error{{end}}"> - <label for="password">{{ctx.Locale.Tr "password"}}</label> - <input id="password" name="password" type="password" value="{{.password}}" autocomplete="off" required> - </div> - <div class="inline field"> - <label></label> - <div class="ui checkbox"> - <label>{{ctx.Locale.Tr "auth.remember_me"}}</label> - <input name="remember" type="checkbox"> - </div> - </div> - - <div class="inline field"> - <label></label> - <button class="ui primary button">{{ctx.Locale.Tr "sign_in"}}</button> - <a href="{{AppSubUrl}}/user/forget_password">{{ctx.Locale.Tr "auth.forget_password"}}</a> - </div> - {{if .ShowRegistrationButton}} - <div class="inline field"> - <label></label> - <a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now"}}</a> - </div> - {{end}} - </form> - </div> - </div> - </div> - </div> -</div> -{{template "base/footer" .}} diff --git a/templates/user/auth/grant.tmpl b/templates/user/auth/grant.tmpl index 4031dd7a63..e56241b0f8 100644 --- a/templates/user/auth/grant.tmpl +++ b/templates/user/auth/grant.tmpl @@ -1,35 +1,33 @@ {{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content ui one column stackable center aligned page grid oauth2-authorize-application-box"> - <div class="column seven wide"> - <div class="ui middle centered raised segments"> - <h3 class="ui top attached header"> - {{ctx.Locale.Tr "auth.authorize_title" .Application.Name}} - </h3> - <div class="ui attached segment"> - {{template "base/alert" .}} - <p> - {{if not .AdditionalScopes}} - <b>{{ctx.Locale.Tr "auth.authorize_application_description"}}</b><br> - {{end}} - {{ctx.Locale.Tr "auth.authorize_application_created_by" .ApplicationCreatorLinkHTML}}<br> - {{ctx.Locale.Tr "auth.authorize_application_with_scopes" (HTMLFormat "<b>%s</b>" .Scope)}} - </p> - </div> - <div class="ui attached segment"> - <p>{{ctx.Locale.Tr "auth.authorize_redirect_notice" .ApplicationRedirectDomainHTML}}</p> - </div> - <div class="ui attached segment"> - <form method="post" action="{{AppSubUrl}}/login/oauth/grant"> - {{.CsrfTokenHtml}} - <input type="hidden" name="client_id" value="{{.Application.ClientID}}"> - <input type="hidden" name="state" value="{{.State}}"> - <input type="hidden" name="scope" value="{{.Scope}}"> - <input type="hidden" name="nonce" value="{{.Nonce}}"> - <input type="hidden" name="redirect_uri" value="{{.RedirectURI}}"> - <button type="submit" id="authorize-app" name="granted" value="true" class="ui red inline button">{{ctx.Locale.Tr "auth.authorize_application"}}</button> - <button type="submit" name="granted" value="false" class="ui basic primary inline button">{{ctx.Locale.Tr "cancel"}}</button> - </form> - </div> +<div role="main" aria-label="{{.Title}}" class="page-content oauth2-authorize-application-box"> + <div class="ui container tw-max-w-[500px]"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "auth.authorize_title" .Application.Name}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <p> + {{if not .AdditionalScopes}} + <b>{{ctx.Locale.Tr "auth.authorize_application_description"}}</b><br> + {{end}} + {{ctx.Locale.Tr "auth.authorize_application_created_by" .ApplicationCreatorLinkHTML}}<br> + {{ctx.Locale.Tr "auth.authorize_application_with_scopes" (HTMLFormat "<b>%s</b>" .Scope)}} + </p> + </div> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "auth.authorize_redirect_notice" .ApplicationRedirectDomainHTML}}</p> + </div> + <div class="ui attached segment tw-text-center"> + <form method="post" action="{{AppSubUrl}}/login/oauth/grant"> + {{.CsrfTokenHtml}} + <input type="hidden" name="client_id" value="{{.Application.ClientID}}"> + <input type="hidden" name="state" value="{{.State}}"> + <input type="hidden" name="scope" value="{{.Scope}}"> + <input type="hidden" name="nonce" value="{{.Nonce}}"> + <input type="hidden" name="redirect_uri" value="{{.RedirectURI}}"> + <button type="submit" id="authorize-app" name="granted" value="true" class="ui red inline button">{{ctx.Locale.Tr "auth.authorize_application"}}</button> + <button type="submit" name="granted" value="false" class="ui basic primary inline button">{{ctx.Locale.Tr "cancel"}}</button> + </form> </div> </div> </div> diff --git a/templates/user/auth/grant_error.tmpl b/templates/user/auth/grant_error.tmpl index b2e077960c..7a4521d331 100644 --- a/templates/user/auth/grant_error.tmpl +++ b/templates/user/auth/grant_error.tmpl @@ -1,15 +1,12 @@ {{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content ui one column stackable center aligned page grid oauth2-authorize-application-box {{if .IsRepo}}repository{{end}}"> - {{if .IsRepo}}{{template "repo/header" .}}{{end}} - <div class="column seven wide"> - <div class="ui middle centered raised segments"> - <h1 class="ui top attached header"> - {{ctx.Locale.Tr "auth.authorization_failed"}} - </h1> - <h3 class="ui attached segment">{{.Error.ErrorDescription}}</h3> - <div class="ui attached segment"> - <p>{{ctx.Locale.Tr "auth.authorization_failed_desc"}}</p> - </div> +<div role="main" aria-label="{{.Title}}" class="page-content oauth2-authorize-application-box"> + <div class="ui container tw-max-w-[500px]"> + <h1 class="ui top attached header"> + {{ctx.Locale.Tr "auth.authorization_failed"}} + </h1> + <h3 class="ui attached segment">{{.Error.ErrorDescription}}</h3> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "auth.authorization_failed_desc"}}</p> </div> </div> </div> diff --git a/templates/user/auth/link_account.tmpl b/templates/user/auth/link_account.tmpl index a99e172d05..d244ce38c2 100644 --- a/templates/user/auth/link_account.tmpl +++ b/templates/user/auth/link_account.tmpl @@ -16,13 +16,18 @@ </div> </overflow-menu> <div class="ui middle very relaxed page grid"> - <div class="column"> + <div class="column tw-my-5"> + {{/* these styles are quite tricky but it needs to be the same as the signin page */}} <div class="ui tab {{if not .user_exists}}active{{end}}" data-tab="auth-link-signup-tab"> + <div class="tw-flex tw-flex-col tw-gap-4 tw-max-w-2xl tw-m-auto"> {{if .AutoRegistrationFailedPrompt}}<div class="ui message">{{.AutoRegistrationFailedPrompt}}</div>{{end}} {{template "user/auth/signup_inner" .}} + </div> </div> <div class="ui tab {{if .user_exists}}active{{end}}" data-tab="auth-link-signin-tab"> + <div class="tw-flex tw-flex-col tw-gap-4 tw-max-w-2xl tw-m-auto"> {{template "user/auth/signin_inner" .}} + </div> </div> </div> </div> diff --git a/templates/user/auth/oidc_wellknown.tmpl b/templates/user/auth/oidc_wellknown.tmpl index 54bb4a763d..52c9a1b788 100644 --- a/templates/user/auth/oidc_wellknown.tmpl +++ b/templates/user/auth/oidc_wellknown.tmpl @@ -1,16 +1,16 @@ { - "issuer": "{{AppUrl | JSEscape}}", - "authorization_endpoint": "{{AppUrl | JSEscape}}login/oauth/authorize", - "token_endpoint": "{{AppUrl | JSEscape}}login/oauth/access_token", - "jwks_uri": "{{AppUrl | JSEscape}}login/oauth/keys", - "userinfo_endpoint": "{{AppUrl | JSEscape}}login/oauth/userinfo", - "introspection_endpoint": "{{AppUrl | JSEscape}}login/oauth/introspect", + "issuer": "{{.OidcIssuer}}", + "authorization_endpoint": "{{.OidcBaseUrl}}/login/oauth/authorize", + "token_endpoint": "{{.OidcBaseUrl}}/login/oauth/access_token", + "jwks_uri": "{{.OidcBaseUrl}}/login/oauth/keys", + "userinfo_endpoint": "{{.OidcBaseUrl}}/login/oauth/userinfo", + "introspection_endpoint": "{{.OidcBaseUrl}}/login/oauth/introspect", "response_types_supported": [ "code", "id_token" ], "id_token_signing_alg_values_supported": [ - "{{.SigningKey.SigningMethod.Alg | JSEscape}}" + "{{.SigningKeyMethodAlg}}" ], "subject_types_supported": [ "public" diff --git a/templates/user/auth/reset_passwd.tmpl b/templates/user/auth/reset_passwd.tmpl index f8303feef3..37a23b3e55 100644 --- a/templates/user/auth/reset_passwd.tmpl +++ b/templates/user/auth/reset_passwd.tmpl @@ -34,18 +34,18 @@ {{ctx.Locale.Tr "twofa"}} </h4> <div class="ui warning visible message">{{ctx.Locale.Tr "settings.twofa_is_enrolled"}}</div> - {{if .scratch_code}} - <div class="required inline field {{if .Err_Token}}error{{end}}"> - <label for="token">{{ctx.Locale.Tr "auth.scratch_code"}}</label> - <input id="token" name="token" type="text" autocomplete="off" autofocus required> - </div> - <input type="hidden" name="scratch_code" value="true"> - {{else}} - <div class="required field {{if .Err_Passcode}}error{{end}}"> - <label for="passcode">{{ctx.Locale.Tr "passcode"}}</label> - <input id="passcode" name="passcode" type="number" autocomplete="off" autofocus required> - </div> - {{end}} + {{if .scratch_code}} + <div class="required inline field {{if .Err_Token}}error{{end}}"> + <label for="token">{{ctx.Locale.Tr "auth.scratch_code"}}</label> + <input id="token" name="token" type="text" autocomplete="off" autofocus required> + </div> + <input type="hidden" name="scratch_code" value="true"> + {{else}} + <div class="required field {{if .Err_Passcode}}error{{end}}"> + <label for="passcode">{{ctx.Locale.Tr "passcode"}}</label> + <input id="passcode" name="passcode" type="number" autocomplete="off" autofocus required> + </div> + {{end}} {{end}} <div class="divider"></div> <div class="inline field"> diff --git a/templates/user/auth/signin.tmpl b/templates/user/auth/signin.tmpl index 54cc82d49d..75e1bb27f9 100644 --- a/templates/user/auth/signin.tmpl +++ b/templates/user/auth/signin.tmpl @@ -1,6 +1,7 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content user signin{{if .LinkAccountMode}} icon{{end}}"> <div class="ui middle very relaxed page grid"> + {{/* these styles are quite tricky and should also apply to the signup and link_account pages */}} <div class="column tw-flex tw-flex-col tw-gap-4 tw-max-w-2xl tw-m-auto"> {{template "user/auth/signin_inner" .}} </div> diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index dd608e5aa1..5552363a0a 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -18,9 +18,9 @@ <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required tabindex="1"> </div> {{if or (not .DisablePassword) .LinkAccountMode}} - <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}} form-field-content-aside-label"> - <label for="password">{{ctx.Locale.Tr "password"}}</label> - <div> + <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}"> + <div class="tw-flex tw-mb-1"> + <label for="password" class="tw-flex-1">{{ctx.Locale.Tr "password"}}</label> <a href="{{AppSubUrl}}/user/forgot_password" tabindex="4">{{ctx.Locale.Tr "auth.forgot_password"}}</a> </div> <input id="password" name="password" type="password" value="{{.password}}" autocomplete="current-password" required tabindex="2"> @@ -59,11 +59,13 @@ </div> </div> +{{if or .EnablePasskeyAuth .ShowRegistrationButton}} <div class="ui container fluid"> - {{template "user/auth/webauthn_error" .}} - <div class="ui attached segment header top tw-max-w-2xl tw-m-auto tw-flex tw-flex-col tw-items-center"> - <a class="signin-passkey">{{ctx.Locale.Tr "auth.signin_passkey"}}</a> + {{if .EnablePasskeyAuth}} + {{template "user/auth/webauthn_error" .}} + <a class="signin-passkey">{{ctx.Locale.Tr "auth.signin_passkey"}}</a> + {{end}} {{if .ShowRegistrationButton}} <div class="field"> @@ -73,3 +75,4 @@ {{end}} </div> </div> +{{end}} diff --git a/templates/user/auth/signup_inner.tmpl b/templates/user/auth/signup_inner.tmpl index b3b2a4205e..a3f6e1471f 100644 --- a/templates/user/auth/signup_inner.tmpl +++ b/templates/user/auth/signup_inner.tmpl @@ -7,6 +7,9 @@ {{end}} </h4> <div class="ui attached segment"> + {{if .IsFirstTimeRegistration}} + <p>{{ctx.Locale.Tr "auth.sign_up_tip"}}</p> + {{end}} <form class="ui form" action="{{.SignUpLink}}" method="post"> {{.CsrfTokenHtml}} {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}} @@ -59,12 +62,12 @@ </div> <div class="ui container fluid"> + {{if not .LinkAccountMode}} <div class="ui attached segment header top tw-flex tw-flex-col tw-items-center"> - {{if not .LinkAccountMode}} <div class="field"> <span>{{ctx.Locale.Tr "auth.already_have_account"}}</span> <a href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "auth.sign_in_now"}}</a> </div> - {{end}} </div> + {{end}} </div> diff --git a/templates/user/auth/signup_openid_connect.tmpl b/templates/user/auth/signup_openid_connect.tmpl index e4b7936374..67e99b2f89 100644 --- a/templates/user/auth/signup_openid_connect.tmpl +++ b/templates/user/auth/signup_openid_connect.tmpl @@ -1,36 +1,36 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content user signup"> {{template "user/auth/signup_openid_navbar" .}} - <div class="ui container"> - {{template "base/alert" .}} - <h4 class="ui top attached header"> - {{ctx.Locale.Tr "auth.openid_connect_title"}} - </h4> - <div class="ui attached segment"> - <p> - {{ctx.Locale.Tr "auth.openid_connect_desc"}} - </p> - <form class="ui form" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <div class="required inline field {{if .Err_UserName}}error{{end}}"> - <label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label> - <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required> - </div> - <div class="required inline field {{if .Err_Password}}error{{end}}"> - <label for="password">{{ctx.Locale.Tr "password"}}</label> - <input id="password" name="password" type="password" value="{{.password}}" autocomplete="off" required> - </div> - <div class="inline field"> - <label for="openid">OpenID URI</label> - <input id="openid" value="{{.OpenID}}" readonly> - </div> - <div class="inline field"> - <label></label> - <button class="ui primary button">{{ctx.Locale.Tr "auth.openid_connect_submit"}}</button> - <a href="{{AppSubUrl}}/user/forgot_password">{{ctx.Locale.Tr "auth.forgot_password"}}</a> - </div> - </form> + <div class="ui container medium-width"> + {{template "base/alert" .}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "auth.openid_connect_title"}} + </h4> + <div class="ui attached segment"> + <form class="ui form left-right-form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <span class="help">{{ctx.Locale.Tr "auth.openid_connect_desc"}}</span> </div> + <div class="required inline field {{if .Err_UserName}}error{{end}}"> + <label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label> + <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required> + </div> + <div class="required inline field {{if .Err_Password}}error{{end}}"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" value="{{.password}}" autocomplete="off" required> + </div> + <div class="inline field"> + <label for="openid">OpenID URI</label> + <input id="openid" value="{{.OpenID}}" readonly> + </div> + <div class="inline field"> + <label></label> + <button class="ui primary button">{{ctx.Locale.Tr "auth.openid_connect_submit"}}</button> + <a href="{{AppSubUrl}}/user/forgot_password">{{ctx.Locale.Tr "auth.forgot_password"}}</a> + </div> + </form> + </div> </div> </div> {{template "base/footer" .}} diff --git a/templates/user/auth/signup_openid_register.tmpl b/templates/user/auth/signup_openid_register.tmpl index c017a0e65b..df6268d151 100644 --- a/templates/user/auth/signup_openid_register.tmpl +++ b/templates/user/auth/signup_openid_register.tmpl @@ -7,7 +7,7 @@ {{ctx.Locale.Tr "auth.openid_register_title"}} </h4> <div class="ui attached segment"> - <p class="tw-max-w-2xl tw-mx-auto"> + <p> {{ctx.Locale.Tr "auth.openid_register_desc"}} </p> <form class="ui form" action="{{.Link}}" method="post"> diff --git a/templates/user/auth/webauthn.tmpl b/templates/user/auth/webauthn.tmpl index 1b84765323..158ad0a546 100644 --- a/templates/user/auth/webauthn.tmpl +++ b/templates/user/auth/webauthn.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content user signin webauthn-prompt"> <div class="ui page grid"> - <div class="column center aligned"> + <div class="column tw-text-center"> {{template "user/auth/webauthn_error" .}} <h3 class="ui top attached header">{{ctx.Locale.Tr "twofa"}}</h3> <div class="ui attached segment"> diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl index 5dc46dc0a5..666dd78073 100644 --- a/templates/user/dashboard/dashboard.tmpl +++ b/templates/user/dashboard/dashboard.tmpl @@ -5,7 +5,11 @@ <div class="flex-container-main"> {{template "base/alert" .}} {{template "user/heatmap" .}} - {{template "user/dashboard/feeds" .}} + {{if .Page.Paginater.TotalPages}} + {{template "user/dashboard/feeds" .}} + {{else}} + {{template "user/dashboard/guide" .}} + {{end}} </div> {{template "user/dashboard/repolist" .}} </div> diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index 1c1ba5566f..37dede7af6 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -73,10 +73,13 @@ {{else if .GetOpType.InActions "publish_release"}} {{$linkText := .Content | ctx.RenderUtils.RenderEmoji}} {{ctx.Locale.Tr "action.publish_release" (.GetRepoLink ctx) (printf "%s/releases/tag/%s" (.GetRepoLink ctx) .GetTag) (.ShortRepoPath ctx) $linkText}} - {{else if .GetOpType.InActions "review_dismissed"}} + {{else if .GetOpType.InActions "pull_review_dismissed"}} {{$index := index .GetIssueInfos 0}} {{$reviewer := index .GetIssueInfos 1}} {{ctx.Locale.Tr "action.review_dismissed" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx) $reviewer}} + {{else if .GetOpType.InActions "auto_merge_pull_request"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.auto_merge_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} {{end}} {{DateUtils.TimeSince .GetCreate}} </div> @@ -88,10 +91,10 @@ {{range $push.Commits}} {{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}} <div class="flex-text-block"> - <img class="ui avatar" src="{{$push.AvatarLink ctx .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16"> + <img loading="lazy" alt class="ui avatar" src="{{$push.AvatarLink ctx .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16"> <a class="ui sha label" href="{{$commitLink}}">{{ShortSha .Sha1}}</a> <span class="text truncate"> - {{ctx.RenderUtils.RenderCommitMessage .Message ($repo.ComposeMetas ctx)}} + {{ctx.RenderUtils.RenderCommitMessage .Message $repo}} </span> </div> {{end}} @@ -107,7 +110,7 @@ <a href="{{.GetCommentLink ctx}}" class="text truncate issue title">{{(.GetIssueTitle ctx) | ctx.RenderUtils.RenderIssueSimpleTitle}}</a> {{$comment := index .GetIssueInfos 1}} {{if $comment}} - <div class="markup tw-text-14">{{ctx.RenderUtils.MarkdownToHtml $comment}}</div> + <div class="render-content markup tw-text-14">{{ctx.RenderUtils.MarkdownToHtml $comment}}</div> {{end}} {{else if .GetOpType.InActions "merge_pull_request"}} <div class="flex-item-body text black">{{index .GetIssueInfos 1}}</div> diff --git a/templates/user/dashboard/guide.tmpl b/templates/user/dashboard/guide.tmpl new file mode 100644 index 0000000000..bdbe81ece0 --- /dev/null +++ b/templates/user/dashboard/guide.tmpl @@ -0,0 +1,10 @@ +<div class="tw-text-center tw-p-8"> + {{svg "octicon-package" 24 "tw-text-placeholder-text"}} + <h3 class="tw-my-4">{{ctx.Locale.Tr "home.guide_title"}}</h3> + <p class="tw-text-placeholder-text">{{ctx.Locale.Tr "home.guide_desc"}}</p> + <div> + <a href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "home.explore_repos"}}</a> + <span>ยท</span> + <a href="{{AppSubUrl}}/explore/users">{{ctx.Locale.Tr "home.explore_users"}}</a> + </div> +</div> diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index 7924dd2305..54c96a3aa5 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -4,7 +4,7 @@ <div class="ui container"> {{template "base/alert" .}} <div class="flex-container"> - {{$queryLink := QueryBuild "?" "type" $.ViewType "sort" $.SortType "state" $.State "q" $.Keyword "labels" .SelectLabels "fuzzy" $.IsFuzzy}} + {{$queryLink := QueryBuild "?" "type" $.ViewType "sort" $.SortType "state" $.State "q" $.Keyword "labels" .SelectLabels "search_mode" $.SelectedSearchMode}} <div class="flex-container-nav"> <div class="ui secondary vertical filter menu tw-bg-transparent"> <a class="{{if eq .ViewType "your_repositories"}}active{{end}} item" href="{{QueryBuild $queryLink "type" "your_repositories"}}"> @@ -53,7 +53,13 @@ <input type="hidden" name="type" value="{{$.ViewType}}"> <input type="hidden" name="sort" value="{{$.SortType}}"> <input type="hidden" name="state" value="{{$.State}}"> - {{template "shared/search/combo_fuzzy" dict "Value" $.Keyword "IsFuzzy" $.IsFuzzy "Placeholder" (ctx.Locale.Tr (Iif .PageIsPulls "search.pull_kind" "search.issue_kind")) "Tooltip" (ctx.Locale.Tr "explore.go_to")}} + {{template "shared/search/combo" (dict + "Value" $.Keyword + "Placeholder" (ctx.Locale.Tr (Iif .PageIsPulls "search.pull_kind" "search.issue_kind")) + "Tooltip" (ctx.Locale.Tr "explore.go_to") + "SearchModes" .SearchModes + "SelectedSearchMode" .SelectedSearchMode + )}} </form> <div class="list-header-filters"> diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index c0059d3cd4..15b1b9e30b 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -33,7 +33,7 @@ {{end}} </div> </div> - <div class="flex-container-main content"> + <div class="flex-container-main"> <div class="list-header"> <div class="small-menu-items ui compact tiny menu list-header-toggle"> <a class="item{{if not .IsShowClosed}} active{{end}}" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state=open&q={{$.Keyword}}"> @@ -100,7 +100,7 @@ {{if .TotalTrackedTime}} <div class="flex-text-block"> {{svg "octicon-clock"}} - {{.TotalTrackedTime|Sec2Time}} + {{.TotalTrackedTime|Sec2Hour}} </div> {{end}} {{if .UpdatedUnix}} @@ -116,7 +116,7 @@ {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} {{else}} {{if .DeadlineString}} - <span{{if .IsOverdue}} class="text red"{{end}}> + <span class="flex-text-inline {{if .IsOverdue}}text red{{end}}"> {{svg "octicon-calendar" 14}} {{DateUtils.AbsoluteShort (.DeadlineString|DateUtils.ParseLegacy)}} </span> @@ -140,9 +140,7 @@ {{end}} </div> {{if .Content}} - <div class="markup content"> - {{.RenderedContent}} - </div> + <div class="render-content markup">{{.RenderedContent}}</div> {{end}} </li> {{end}} diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl index 7982cbd950..7eb845833f 100644 --- a/templates/user/dashboard/navbar.tmpl +++ b/templates/user/dashboard/navbar.tmpl @@ -2,32 +2,32 @@ <div class="ui secondary stackable menu"> <div class="item"> <div class="ui floating dropdown jump"> - <span class="text truncated-item-container"> + <span class="text"> {{ctx.AvatarUtils.Avatar .ContextUser 24 "tw-mr-1"}} - <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> + <span class="gt-ellipsis">{{.ContextUser.ShortName 40}}</span> <span class="org-visibility"> {{if .ContextUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} {{if .ContextUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} </span> {{svg "octicon-triangle-down" 14 "dropdown icon tw-ml-1"}} </span> - <div class="context user overflow menu"> - <div class="ui header"> + <div class="menu context-user-switch"> + <div class="header"> {{ctx.Locale.Tr "home.switch_dashboard_context"}} </div> - <div class="scrolling menu items"> - <a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item truncated-item-container" href="{{AppSubUrl}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{else if .PageIsMilestonesDashboard}}milestones{{end}}"> + <div class="scrolling menu"> + <a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item" href="{{AppSubUrl}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{else if .PageIsMilestonesDashboard}}milestones{{end}}"> {{ctx.AvatarUtils.Avatar .SignedUser}} - <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> + <span class="gt-ellipsis">{{.SignedUser.ShortName 40}}</span> <span class="org-visibility"> {{if .SignedUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} {{if .SignedUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} </span> </a> {{range .Orgs}} - <a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item truncated-item-container" title="{{.Name}}" href="{{.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}"> + <a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item" title="{{.Name}}" href="{{.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}"> {{ctx.AvatarUtils.Avatar .}} - <span class="truncated-item-name">{{.ShortName 40}}</span> + <span class="gt-ellipsis">{{.ShortName 40}}</span> <span class="org-visibility"> {{if .Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} {{if .Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} @@ -37,7 +37,7 @@ </div> {{if .SignedUser.CanCreateOrganization}} <a class="item" href="{{AppSubUrl}}/org/create"> - {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_org"}} + {{svg "octicon-plus" 16 "tw-ml-1 tw-mr-5"}}{{ctx.Locale.Tr "new_org"}} </a> {{end}} </div> @@ -56,7 +56,7 @@ </span> {{svg "octicon-triangle-down" 14 "dropdown icon"}} <div class="context user overflow menu"> - <div class="ui header"> + <div class="header"> {{ctx.Locale.Tr "home.filter_by_team_repositories"}} </div> <div class="scrolling menu items"> @@ -77,7 +77,7 @@ {{end}} {{if .ContextUser.IsOrganization}} - <div class="right menu"> + <div class="right menu tw-flex-wrap tw-justify-end"> <a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> {{svg "octicon-rss"}} {{ctx.Locale.Tr "activities"}} </a> @@ -98,7 +98,7 @@ {{end}} <div class="item"> <a class="ui primary basic button" href="{{.ContextUser.HomeLink}}" title="{{ctx.Locale.Tr "home.view_home" .ContextUser.Name}}"> - {{ctx.Locale.Tr "home.view_home" (.ContextUser.ShortName 40)}} + {{ctx.Locale.Tr "home.view_home" (.ContextUser.ShortName 20)}} </a> </div> </div> diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index a2764ba608..8b0fcbb401 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -5,6 +5,10 @@ const data = { isMirrorsEnabled: {{.MirrorsEnabled}}, isStarsEnabled: {{not .IsDisableStars}}, + canCreateMigrations: {{not .DisableMigrations}}, + + textNoOrg: {{ctx.Locale.Tr "home.empty_org"}}, + textNoRepo: {{ctx.Locale.Tr "home.empty_repo"}}, textRepository: {{ctx.Locale.Tr "repository"}}, textOrganization: {{ctx.Locale.Tr "organization"}}, textMyRepos: {{ctx.Locale.Tr "home.my_repos"}}, diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl index 0d2371a358..b8655a84a4 100644 --- a/templates/user/notification/notification_div.tmpl +++ b/templates/user/notification/notification_div.tmpl @@ -1,6 +1,6 @@ <div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-sequence-number="{{.SequenceNumber}}"> <div class="ui container"> - {{$notificationUnreadCount := call .NotificationUnreadCount}} + {{$notificationUnreadCount := call .PageGlobalData.GetNotificationUnreadCount}} <div class="tw-flex tw-items-center tw-justify-between tw-mb-[--page-spacing]"> <div class="small-menu-items ui compact tiny menu"> <a class="{{if eq .Status 1}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=unread"> diff --git a/templates/user/notification/notification_subscriptions.tmpl b/templates/user/notification/notification_subscriptions.tmpl index b92a32a957..e4dd27e63b 100644 --- a/templates/user/notification/notification_subscriptions.tmpl +++ b/templates/user/notification/notification_subscriptions.tmpl @@ -28,7 +28,7 @@ </div> </div> <div class="tw-flex tw-justify-between"> - <div class="ui right aligned secondary filter menu labels"> + <div class="ui secondary filter menu labels"> <!-- Type --> <div class="ui dropdown type jump item"> <span class="text"> @@ -69,8 +69,8 @@ {{template "shared/issuelist" dict "." . "listType" "dashboard"}} {{end}} {{else}} - {{template "shared/repo_search" .}} - {{template "explore/repo_list" .}} + {{template "shared/repo/search" .}} + {{template "shared/repo/list" .}} {{template "base/paginate" .}} {{end}} </div> diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 2c83ce97cd..74a53b937d 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -17,8 +17,8 @@ {{template "user/dashboard/feeds" .}} {{else if eq .TabName "stars"}} <div class="stars"> - {{template "shared/repo_search" .}} - {{template "explore/repo_list" .}} + {{template "shared/repo/search" .}} + {{template "shared/repo/list" .}} {{template "base/paginate" .}} </div> {{else if eq .TabName "following"}} @@ -26,12 +26,12 @@ {{else if eq .TabName "followers"}} {{template "repo/user_cards" .}} {{else if eq .TabName "overview"}} - <div id="readme_profile" class="markup">{{.ProfileReadme}}</div> + <div id="readme_profile" class="render-content markup">{{.ProfileReadmeContent}}</div> {{else if eq .TabName "organizations"}} {{template "repo/user_cards" .}} {{else}} - {{template "shared/repo_search" .}} - {{template "explore/repo_list" .}} + {{template "shared/repo/search" .}} + {{template "shared/repo/list" .}} {{template "base/paginate" .}} {{end}} </div> diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl index 27b0ef10c7..2c01c88d47 100644 --- a/templates/user/settings/account.tmpl +++ b/templates/user/settings/account.tmpl @@ -43,11 +43,11 @@ <div class="ui list flex-items-block"> {{if $.EnableNotifyMail}} <div class="item"> - <div class="tw-mb-2">{{ctx.Locale.Tr "settings.email_desc"}}</div> - <form action="{{AppSubUrl}}/user/settings/account/email" class="ui form" method="post"> + <form class="ui form tw-w-full" action="{{AppSubUrl}}/user/settings/account/email" method="post"> {{$.CsrfTokenHtml}} <input name="_method" type="hidden" value="NOTIFICATION"> - <div class="tw-flex tw-flex-wrap tw-gap-2"> + <div class="field"> + <label>{{ctx.Locale.Tr "settings.email_desc"}}</label> <div class="ui selection dropdown"> <input name="preference" type="hidden" value="{{.EmailNotificationsPreference}}"> {{svg "octicon-triangle-down" 14 "dropdown icon"}} @@ -59,6 +59,8 @@ <div data-value="disabled" class="{{if eq .EmailNotificationsPreference "disabled"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.disable"}}</div> </div> </div> + </div> + <div class="field"> <button class="ui primary button">{{ctx.Locale.Tr "settings.email_notifications.submit"}}</button> </div> </form> diff --git a/templates/user/settings/appearance.tmpl b/templates/user/settings/appearance.tmpl index 4fa248910a..362f73bcb8 100644 --- a/templates/user/settings/appearance.tmpl +++ b/templates/user/settings/appearance.tmpl @@ -18,7 +18,7 @@ <label>{{ctx.Locale.Tr "settings.ui"}}</label> <select name="theme" class="ui dropdown"> {{range $theme := .AllThemes}} - <option value="{{$theme}}" {{Iif (eq $.SignedUser.Theme $theme) "selected"}}>{{$theme}}</option> + <option value="{{$theme.InternalName}}" {{Iif (eq $.SignedUser.Theme $theme.InternalName) "selected"}}>{{$theme.DisplayName}}</option> {{end}} </select> </div> diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl index 31d1a2ac5b..8c24da7fc9 100644 --- a/templates/user/settings/applications.tmpl +++ b/templates/user/settings/applications.tmpl @@ -50,49 +50,41 @@ </div> </div> <div class="ui bottom attached segment"> - <h5 class="ui top header"> - {{ctx.Locale.Tr "settings.generate_new_token"}} - </h5> - <form id="scoped-access-form" class="ui form ignore-dirty" action="{{.Link}}" method="post"> - {{.CsrfTokenHtml}} - <div class="field {{if .Err_Name}}error{{end}}"> - <label for="name">{{ctx.Locale.Tr "settings.token_name"}}</label> - <input id="name" name="name" value="{{.name}}" autofocus required maxlength="255"> - </div> - <div class="field"> - <label>{{ctx.Locale.Tr "settings.repo_and_org_access"}}</label> - <label class="tw-cursor-pointer"> - <input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="{{$.AccessTokenScopePublicOnly}}"> - {{ctx.Locale.Tr "settings.permissions_public_only"}} - </label> - <label class="tw-cursor-pointer"> - <input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="" checked> - {{ctx.Locale.Tr "settings.permissions_access_all"}} - </label> - </div> - <details class="ui optional field"> - <summary class="tw-pb-4 tw-pl-1"> - {{ctx.Locale.Tr "settings.select_permissions"}} - </summary> - <p class="activity meta"> - <i>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://docs.gitea.com/development/oauth2-provider#scopes" target="_blank"`|SafeHTML)}}</i> - </p> - <div id="scoped-access-token-selector" - data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}" - data-no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}" - data-read-label="{{ctx.Locale.Tr "settings.permission_read"}}" - data-write-label="{{ctx.Locale.Tr "settings.permission_write"}}" - data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}" - > + <details {{if or .name (not .Tokens)}}open{{end}}> + <summary><h4 class="ui header tw-inline-block tw-my-2">{{ctx.Locale.Tr "settings.generate_new_token"}}</h4></summary> + <form class="ui form ignore-dirty" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Name}}error{{end}}"> + <label for="name">{{ctx.Locale.Tr "settings.token_name"}}</label> + <input id="name" name="name" value="{{.name}}" required maxlength="255"> </div> - </details> - <button id="scoped-access-submit" class="ui primary button"> - {{ctx.Locale.Tr "settings.generate_token"}} - </button> - </form>{{/* Fomantic ".ui.form .warning.message" is hidden by default, so put the warning message out of the form*/}} - <div id="scoped-access-warning" class="ui warning message center tw-hidden"> - {{ctx.Locale.Tr "settings.at_least_one_permission"}} - </div> + <div class="field"> + <div class="tw-my-2">{{ctx.Locale.Tr "settings.repo_and_org_access"}}</div> + <label class="gt-checkbox"> + <input type="radio" name="scope-public-only" value="{{$.AccessTokenScopePublicOnly}}"> {{ctx.Locale.Tr "settings.permissions_public_only"}} + </label> + <label class="gt-checkbox"> + <input type="radio" name="scope-public-only" value="" checked> {{ctx.Locale.Tr "settings.permissions_access_all"}} + </label> + </div> + <div> + <div class="tw-my-2">{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (HTMLFormat `href="%s" target="_blank"` "https://docs.gitea.com/development/oauth2-provider#scopes")}}</div> + <table class="ui table unstackable tw-my-2"> + {{range $category := .TokenCategories}} + <tr> + <td>{{$category}}</td> + <td><label class="gt-checkbox"><input type="radio" name="scope-{{$category}}" value="" checked> {{ctx.Locale.Tr "settings.permission_no_access"}}</label></td> + <td><label class="gt-checkbox"><input type="radio" name="scope-{{$category}}" value="read:{{$category}}"> {{ctx.Locale.Tr "settings.permission_read"}}</label></td> + <td><label class="gt-checkbox"><input type="radio" name="scope-{{$category}}" value="write:{{$category}}"> {{ctx.Locale.Tr "settings.permission_write"}}</label></td> + </tr> + {{end}} + </table> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.generate_token"}} + </button> + </form> + </details> </div> {{if .EnableOAuth2}} diff --git a/templates/user/settings/applications_oauth2_list.tmpl b/templates/user/settings/applications_oauth2_list.tmpl index 61098e118b..418d8e9cfc 100644 --- a/templates/user/settings/applications_oauth2_list.tmpl +++ b/templates/user/settings/applications_oauth2_list.tmpl @@ -48,33 +48,33 @@ </div> <div class="ui bottom attached segment"> - <h5 class="ui top header"> - {{ctx.Locale.Tr "settings.create_oauth2_application"}} - </h5> - <form class="ui form ignore-dirty" action="{{.Link}}/oauth2" method="post"> - {{.CsrfTokenHtml}} - <div class="field {{if .Err_AppName}}error{{end}}"> - <label for="application-name">{{ctx.Locale.Tr "settings.oauth2_application_name"}}</label> - <input id="application-name" name="application_name" value="{{.application_name}}" required maxlength="255"> - </div> - <div class="field {{if .Err_RedirectURI}}error{{end}}"> - <label for="redirect-uris">{{ctx.Locale.Tr "settings.oauth2_redirect_uris"}}</label> - <textarea name="redirect_uris" id="redirect-uris"></textarea> - </div> - <div class="field {{if .Err_ConfidentialClient}}error{{end}}"> - <div class="ui checkbox"> - <label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label> - <input class="disable-setting" type="checkbox" name="confidential_client" data-target="#skip-secondary-authorization" checked> + <details {{if .application_name}}open{{end}}> + <summary><h4 class="ui header tw-inline-block tw-my-2">{{ctx.Locale.Tr "settings.create_oauth2_application"}}</h4></summary> + <form class="ui form ignore-dirty" action="{{.Link}}/oauth2" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_AppName}}error{{end}}"> + <label for="application-name">{{ctx.Locale.Tr "settings.oauth2_application_name"}}</label> + <input id="application-name" name="application_name" value="{{.application_name}}" required maxlength="255"> </div> - </div> - <div class="field {{if .Err_SkipSecondaryAuthorization}}error{{end}} disabled" id="skip-secondary-authorization"> - <div class="ui checkbox"> - <label>{{ctx.Locale.Tr "settings.oauth2_skip_secondary_authorization"}}</label> - <input type="checkbox" name="skip_secondary_authorization"> + <div class="field {{if .Err_RedirectURI}}error{{end}}"> + <label for="redirect-uris">{{ctx.Locale.Tr "settings.oauth2_redirect_uris"}}</label> + <textarea name="redirect_uris" id="redirect-uris"></textarea> </div> - </div> - <button class="ui primary button"> - {{ctx.Locale.Tr "settings.create_oauth2_application_button"}} - </button> - </form> + <div class="field {{if .Err_ConfidentialClient}}error{{end}}"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label> + <input class="disable-setting" type="checkbox" name="confidential_client" data-target="#skip-secondary-authorization" checked> + </div> + </div> + <div class="field {{if .Err_SkipSecondaryAuthorization}}error{{end}} disabled" id="skip-secondary-authorization"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "settings.oauth2_skip_secondary_authorization"}}</label> + <input type="checkbox" name="skip_secondary_authorization"> + </div> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.create_oauth2_application_button"}} + </button> + </form> + </details> </div> diff --git a/templates/user/settings/hooks.tmpl b/templates/user/settings/hooks.tmpl index 477c333220..e2d18001f2 100644 --- a/templates/user/settings/hooks.tmpl +++ b/templates/user/settings/hooks.tmpl @@ -1,5 +1,5 @@ {{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings webhooks")}} <div class="user-setting-content"> - {{template "repo/settings/webhook/list" .}} + {{template "repo/settings/webhook/base_list" .}} </div> {{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl index b894ccdfbd..9d62d4ab08 100644 --- a/templates/user/settings/keys_ssh.tmpl +++ b/templates/user/settings/keys_ssh.tmpl @@ -78,7 +78,16 @@ <input readonly="" value="{{$.TokenToSign}}"> <div class="help"> <p>{{ctx.Locale.Tr "settings.ssh_token_help"}}</p> - <p><code>{{printf "echo -n '%s' | ssh-keygen -Y sign -n gitea -f /path_to_PrivateKey_or_RelatedPublicKey" $.TokenToSign}}</code></p> + <p><code>echo -n '{{$.TokenToSign}}' | ssh-keygen -Y sign -n gitea -f /path_to_PrivateKey_or_RelatedPublicKey</code></p> + <details> + <summary>Windows PowerShell</summary> + <p><code>cmd /c "<NUL set /p=`"{{$.TokenToSign}}`"| ssh-keygen -Y sign -n gitea -f /path_to_PrivateKey_or_RelatedPublicKey"</code></p> + </details> + <br> + <details> + <summary>Windows CMD</summary> + <p><code>set /p={{$.TokenToSign}}| ssh-keygen -Y sign -n gitea -f /path_to_PrivateKey_or_RelatedPublicKey</code></p> + </details> </div> <br> </div> diff --git a/templates/user/settings/organization.tmpl b/templates/user/settings/organization.tmpl index 16c27b52cd..a48ca9ec9b 100644 --- a/templates/user/settings/organization.tmpl +++ b/templates/user/settings/organization.tmpl @@ -47,7 +47,7 @@ {{ctx.Locale.Tr "org.members.leave"}} </div> <div class="content"> - <p>{{ctx.Locale.Tr "org.members.leave.detail" (`<span class="dataOrganizationName"></span>`|SafeHTML)}}</p> + <p>{{ctx.Locale.Tr "org.members.leave.detail" (HTMLFormat `<span class="%s"></span>` "dataOrganizationName")}}</p> </div> {{template "base/modal_actions_confirm" .}} </div> diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index 197763425c..d8e5e27b89 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -12,7 +12,7 @@ <span class="text red tw-hidden" id="name-change-prompt"> {{ctx.Locale.Tr "settings.change_username_prompt"}}</span> <span class="text red tw-hidden" id="name-change-redirect-prompt"> {{ctx.Locale.Tr "settings.change_username_redirect_prompt"}}</span> </label> - <input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required {{if or (not .SignedUser.IsLocal) ($.UserDisabledFeatures.Contains "change_username") .IsReverseProxy}}disabled{{end}} maxlength="40"> + <input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" required {{if or (not .SignedUser.IsLocal) ($.UserDisabledFeatures.Contains "change_username") .IsReverseProxy}}disabled{{end}} maxlength="40"> {{if or (not .SignedUser.IsLocal) ($.UserDisabledFeatures.Contains "change_username") .IsReverseProxy}} <p class="help text blue">{{ctx.Locale.Tr "settings.password_username_disabled"}}</p> {{end}} @@ -124,13 +124,7 @@ </div> <div class="inline field tw-pl-4"> - <label for="new-avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label> - <input id="new-avatar" name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp"> - </div> - - <div class="field tw-pl-4 cropper-panel tw-hidden"> - <div>{{ctx.Locale.Tr "settings.cropper_prompt"}}</div> - <div class="cropper-wrapper"><img class="cropper-source" src alt></div> + {{template "shared/avatar_upload_crop" dict "LabelText" (ctx.Locale.Tr "settings.choose_new_avatar")}} </div> <div class="field"> diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl index a50fb586c7..4aed8070de 100644 --- a/templates/user/settings/repos.tmpl +++ b/templates/user/settings/repos.tmpl @@ -81,7 +81,7 @@ {{end}} {{else}} {{if .Repos}} - <div class="ui middle aligned divided list"> + <div class="ui list"> {{range .Repos}} <div class="item"> <div class="content flex-text-block"> |