diff options
Diffstat (limited to 'templates')
513 files changed, 53990 insertions, 0 deletions
diff --git a/templates/admin/actions.tmpl b/templates/admin/actions.tmpl new file mode 100644 index 00000000..597863d7 --- /dev/null +++ b/templates/admin/actions.tmpl @@ -0,0 +1,10 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin actions")}} + <div class="admin-setting-content"> + {{if eq .PageType "runners"}} + {{template "shared/actions/runner_list" .}} + {{end}} + {{if eq .PageType "variables"}} + {{template "shared/variables/variable_list" .}} + {{end}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/applications/list.tmpl b/templates/admin/applications/list.tmpl new file mode 100644 index 00000000..cbb66b16 --- /dev/null +++ b/templates/admin/applications/list.tmpl @@ -0,0 +1,8 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.applications"}} + </h4> + {{template "user/settings/applications_oauth2_list" .}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/applications/oauth2_edit.tmpl b/templates/admin/applications/oauth2_edit.tmpl new file mode 100644 index 00000000..668bfe06 --- /dev/null +++ b/templates/admin/applications/oauth2_edit.tmpl @@ -0,0 +1,6 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}} + <div class="admin-setting-content"> + + {{template "user/settings/applications_oauth2_edit_form" .}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl new file mode 100644 index 00000000..8a8bd611 --- /dev/null +++ b/templates/admin/auth/edit.tmpl @@ -0,0 +1,464 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin edit authentication")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.auths.edit"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{.Source.ID}}"> + <div class="inline field"> + <label>{{ctx.Locale.Tr "admin.auths.auth_type"}}</label> + <input type="hidden" id="auth_type" name="type" value="{{.Source.Type.Int}}"> + <span>{{.Source.TypeName}}</span> + </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> + </div> + + <!-- LDAP and DLDAP --> + {{if or .Source.IsLDAP .Source.IsDLDAP}} + {{$cfg:=.Source.Cfg}} + <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}"> + <label>{{ctx.Locale.Tr "admin.auths.security_protocol"}}</label> + <div class="ui selection security-protocol dropdown"> + <input type="hidden" id="security_protocol" name="security_protocol" value="{{$cfg.SecurityProtocol.Int}}"> + <div class="text">{{$cfg.SecurityProtocolName}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .SecurityProtocols}} + <div class="item" data-value="{{.Type.Int}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + <div class="required field"> + <label for="host">{{ctx.Locale.Tr "admin.auths.host"}}</label> + <input id="host" name="host" value="{{$cfg.Host}}" placeholder="mydomain.com" required> + </div> + <div class="required field"> + <label for="port">{{ctx.Locale.Tr "admin.auths.port"}}</label> + <input id="port" name="port" value="{{$cfg.Port}}" placeholder="636" required> + </div> + <div class="has-tls inline field {{if not .HasTLS}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label> + <input name="skip_verify" type="checkbox" {{if .Source.SkipVerify}}checked{{end}}> + </div> + </div> + {{if .Source.IsLDAP}} + <div class="field"> + <label for="bind_dn">{{ctx.Locale.Tr "admin.auths.bind_dn"}}</label> + <input id="bind_dn" name="bind_dn" value="{{$cfg.BindDN}}" placeholder="cn=Search,dc=mydomain,dc=com"> + </div> + <div class="field"> + <label for="bind_password">{{ctx.Locale.Tr "admin.auths.bind_password"}}</label> + <input id="bind_password" name="bind_password" type="password" value="{{$cfg.BindPassword}}"> + </div> + {{end}} + <div class="{{if .Source.IsLDAP}}required{{end}} field"> + <label for="user_base">{{ctx.Locale.Tr "admin.auths.user_base"}}</label> + <input id="user_base" name="user_base" value="{{$cfg.UserBase}}" placeholder="ou=Users,dc=mydomain,dc=com" {{if .Source.IsLDAP}}required{{end}}> + </div> + {{if .Source.IsDLDAP}} + <div class="required field"> + <label for="user_dn">{{ctx.Locale.Tr "admin.auths.user_dn"}}</label> + <input id="user_dn" name="user_dn" value="{{$cfg.UserDN}}" placeholder="uid=%s,ou=Users,dc=mydomain,dc=com" required> + </div> + {{end}} + <div class="required field"> + <label for="filter">{{ctx.Locale.Tr "admin.auths.filter"}}</label> + <input id="filter" name="filter" value="{{$cfg.Filter}}" placeholder="(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))" required> + </div> + <div class="field"> + <label for="admin_filter">{{ctx.Locale.Tr "admin.auths.admin_filter"}}</label> + <input id="admin_filter" name="admin_filter" value="{{$cfg.AdminFilter}}"> + </div> + <div class="field"> + <label for="restricted_filter">{{ctx.Locale.Tr "admin.auths.restricted_filter"}}</label> + <input id="restricted_filter" name="restricted_filter" value="{{$cfg.RestrictedFilter}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.restricted_filter_helper"}}</p> + </div> + <div class="field"> + <label for="attribute_username">{{ctx.Locale.Tr "admin.auths.attribute_username"}}</label> + <input id="attribute_username" name="attribute_username" value="{{$cfg.AttributeUsername}}" placeholder="{{ctx.Locale.Tr "admin.auths.attribute_username_placeholder"}}"> + </div> + <div class="field"> + <label for="attribute_name">{{ctx.Locale.Tr "admin.auths.attribute_name"}}</label> + <input id="attribute_name" name="attribute_name" value="{{$cfg.AttributeName}}"> + </div> + <div class="field"> + <label for="attribute_surname">{{ctx.Locale.Tr "admin.auths.attribute_surname"}}</label> + <input id="attribute_surname" name="attribute_surname" value="{{$cfg.AttributeSurname}}"> + </div> + <div class="required field"> + <label for="attribute_mail">{{ctx.Locale.Tr "admin.auths.attribute_mail"}}</label> + <input id="attribute_mail" name="attribute_mail" value="{{$cfg.AttributeMail}}" placeholder="mail" required> + </div> + <div class="field"> + <label for="default_domain_name">{{ctx.Locale.Tr "admin.auths.default_domain_name"}}</label> + <input id="default_domain_name" name="default_domain_name" value="{{$cfg.DefaultDomainName}}" placeholder="localhost.local" > + </div> + <div class="field"> + <label for="attribute_ssh_public_key">{{ctx.Locale.Tr "admin.auths.attribute_ssh_public_key"}}</label> + <input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{$cfg.AttributeSSHPublicKey}}" placeholder="SshPublicKey"> + </div> + <div class="field"> + <label for="attribute_avatar">{{ctx.Locale.Tr "admin.auths.attribute_avatar"}}</label> + <input id="attribute_avatar" name="attribute_avatar" value="{{$cfg.AttributeAvatar}}" placeholder="jpegPhoto"> + </div> + + <!-- ldap group begin --> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.enable_ldap_groups"}}</strong></label> + <input type="checkbox" name="groups_enabled" class="js-ldap-group-toggle" {{if $cfg.GroupsEnabled}}checked{{end}}> + </div> + </div> + <div id="ldap-group-options" class="ui segment secondary {{if not $cfg.GroupsEnabled}}tw-hidden{{end}}"> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.group_search_base"}}</label> + <input name="group_dn" value="{{$cfg.GroupDN}}" placeholder="ou=group,dc=mydomain,dc=com"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.group_attribute_list_users"}}</label> + <input name="group_member_uid" value="{{$cfg.GroupMemberUID}}" placeholder="memberUid"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.user_attribute_in_group"}}</label> + <input name="user_uid" value="{{$cfg.UserUID}}" placeholder="uid"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.verify_group_membership"}}</label> + <input name="group_filter" value="{{$cfg.GroupFilter}}" placeholder="(|(cn=gitea_users)(cn=admins))"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.map_group_to_team"}}</label> + <textarea name="group_team_map" rows="5" placeholder='{"cn=my-group,cn=groups,dc=example,dc=org": {"MyForgejoOrganization": ["MyForgejoTeam1", "MyForgejoTeam2"]}}'>{{$cfg.GroupTeamMap}}</textarea> + </div> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "admin.auths.map_group_to_team_removal"}}</label> + <input name="group_team_map_removal" type="checkbox" {{if $cfg.GroupTeamMapRemoval}}checked{{end}}> + </div> + </div> + <!-- ldap group end --> + + {{if .Source.IsLDAP}} + <div class="inline field"> + <div class="ui checkbox"> + <label for="use_paged_search"><strong>{{ctx.Locale.Tr "admin.auths.use_paged_search"}}</strong></label> + <input id="use_paged_search" name="use_paged_search" type="checkbox" {{if $cfg.UsePagedSearch}}checked{{end}}> + </div> + </div> + <div class="field required search-page-size{{if not $cfg.UsePagedSearch}} tw-hidden{{end}}"> + <label for="search_page_size">{{ctx.Locale.Tr "admin.auths.search_page_size"}}</label> + <input id="search_page_size" name="search_page_size" value="{{if $cfg.UsePagedSearch}}{{$cfg.SearchPageSize}}{{end}}"> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.attributes_in_bind"}}</strong></label> + <input name="attributes_in_bind" type="checkbox" {{if $cfg.AttributesInBind}}checked{{end}}> + </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> + <input id="allow_deactivate_all" name="allow_deactivate_all" type="checkbox" {{if $cfg.AllowDeactivateAll}}checked{{end}}> + </div> + </div> + {{end}} + + <!-- SMTP --> + {{if .Source.IsSMTP}} + {{$cfg:=.Source.Cfg}} + <div class="inline required field"> + <label>{{ctx.Locale.Tr "admin.auths.smtp_auth"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{$cfg.Auth}}" required> + <div class="text">{{$cfg.Auth}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .SMTPAuths}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + </div> + <div class="required field"> + <label for="smtp_host">{{ctx.Locale.Tr "admin.auths.smtphost"}}</label> + <input id="smtp_host" name="smtp_host" value="{{$cfg.Host}}" required> + </div> + <div class="required field"> + <label for="smtp_port">{{ctx.Locale.Tr "admin.auths.smtpport"}}</label> + <input id="smtp_port" name="smtp_port" value="{{$cfg.Port}}" required> + </div> + <div class="field"> + <div class="ui checkbox"> + <label for="force_smtps"><strong>{{ctx.Locale.Tr "admin.auths.force_smtps"}}</strong></label> + <input id="force_smtps" name="force_smtps" type="checkbox" {{if $cfg.ForceSMTPS}}checked{{end}}> + </div> + <p class="help">{{ctx.Locale.Tr "admin.auths.force_smtps_helper"}}</p> + </div> + <div class="has-tls inline field {{if not .HasTLS}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label> + <input name="skip_verify" type="checkbox" {{if $cfg.SkipVerify}}checked{{end}}> + </div> + </div> + <div class="field"> + <label for="helo_hostname">{{ctx.Locale.Tr "admin.auths.helo_hostname"}}</label> + <input id="helo_hostname" name="helo_hostname" value="{{$cfg.HeloHostname}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.helo_hostname_helper"}}</p> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label for="disable_helo"><strong>{{ctx.Locale.Tr "admin.auths.disable_helo"}}</strong></label> + <input id="disable_helo" name="disable_helo" type="checkbox" {{if $cfg.DisableHelo}}checked{{end}}> + </div> + </div> + <div class="field"> + <label for="allowed_domains">{{ctx.Locale.Tr "admin.auths.allowed_domains"}}</label> + <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 --> + {{if .Source.IsPAM}} + {{$cfg:=.Source.Cfg}} + <div class="required field"> + <label for="pam_service_name">{{ctx.Locale.Tr "admin.auths.pam_service_name"}}</label> + <input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required> + </div> + <div class="field"> + <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 --> + {{if .Source.IsOAuth2}} + {{$cfg:=.Source.Cfg}} + <div class="inline required field"> + <label>{{ctx.Locale.Tr "admin.auths.oauth2_provider"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="oauth2_provider" name="oauth2_provider" value="{{$cfg.Provider}}" required> + <div class="text">{{.CurrentOAuth2Provider.DisplayName}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .OAuth2Providers}} + <div class="item" data-value="{{.Name}}">{{.DisplayName}}</div> + {{end}} + </div> + </div> + </div> + <div class="required field"> + <label for="oauth2_key">{{ctx.Locale.Tr "admin.auths.oauth2_clientID"}}</label> + <input id="oauth2_key" name="oauth2_key" value="{{$cfg.ClientID}}" required> + </div> + <div class="required field"> + <label for="oauth2_secret">{{ctx.Locale.Tr "admin.auths.oauth2_clientSecret"}}</label> + <input id="oauth2_secret" name="oauth2_secret" value="{{$cfg.ClientSecret}}" required> + </div> + <div class="optional field"> + <label for="oauth2_icon_url">{{ctx.Locale.Tr "admin.auths.oauth2_icon_url"}}</label> + <input id="oauth2_icon_url" name="oauth2_icon_url" value="{{$cfg.IconURL}}"> + </div> + <div class="open_id_connect_auto_discovery_url required field"> + <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> + <input id="oauth2_use_custom_url" name="oauth2_use_custom_url" type="checkbox" {{if $cfg.CustomURLMapping}}checked{{end}}> + </div> + </div> + <div class="oauth2_use_custom_url_field oauth2_auth_url required field"> + <label for="oauth2_auth_url">{{ctx.Locale.Tr "admin.auths.oauth2_authURL"}}</label> + <input id="oauth2_auth_url" name="oauth2_auth_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.AuthURL}}{{end}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_token_url required field"> + <label for="oauth2_token_url">{{ctx.Locale.Tr "admin.auths.oauth2_tokenURL"}}</label> + <input id="oauth2_token_url" name="oauth2_token_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.TokenURL}}{{end}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_profile_url required field"> + <label for="oauth2_profile_url">{{ctx.Locale.Tr "admin.auths.oauth2_profileURL"}}</label> + <input id="oauth2_profile_url" name="oauth2_profile_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.ProfileURL}}{{end}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_email_url required field"> + <label for="oauth2_email_url">{{ctx.Locale.Tr "admin.auths.oauth2_emailURL"}}</label> + <input id="oauth2_email_url" name="oauth2_email_url" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.EmailURL}}{{end}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_tenant required field"> + <label for="oauth2_tenant">{{ctx.Locale.Tr "admin.auths.oauth2_tenant"}}</label> + <input id="oauth2_tenant" name="oauth2_tenant" value="{{if $cfg.CustomURLMapping}}{{$cfg.CustomURLMapping.Tenant}}{{end}}"> + </div> + + {{range .OAuth2Providers}}{{if .CustomURLSettings}} + <input id="{{.Name}}_customURLSettings" type="hidden" data-required="{{.CustomURLSettings.Required}}" data-available="true"> + <input id="{{.Name}}_token_url" value="{{.CustomURLSettings.TokenURL.Value}}" data-available="{{.CustomURLSettings.TokenURL.Available}}" data-required="{{.CustomURLSettings.TokenURL.Required}}" type="hidden"> + <input id="{{.Name}}_auth_url" value="{{.CustomURLSettings.AuthURL.Value}}" data-available="{{.CustomURLSettings.AuthURL.Available}}" data-required="{{.CustomURLSettings.AuthURL.Required}}" type="hidden"> + <input id="{{.Name}}_profile_url" value="{{.CustomURLSettings.ProfileURL.Value}}" data-available="{{.CustomURLSettings.ProfileURL.Available}}" data-required="{{.CustomURLSettings.ProfileURL.Required}}" type="hidden"> + <input id="{{.Name}}_email_url" value="{{.CustomURLSettings.EmailURL.Value}}" data-available="{{.CustomURLSettings.EmailURL.Available}}" data-required="{{.CustomURLSettings.EmailURL.Required}}" type="hidden"> + <input id="{{.Name}}_tenant" value="{{.CustomURLSettings.Tenant.Value}}" data-available="{{.CustomURLSettings.Tenant.Available}}" data-required="{{.CustomURLSettings.Tenant.Required}}" type="hidden"> + {{end}}{{end}} + + <div class="field"> + <label for="oauth2_scopes">{{ctx.Locale.Tr "admin.auths.oauth2_scopes"}}</label> + <input id="oauth2_scopes" name="oauth2_scopes" value="{{if $cfg.Scopes}}{{StringUtils.Join $cfg.Scopes ","}}{{end}}"> + </div> + <div class="field"> + <label for="oauth2_required_claim_name">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_name"}}</label> + <input id="oauth2_required_claim_name" name="oauth2_required_claim_name" value="{{$cfg.RequiredClaimName}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_name_helper"}}</p> + </div> + <div class="field"> + <label for="oauth2_required_claim_value">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_value"}}</label> + <input id="oauth2_required_claim_value" name="oauth2_required_claim_value" value="{{$cfg.RequiredClaimValue}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_value_helper"}}</p> + </div> + <div class="field"> + <label for="oauth2_group_claim_name">{{ctx.Locale.Tr "admin.auths.oauth2_group_claim_name"}}</label> + <input id="oauth2_group_claim_name" name="oauth2_group_claim_name" value="{{$cfg.GroupClaimName}}"> + </div> + <div class="field"> + <label for="oauth2_admin_group">{{ctx.Locale.Tr "admin.auths.oauth2_admin_group"}}</label> + <input id="oauth2_admin_group" name="oauth2_admin_group" value="{{$cfg.AdminGroup}}"> + </div> + <div class="field"> + <label for="oauth2_restricted_group">{{ctx.Locale.Tr "admin.auths.oauth2_restricted_group"}}</label> + <input id="oauth2_restricted_group" name="oauth2_restricted_group" value="{{$cfg.RestrictedGroup}}"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.oauth2_map_group_to_team"}}</label> + <textarea name="oauth2_group_team_map" rows="5" placeholder='{"Developer": {"MyForgejoOrganization": ["MyForgejoTeam1", "MyForgejoTeam2"]}}'>{{$cfg.GroupTeamMap}}</textarea> + </div> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "admin.auths.oauth2_map_group_to_team_removal"}}</label> + <input name="oauth2_group_team_map_removal" type="checkbox" {{if $cfg.GroupTeamMapRemoval}}checked{{end}}> + </div> + {{end}} + + <!-- SSPI --> + {{if .Source.IsSSPI}} + {{$cfg:=.Source.Cfg}} + <div class="field"> + <div class="ui checkbox"> + <label for="sspi_auto_create_users"><strong>{{ctx.Locale.Tr "admin.auths.sspi_auto_create_users"}}</strong></label> + <input id="sspi_auto_create_users" name="sspi_auto_create_users" class="sspi-auto-create-users" type="checkbox" {{if $cfg.AutoCreateUsers}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_auto_create_users_helper"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <label for="sspi_auto_activate_users"><strong>{{ctx.Locale.Tr "admin.auths.sspi_auto_activate_users"}}</strong></label> + <input id="sspi_auto_activate_users" name="sspi_auto_activate_users" class="sspi-auto-activate-users" type="checkbox" {{if $cfg.AutoActivateUsers}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_auto_activate_users_helper"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <label for="sspi_strip_domain_names"><strong>{{ctx.Locale.Tr "admin.auths.sspi_strip_domain_names"}}</strong></label> + <input id="sspi_strip_domain_names" name="sspi_strip_domain_names" class="sspi-strip-domain-names" type="checkbox" {{if $cfg.StripDomainNames}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_strip_domain_names_helper"}}</p> + </div> + </div> + <div class="required field"> + <label for="sspi_separator_replacement">{{ctx.Locale.Tr "admin.auths.sspi_separator_replacement"}}</label> + <input id="sspi_separator_replacement" name="sspi_separator_replacement" value="{{$cfg.SeparatorReplacement}}" required> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_separator_replacement_helper"}}</p> + </div> + <div class="field"> + <label for="sspi_default_language">{{ctx.Locale.Tr "admin.auths.sspi_default_language"}}</label> + <div class="ui language selection dropdown" id="sspi_default_language"> + <input name="sspi_default_language" type="hidden" value="{{$cfg.DefaultLanguage}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{range .AllLangs}}{{if eq $cfg.DefaultLanguage .Lang}}{{.Name}}{{end}}{{end}}</div> + <div class="menu"> + <div class="item{{if not $.SSPIDefaultLanguage}} active selected{{end}}" data-value="">-</div> + {{range .AllLangs}} + <div class="item{{if eq $cfg.DefaultLanguage .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div> + {{end}} + </div> + </div> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_default_language_helper"}}</p> + </div> + {{end}} + {{if .Source.IsLDAP}} + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.syncenabled"}}</strong></label> + <input name="is_sync_enabled" type="checkbox" {{if .Source.IsSyncEnabled}}checked{{end}}> + </div> + </div> + {{end}} + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.activated"}}</strong></label> + <input name="is_active" type="checkbox" {{if .Source.IsActive}}checked{{end}}> + </div> + </div> + + <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> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.auths.tips"}} + </h4> + <div class="ui attached segment"> + <h5>{{ctx.Locale.Tr "admin.auths.tips.gmail_settings"}}</h5> + <p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p> + + <h5 class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general"}}:</h5> + <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 new file mode 100644 index 00000000..6483ec80 --- /dev/null +++ b/templates/admin/auth/list.tmpl @@ -0,0 +1,38 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin authentication")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.auths.auth_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/admin/auths/new">{{ctx.Locale.Tr "admin.auths.new"}}</a> + </div> + </h4> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>ID</th> + <th>{{ctx.Locale.Tr "admin.auths.name"}}</th> + <th>{{ctx.Locale.Tr "admin.auths.type"}}</th> + <th>{{ctx.Locale.Tr "admin.auths.enabled"}}</th> + <th>{{ctx.Locale.Tr "admin.auths.updated"}}</th> + <th>{{ctx.Locale.Tr "admin.users.created"}}</th> + <th>{{ctx.Locale.Tr "admin.users.edit"}}</th> + </tr> + </thead> + <tbody> + {{range .Sources}} + <tr> + <td>{{.ID}}</td> + <td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{.Name}}</a></td> + <td>{{.TypeName}}</td> + <td>{{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{DateTime "short" .UpdatedUnix}}</td> + <td>{{DateTime "short" .CreatedUnix}}</td> + <td><a href="{{AppSubUrl}}/admin/auths/{{.ID}}">{{svg "octicon-pencil"}}</a></td> + </tr> + {{end}} + </tbody> + </table> + </div> + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/auth/new.tmpl b/templates/admin/auth/new.tmpl new file mode 100644 index 00000000..f6a14e1f --- /dev/null +++ b/templates/admin/auth/new.tmpl @@ -0,0 +1,122 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin new authentication")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.auths.new"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <!-- Types and name --> + <div class="inline required field {{if .Err_Type}}error{{end}}"> + <label>{{ctx.Locale.Tr "admin.auths.auth_type"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="auth_type" name="type" value="{{.type}}"> + <div class="text">{{.CurrentTypeName}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .AuthSources}} + <div class="item" data-value="{{.Type.Int}}">{{.Name}}</div> + {{end}} + </div> + </div> + </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="{{.name}}" autofocus required> + </div> + + <!-- LDAP and DLDAP --> + {{template "admin/auth/source/ldap" .}} + + <!-- SMTP --> + {{template "admin/auth/source/smtp" .}} + + <!-- PAM --> + <div class="pam required field {{if not (eq .type 4)}}tw-hidden{{end}}"> + <label for="pam_service_name">{{ctx.Locale.Tr "admin.auths.pam_service_name"}}</label> + <input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}"> + <label for="pam_email_domain">{{ctx.Locale.Tr "admin.auths.pam_email_domain"}}</label> + <input id="pam_email_domain" name="pam_email_domain" value="{{.pam_email_domain}}"> + </div> + <div class="pam optional field {{if not (eq .type 4)}}tw-hidden{{end}}"> + <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 .skip_local_two_fa}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p> + </div> + </div> + + <!-- OAuth2 --> + {{template "admin/auth/source/oauth" .}} + + <!-- SSPI --> + {{template "admin/auth/source/sspi" .}} + + <div class="ldap field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.attributes_in_bind"}}</strong></label> + <input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}> + </div> + </div> + <div class="ldap inline field {{if not (eq .type 2)}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.syncenabled"}}</strong></label> + <input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.activated"}}</strong></label> + <input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}> + </div> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "admin.auths.new"}}</button> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.auths.tips"}} + </h4> + <div class="ui attached segment"> + <h5>{{ctx.Locale.Tr "admin.auths.tips.gmail_settings"}}</h5> + <p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p> + + <h5 class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general"}}:</h5> + <p class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p> + + <h5 class="ui top attached header">{{ctx.Locale.Tr "admin.auths.tip.oauth2_provider"}}</h5> + <div class="ui attached segment"> + <li>Bitbucket</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.bitbucket"}}</span> + <li>Dropbox</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.dropbox"}}</span> + <li>Facebook</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.facebook"}}</span> + <li>GitHub</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.github"}}</span> + <li>GitLab</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.gitlab_new"}}</span> + <li>Google</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.google_plus"}}</span> + <li>OpenID Connect</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.openid_connect"}}</span> + <li>Twitter</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.twitter"}}</span> + <li>Discord</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.discord"}}</span> + <li>Gitea</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.gitea"}}</span> + <li>Nextcloud</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.nextcloud"}}</span> + <li>Yandex</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.yandex"}}</span> + <li>Mastodon</li> + <span>{{ctx.Locale.Tr "admin.auths.tip.mastodon"}}</span> + </div> + </div> + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/auth/source/ldap.tmpl b/templates/admin/auth/source/ldap.tmpl new file mode 100644 index 00000000..6cb6643f --- /dev/null +++ b/templates/admin/auth/source/ldap.tmpl @@ -0,0 +1,145 @@ +<div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}tw-hidden{{end}}"> + <div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}"> + <label>{{ctx.Locale.Tr "admin.auths.security_protocol"}}</label> + <div class="ui selection security-protocol dropdown"> + <input type="hidden" id="security_protocol" name="security_protocol" value="{{.security_protocol}}"> + <div class="text">{{.CurrentSecurityProtocol}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .SecurityProtocols}} + <div class="item" data-value="{{.Type.Int}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + <div class="required field"> + <label for="host">{{ctx.Locale.Tr "admin.auths.host"}}</label> + <input id="host" name="host" value="{{.host}}" placeholder="mydomain.com"> + </div> + <div class="required field"> + <label for="port">{{ctx.Locale.Tr "admin.auths.port"}}</label> + <input id="port" name="port" value="{{.port}}" placeholder="636"> + </div> + <div class="has-tls inline field {{if not .HasTLS}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label> + <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}> + </div> + </div> + <div class="ldap field {{if not (eq .type 2)}}tw-hidden{{end}}"> + <label for="bind_dn">{{ctx.Locale.Tr "admin.auths.bind_dn"}}</label> + <input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="cn=Search,dc=mydomain,dc=com"> + </div> + <div class="ldap field {{if not (eq .type 2)}}tw-hidden{{end}}"> + <label for="bind_password">{{ctx.Locale.Tr "admin.auths.bind_password"}}</label> + <input id="bind_password" name="bind_password" type="password" autocomplete="off" value="{{.bind_password}}"> + </div> + <div class="binddnrequired {{if (eq .type 2)}}required{{end}} field"> + <label for="user_base">{{ctx.Locale.Tr "admin.auths.user_base"}}</label> + <input id="user_base" name="user_base" value="{{.user_base}}" placeholder="ou=Users,dc=mydomain,dc=com"> + </div> + <div class="dldap required field {{if not (eq .type 5)}}tw-hidden{{end}}"> + <label for="user_dn">{{ctx.Locale.Tr "admin.auths.user_dn"}}</label> + <input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="uid=%s,ou=Users,dc=mydomain,dc=com"> + </div> + <div class="required field"> + <label for="filter">{{ctx.Locale.Tr "admin.auths.filter"}}</label> + <input id="filter" name="filter" value="{{.filter}}" placeholder="(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))"> + </div> + <div class="field"> + <label for="admin_filter">{{ctx.Locale.Tr "admin.auths.admin_filter"}}</label> + <input id="admin_filter" name="admin_filter" value="{{.admin_filter}}"> + </div> + <div class="field"> + <label for="restricted_filter">{{ctx.Locale.Tr "admin.auths.restricted_filter"}}</label> + <input id="restricted_filter" name="restricted_filter" value="{{.restricted_filter}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.restricted_filter_helper"}}</p> + </div> + <div class="field"> + <label for="attribute_username">{{ctx.Locale.Tr "admin.auths.attribute_username"}}</label> + <input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{ctx.Locale.Tr "admin.auths.attribute_username_placeholder"}}"> + </div> + <div class="field"> + <label for="attribute_name">{{ctx.Locale.Tr "admin.auths.attribute_name"}}</label> + <input id="attribute_name" name="attribute_name" value="{{.attribute_name}}"> + </div> + <div class="field"> + <label for="attribute_surname">{{ctx.Locale.Tr "admin.auths.attribute_surname"}}</label> + <input id="attribute_surname" name="attribute_surname" value="{{.attribute_surname}}"> + </div> + <div class="required field"> + <label for="attribute_mail">{{ctx.Locale.Tr "admin.auths.attribute_mail"}}</label> + <input id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" placeholder="mail"> + </div> + <div class="field"> + <label for="default_domain_name">{{ctx.Locale.Tr "admin.auths.default_domain_name"}}</label> + <input id="default_domain_name" name="default_domain_name" value="{{.default_domain_name}}" placeholder="localhost.local"> + </div> + <div class="field"> + <label for="attribute_ssh_public_key">{{ctx.Locale.Tr "admin.auths.attribute_ssh_public_key"}}</label> + <input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{.attribute_ssh_public_key}}" placeholder="SshPublicKey"> + </div> + <div class="field"> + <label for="attribute_avatar">{{ctx.Locale.Tr "admin.auths.attribute_avatar"}}</label> + <input id="attribute_avatar" name="attribute_avatar" value="{{.attribute_avatar}}" placeholder="jpegPhoto"> + </div> + + <!-- ldap group begin --> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.enable_ldap_groups"}}</strong></label> + <input type="checkbox" name="groups_enabled" class="js-ldap-group-toggle" {{if .groups_enabled}}checked{{end}}> + </div> + </div> + <div id="ldap-group-options" class="ui segment secondary"> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.group_search_base"}}</label> + <input name="group_dn" value="{{.group_dn}}" placeholder="ou=group,dc=mydomain,dc=com"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.group_attribute_list_users"}}</label> + <input name="group_member_uid" value="{{.group_member_uid}}" placeholder="memberUid"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.user_attribute_in_group"}}</label> + <input name="user_uid" value="{{.user_uid}}" placeholder="uid"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.verify_group_membership"}}</label> + <input name="group_filter" value="{{.group_filter}}" placeholder="(|(cn=gitea_users)(cn=admins))"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.map_group_to_team"}}</label> + <textarea name="group_team_map" rows="5" placeholder='{"cn=my-group,cn=groups,dc=example,dc=org": {"MyForgejoOrganization": ["MyForgejoTeam1", "MyForgejoTeam2"]}}'>{{.group_team_map}}</textarea> + </div> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "admin.auths.map_group_to_team_removal"}}</label> + <input name="group_team_map_removal" type="checkbox" {{if .group_team_map_removal}}checked{{end}}> + </div> + </div> + <!-- ldap group end --> + + <div class="ldap inline field {{if not (eq .type 2)}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label for="use_paged_search"><strong>{{ctx.Locale.Tr "admin.auths.use_paged_search"}}</strong></label> + <input id="use_paged_search" name="use_paged_search" class="use-paged-search" type="checkbox" {{if .use_paged_search}}checked{{end}}> + </div> + </div> + <div class="ldap field search-page-size required {{if or (not (eq .type 2)) (not .use_paged_search)}}tw-hidden{{end}}"> + <label for="search_page_size">{{ctx.Locale.Tr "admin.auths.search_page_size"}}</label> + <input id="search_page_size" name="search_page_size" value="{{.search_page_size}}"> + </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 .skip_local_two_fa}}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> + <input id="allow_deactivate_all" name="allow_deactivate_all" type="checkbox" {{if .allow_deactivate_all}}checked{{end}}> + </div> + </div> +</div> diff --git a/templates/admin/auth/source/oauth.tmpl b/templates/admin/auth/source/oauth.tmpl new file mode 100644 index 00000000..0560cc82 --- /dev/null +++ b/templates/admin/auth/source/oauth.tmpl @@ -0,0 +1,109 @@ +<div class="oauth2 field {{if not (eq .type 6)}}tw-hidden{{end}}"> + <div class="inline required field"> + <label>{{ctx.Locale.Tr "admin.auths.oauth2_provider"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="oauth2_provider" name="oauth2_provider" value="{{.oauth2_provider}}"> + <div class="text">{{.oauth2_provider}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .OAuth2Providers}} + <div class="item" data-value="{{.Name}}">{{.DisplayName}}</div> + {{end}} + </div> + </div> + </div> + <div class="required field"> + <label for="oauth2_key">{{ctx.Locale.Tr "admin.auths.oauth2_clientID"}}</label> + <input id="oauth2_key" name="oauth2_key" value="{{.oauth2_key}}"> + </div> + <div class="required field"> + <label for="oauth2_secret">{{ctx.Locale.Tr "admin.auths.oauth2_clientSecret"}}</label> + <input id="oauth2_secret" name="oauth2_secret" value="{{.oauth2_secret}}"> + </div> + <div class="optional field"> + <label for="oauth2_icon_url">{{ctx.Locale.Tr "admin.auths.oauth2_icon_url"}}</label> + <input id="oauth2_icon_url" name="oauth2_icon_url" value="{{.oauth2_icon_url}}"> + </div> + <div class="open_id_connect_auto_discovery_url required field{{if .Err_DiscoveryURL}} error{{end}}"> + <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="{{.open_id_connect_auto_discovery_url}}"> + </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 .skip_local_two_fa}}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> + <input id="oauth2_use_custom_url" name="oauth2_use_custom_url" type="checkbox"> + </div> + </div> + <div class="oauth2_use_custom_url_field oauth2_auth_url required field"> + <label for="oauth2_auth_url">{{ctx.Locale.Tr "admin.auths.oauth2_authURL"}}</label> + <input id="oauth2_auth_url" name="oauth2_auth_url" value="{{.oauth2_auth_url}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_token_url required field"> + <label for="oauth2_token_url">{{ctx.Locale.Tr "admin.auths.oauth2_tokenURL"}}</label> + <input id="oauth2_token_url" name="oauth2_token_url" value="{{.oauth2_token_url}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_profile_url required field"> + <label for="oauth2_profile_url">{{ctx.Locale.Tr "admin.auths.oauth2_profileURL"}}</label> + <input id="oauth2_profile_url" name="oauth2_profile_url" value="{{.oauth2_profile_url}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_email_url required field"> + <label for="oauth2_email_url">{{ctx.Locale.Tr "admin.auths.oauth2_emailURL"}}</label> + <input id="oauth2_email_url" name="oauth2_email_url" value="{{.oauth2_email_url}}"> + </div> + <div class="oauth2_use_custom_url_field oauth2_tenant required field"> + <label for="oauth2_tenant">{{ctx.Locale.Tr "admin.auths.oauth2_tenant"}}</label> + <input id="oauth2_tenant" name="oauth2_tenant" value="{{.oauth2_tenant}}"> + </div> + + {{range .OAuth2Providers}}{{if .CustomURLSettings}} + <input id="{{.Name}}_customURLSettings" type="hidden" data-required="{{.CustomURLSettings.Required}}" data-available="true"> + <input id="{{.Name}}_token_url" value="{{.CustomURLSettings.TokenURL.Value}}" data-available="{{.CustomURLSettings.TokenURL.Available}}" data-required="{{.CustomURLSettings.TokenURL.Required}}" type="hidden"> + <input id="{{.Name}}_auth_url" value="{{.CustomURLSettings.AuthURL.Value}}" data-available="{{.CustomURLSettings.AuthURL.Available}}" data-required="{{.CustomURLSettings.AuthURL.Required}}" type="hidden"> + <input id="{{.Name}}_profile_url" value="{{.CustomURLSettings.ProfileURL.Value}}" data-available="{{.CustomURLSettings.ProfileURL.Available}}" data-required="{{.CustomURLSettings.ProfileURL.Required}}" type="hidden"> + <input id="{{.Name}}_email_url" value="{{.CustomURLSettings.EmailURL.Value}}" data-available="{{.CustomURLSettings.EmailURL.Available}}" data-required="{{.CustomURLSettings.EmailURL.Required}}" type="hidden"> + <input id="{{.Name}}_tenant" value="{{.CustomURLSettings.Tenant.Value}}" data-available="{{.CustomURLSettings.Tenant.Available}}" data-required="{{.CustomURLSettings.Tenant.Required}}" type="hidden"> + {{end}}{{end}} + + <div class="field"> + <label for="oauth2_scopes">{{ctx.Locale.Tr "admin.auths.oauth2_scopes"}}</label> + <input id="oauth2_scopes" name="oauth2_scopes" value="{{.oauth2_scopes}}"> + </div> + <div class="field"> + <label for="oauth2_required_claim_name">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_name"}}</label> + <input id="oauth2_required_claim_name" name="oauth2_required_claim_name" value="{{.oauth2_required_claim_name}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_name_helper"}}</p> + </div> + <div class="field"> + <label for="oauth2_required_claim_value">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_value"}}</label> + <input id="oauth2_required_claim_value" name="oauth2_required_claim_value" value="{{.oauth2_required_claim_value}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.oauth2_required_claim_value_helper"}}</p> + </div> + <div class="field"> + <label for="oauth2_group_claim_name">{{ctx.Locale.Tr "admin.auths.oauth2_group_claim_name"}}</label> + <input id="oauth2_group_claim_name" name="oauth2_group_claim_name" value="{{.oauth2_group_claim_name}}"> + </div> + <div class="field"> + <label for="oauth2_admin_group">{{ctx.Locale.Tr "admin.auths.oauth2_admin_group"}}</label> + <input id="oauth2_admin_group" name="oauth2_admin_group" value="{{.oauth2_admin_group}}"> + </div> + <div class="field"> + <label for="oauth2_restricted_group">{{ctx.Locale.Tr "admin.auths.oauth2_restricted_group"}}</label> + <input id="oauth2_restricted_group" name="oauth2_restricted_group" value="{{.oauth2_restricted_group}}"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "admin.auths.oauth2_map_group_to_team"}}</label> + <textarea name="oauth2_group_team_map" rows="5" placeholder='{"Developer": {"MyForgejoOrganization": ["MyForgejoTeam1", "MyForgejoTeam2"]}}'>{{.oauth2_group_team_map}}</textarea> + </div> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "admin.auths.oauth2_map_group_to_team_removal"}}</label> + <input name="oauth2_group_team_map_removal" type="checkbox" {{if .oauth2_group_team_map_removal}}checked{{end}}> + </div> +</div> diff --git a/templates/admin/auth/source/smtp.tmpl b/templates/admin/auth/source/smtp.tmpl new file mode 100644 index 00000000..31195acf --- /dev/null +++ b/templates/admin/auth/source/smtp.tmpl @@ -0,0 +1,59 @@ +<div class="smtp field {{if not (eq .type 3)}}tw-hidden{{end}}"> + <div class="inline required field"> + <label>{{ctx.Locale.Tr "admin.auths.smtp_auth"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="smtp_auth" name="smtp_auth" value="{{.smtp_auth}}"> + <div class="text">{{.smtp_auth}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .SMTPAuths}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + </div> + <div class="required field"> + <label for="smtp_host">{{ctx.Locale.Tr "admin.auths.smtphost"}}</label> + <input id="smtp_host" name="smtp_host" value="{{.smtp_host}}"> + </div> + <div class="required field"> + <label for="smtp_port">{{ctx.Locale.Tr "admin.auths.smtpport"}}</label> + <input id="smtp_port" name="smtp_port" value="{{.smtp_port}}"> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label for="force_smtps"><strong>{{ctx.Locale.Tr "admin.auths.force_smtps"}}</strong></label> + <input id="force_smtps" name="force_smtps" type="checkbox" {{if .force_smtps}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.force_smtps_helper"}}</p> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label> + <input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}> + </div> + </div> + <div class="field"> + <label for="helo_hostname">{{ctx.Locale.Tr "admin.auths.helo_hostname"}}</label> + <input id="helo_hostname" name="helo_hostname" value="{{.helo_hostname}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.helo_hostname_helper"}}</p> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label for="disable_helo"><strong>{{ctx.Locale.Tr "admin.auths.disable_helo"}}</strong></label> + <input id="disable_helo" name="disable_helo" type="checkbox" {{if .disable_helo}}checked{{end}}> + </div> + </div> + <div class="field"> + <label for="allowed_domains">{{ctx.Locale.Tr "admin.auths.allowed_domains"}}</label> + <input id="allowed_domains" name="allowed_domains" value="{{.allowed_domains}}"> + <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 .skip_local_two_fa}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p> + </div> + </div> +</div> diff --git a/templates/admin/auth/source/sspi.tmpl b/templates/admin/auth/source/sspi.tmpl new file mode 100644 index 00000000..6a3f00f9 --- /dev/null +++ b/templates/admin/auth/source/sspi.tmpl @@ -0,0 +1,43 @@ +<div class="sspi field {{if not (eq .type 7)}}tw-hidden{{end}}"> + <div class="field"> + <div class="ui checkbox"> + <label for="sspi_auto_create_users"><strong>{{ctx.Locale.Tr "admin.auths.sspi_auto_create_users"}}</strong></label> + <input id="sspi_auto_create_users" name="sspi_auto_create_users" class="sspi-auto-create-users" type="checkbox" {{if .SSPIAutoCreateUsers}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_auto_create_users_helper"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <label for="sspi_auto_activate_users"><strong>{{ctx.Locale.Tr "admin.auths.sspi_auto_activate_users"}}</strong></label> + <input id="sspi_auto_activate_users" name="sspi_auto_activate_users" class="sspi-auto-activate-users" type="checkbox" {{if .SSPIAutoActivateUsers}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_auto_activate_users_helper"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <label for="sspi_strip_domain_names"><strong>{{ctx.Locale.Tr "admin.auths.sspi_strip_domain_names"}}</strong></label> + <input id="sspi_strip_domain_names" name="sspi_strip_domain_names" class="sspi-strip-domain-names" type="checkbox" {{if .SSPIStripDomainNames}}checked{{end}}> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_strip_domain_names_helper"}}</p> + </div> + </div> + <div class="required field"> + <label for="sspi_separator_replacement">{{ctx.Locale.Tr "admin.auths.sspi_separator_replacement"}}</label> + <input id="sspi_separator_replacement" name="sspi_separator_replacement" value="{{.SSPISeparatorReplacement}}"> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_separator_replacement_helper"}}</p> + </div> + <div class="field"> + <label for="sspi_default_language">{{ctx.Locale.Tr "admin.auths.sspi_default_language"}}</label> + <div class="ui language selection dropdown" id="sspi_default_language"> + <input name="sspi_default_language" type="hidden" value="{{.SSPIDefaultLanguage}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{range .AllLangs}}{{if eq $.SSPIDefaultLanguage .Lang}}{{.Name}}{{end}}{{end}}</div> + <div class="menu"> + <div class="item{{if not $.SSPIDefaultLanguage}} active selected{{end}}" data-value="">-</div> + {{range .AllLangs}} + <div class="item{{if eq $.SSPIDefaultLanguage .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div> + {{end}} + </div> + </div> + <p class="help">{{ctx.Locale.Tr "admin.auths.sspi_default_language_helper"}}</p> + </div> +</div> diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl new file mode 100644 index 00000000..8f2b1c12 --- /dev/null +++ b/templates/admin/config.tmpl @@ -0,0 +1,355 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.server_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.app_name"}}</dt> + <dd>{{AppName}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.app_slogan"}}</dt> + <dd>{{AppSlogan}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.app_ver"}}</dt> + <dd>{{AppVer}}{{.AppBuiltWith}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.custom_conf"}}</dt> + <dd>{{.CustomConf}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.app_url"}}</dt> + <dd>{{.AppUrl}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.domain"}}</dt> + <dd>{{.Domain}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.offline_mode"}}</dt> + <dd>{{if .OfflineMode}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.disable_router_log"}}</dt> + <dd>{{if .DisableRouterLog}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + + <div class="divider"></div> + + <dt>{{ctx.Locale.Tr "admin.config.run_user"}}</dt> + <dd>{{.RunUser}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.run_mode"}}</dt> + <dd>{{.RunMode}}</dd> + + <div class="divider"></div> + + <dt>{{ctx.Locale.Tr "admin.config.git_version"}}</dt> + <dd>{{.GitVersion}}</dd> + + <div class="divider"></div> + + <dt>{{ctx.Locale.Tr "admin.config.app_data_path"}}</dt> + <dd>{{.AppDataPath}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.repo_root_path"}}</dt> + <dd>{{.RepoRootPath}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.custom_file_root_path"}}</dt> + <dd>{{.CustomRootPath}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.log_file_root_path"}}</dt> + <dd>{{.LogRootPath}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.script_type"}}</dt> + <dd>{{.ScriptType}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.reverse_auth_user"}}</dt> + <dd>{{.ReverseProxyAuthUser}}</dd> + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.ssh_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.ssh_enabled"}}</dt> + <dd>{{if not .SSH.Disabled}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + {{if not .SSH.Disabled}} + <dt>{{ctx.Locale.Tr "admin.config.ssh_start_builtin_server"}}</dt> + <dd>{{if .SSH.StartBuiltinServer}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.ssh_domain"}}</dt> + <dd>{{.SSH.Domain}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.ssh_port"}}</dt> + <dd>{{.SSH.Port}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.ssh_listen_port"}}</dt> + <dd>{{.SSH.ListenPort}}</dd> + + {{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>{{if .SSH.MinimumKeySizeCheck}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + {{if .SSH.MinimumKeySizeCheck}} + <dt>{{ctx.Locale.Tr "admin.config.ssh_minimum_key_sizes"}}</dt> + <dd>{{.SSH.MinimumKeySizes}}</dd> + {{end}} + {{end}} + {{end}} + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.lfs_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.lfs_enabled"}}</dt> + <dd>{{if .LFS.StartServer}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + {{if .LFS.StartServer}} + <dt>{{ctx.Locale.Tr "admin.config.lfs_content_path"}}</dt> + <dd>{{JsonUtils.EncodeToString .LFS.Storage.ToShadowCopy}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.lfs_http_auth_expiry"}}</dt> + <dd>{{.LFS.HTTPAuthExpiry}}</dd> + {{end}} + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.db_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.db_type"}}</dt> + <dd>{{.DbCfg.Type}}</dd> + {{if not (eq .DbCfg.Type "sqlite3")}} + <dt>{{ctx.Locale.Tr "admin.config.db_host"}}</dt> + <dd>{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.db_name"}}</dt> + <dd>{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.db_user"}}</dt> + <dd>{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}</dd> + {{end}} + {{if eq .DbCfg.Type "postgres"}} + <dt>{{ctx.Locale.Tr "admin.config.db_schema"}}</dt> + <dd>{{if .DbCfg.Schema}}{{.DbCfg.Schema}}{{else}}-{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.db_ssl_mode"}}</dt> + <dd>{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}</dd> + {{end}} + {{if eq .DbCfg.Type "sqlite3"}} + <dt>{{ctx.Locale.Tr "admin.config.db_path"}}</dt> + <dd>{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}</dd> + {{end}} + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.service_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.register_email_confirm"}}</dt> + <dd>{{if .Service.RegisterEmailConfirm}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.disable_register"}}</dt> + <dd>{{if .Service.DisableRegistration}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.allow_only_internal_registration"}}</dt> + <dd>{{if .Service.AllowOnlyInternalRegistration}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.allow_only_external_registration"}}</dt> + <dd>{{if .Service.AllowOnlyExternalRegistration}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.show_registration_button"}}</dt> + <dd>{{if .Service.ShowRegistrationButton}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.enable_openid_signup"}}</dt> + <dd>{{if .Service.EnableOpenIDSignUp}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.enable_openid_signin"}}</dt> + <dd>{{if .Service.EnableOpenIDSignIn}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.require_sign_in_view"}}</dt> + <dd>{{if .Service.RequireSignInView}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.mail_notify"}}</dt> + <dd>{{if .Service.EnableNotifyMail}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.enable_captcha"}}</dt> + <dd>{{if .Service.EnableCaptcha}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.default_keep_email_private"}}</dt> + <dd>{{if .Service.DefaultKeepEmailPrivate}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.default_allow_create_organization"}}</dt> + <dd>{{if .Service.DefaultAllowCreateOrganization}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.allow_dots_in_usernames"}}</dt> + <dd>{{if .Service.AllowDotsInUsernames}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.enable_timetracking"}}</dt> + <dd>{{if .Service.EnableTimetracking}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + {{if .Service.EnableTimetracking}} + <dt>{{ctx.Locale.Tr "admin.config.default_enable_timetracking"}}</dt> + <dd>{{if .Service.DefaultEnableTimetracking}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.default_allow_only_contributors_to_track_time"}}</dt> + <dd>{{if .Service.DefaultAllowOnlyContributorsToTrackTime}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + {{end}} + <dt>{{ctx.Locale.Tr "admin.config.default_visibility_organization"}}</dt> + <dd>{{.Service.DefaultOrgVisibility}}</dd> + + <dt>{{ctx.Locale.Tr "admin.config.no_reply_address"}}</dt> + <dd>{{if .Service.NoReplyAddress}}{{.Service.NoReplyAddress}}{{else}}-{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.default_enable_dependencies"}}</dt> + <dd>{{if .Service.DefaultEnableDependencies}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <div class="divider"></div> + <dt>{{ctx.Locale.Tr "admin.config.active_code_lives"}}</dt> + <dd>{{.Service.ActiveCodeLives}} {{ctx.Locale.Tr "tool.raw_minutes"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.reset_password_code_lives"}}</dt> + <dd>{{.Service.ResetPwdCodeLives}} {{ctx.Locale.Tr "tool.raw_minutes"}}</dd> + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.webhook_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.queue_length"}}</dt> + <dd>{{.Webhook.QueueLength}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.deliver_timeout"}}</dt> + <dd>{{.Webhook.DeliverTimeout}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.skip_tls_verify"}}</dt> + <dd>{{if .Webhook.SkipTLSVerify}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.mailer_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.mailer_enabled"}}</dt> + <dd>{{if .MailerEnabled}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + {{if .MailerEnabled}} + <dt>{{ctx.Locale.Tr "admin.config.mailer_name"}}</dt> + <dd>{{.Mailer.Name}}</dd> + {{if eq .Mailer.Protocol "sendmail"}} + <dt>{{ctx.Locale.Tr "admin.config.mailer_use_sendmail"}}</dt> + <dd>{{svg "octicon-check"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.mailer_sendmail_path"}}</dt> + <dd>{{.Mailer.SendmailPath}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.mailer_sendmail_args"}}</dt> + <dd>{{.Mailer.SendmailArgs}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.mailer_sendmail_timeout"}}</dt> + <dd>{{.Mailer.SendmailTimeout}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + {{else if eq .Mailer.Protocol "dummy"}} + <dt>{{ctx.Locale.Tr "admin.config.mailer_use_dummy"}}</dt> + <dd>{{svg "octicon-check"}}</dd> + {{else}}{{/* SMTP family */}} + <dt>{{ctx.Locale.Tr "admin.config.mailer_protocol"}}</dt> + <dd>{{.Mailer.Protocol}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.mailer_enable_helo"}}</dt> + <dd>{{if .Mailer.EnableHelo}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.mailer_smtp_addr"}}</dt> + <dd>{{.Mailer.SMTPAddr}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.mailer_smtp_port"}}</dt> + <dd>{{.Mailer.SMTPPort}}</dd> + {{end}} + <dt>{{ctx.Locale.Tr "admin.config.mailer_user"}}</dt> + <dd>{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}</dd> + <div class="divider"></div> + <dt class="tw-py-1 tw-flex tw-items-center">{{ctx.Locale.Tr "admin.config.send_test_mail"}}</dt> + <dd class="tw-py-0"> + <form class="ui form ignore-dirty" action="{{AppSubUrl}}/admin/config/test_mail" method="post"> + {{.CsrfTokenHtml}} + <div class="ui tiny input"> + <input type="email" name="email" placeholder="{{ctx.Locale.Tr "admin.config.test_email_placeholder"}}" size="29" required> + </div> + <button class="ui tiny primary button">{{ctx.Locale.Tr "admin.config.send_test_mail_submit"}}</button> + </form> + </dd> + {{end}} + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.cache_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.cache_adapter"}}</dt> + <dd>{{.CacheAdapter}}</dd> + {{if eq .CacheAdapter "memory"}} + <dt>{{ctx.Locale.Tr "admin.config.cache_interval"}}</dt> + <dd>{{.CacheInterval}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + {{end}} + {{if .CacheConn}} + <dt>{{ctx.Locale.Tr "admin.config.cache_conn"}}</dt> + <dd><code>{{.CacheConn}}</code></dd> + <dt>{{ctx.Locale.Tr "admin.config.cache_item_ttl"}}</dt> + <dd><code>{{.CacheItemTTL}}</code></dd> + {{end}} + <div class="divider"></div> + <dt class="tw-py-1 tw-flex tw-items-center">{{ctx.Locale.Tr "admin.config.cache_test"}}</dt> + <dd class="tw-py-0"> + <form class="ui form ignore-dirty" action="{{AppSubUrl}}/admin/config/test_cache" method="post"> + {{.CsrfTokenHtml}} + <button class="ui tiny primary button">{{ctx.Locale.Tr "test"}}</button> + </form> + </dd> + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.session_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.session_provider"}}</dt> + <dd>{{.SessionConfig.Provider}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.provider_config"}}</dt> + <dd><code>{{if .SessionConfig.ProviderConfig}}{{.SessionConfig.ProviderConfig}}{{else}}-{{end}}</code></dd> + <dt>{{ctx.Locale.Tr "admin.config.cookie_name"}}</dt> + <dd>{{.SessionConfig.CookieName}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.gc_interval_time"}}</dt> + <dd>{{.SessionConfig.Gclifetime}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.session_life_time"}}</dt> + <dd>{{.SessionConfig.Maxlifetime}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.https_only"}}</dt> + <dd>{{if .SessionConfig.Secure}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.git_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.git_disable_diff_highlight"}}</dt> + <dd>{{if .Git.DisableDiffHighlight}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_max_diff_lines"}}</dt> + <dd>{{.Git.MaxGitDiffLines}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_max_diff_line_characters"}}</dt> + <dd>{{.Git.MaxGitDiffLineCharacters}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_max_diff_files"}}</dt> + <dd>{{.Git.MaxGitDiffFiles}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_gc_args"}}</dt> + <dd><code>{{.Git.GCArgs}}</code></dd> + + <div class="divider"></div> + + <dt>{{ctx.Locale.Tr "admin.config.git_migrate_timeout"}}</dt> + <dd>{{.Git.Timeout.Migrate}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_mirror_timeout"}}</dt> + <dd>{{.Git.Timeout.Mirror}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_clone_timeout"}}</dt> + <dd>{{.Git.Timeout.Clone}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_pull_timeout"}}</dt> + <dd>{{.Git.Timeout.Pull}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + <dt>{{ctx.Locale.Tr "admin.config.git_gc_timeout"}}</dt> + <dd>{{.Git.Timeout.GC}} {{ctx.Locale.Tr "tool.raw_seconds"}}</dd> + </dl> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.log_config"}} + </h4> + <div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + {{if .Loggers.xorm.IsEnabled}} + <dt>{{ctx.Locale.Tr "admin.config.xorm_log_sql"}}</dt> + <dd>{{if $.LogSQL}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</dd> + {{end}} + + {{if .Loggers.access.IsEnabled}} + <dt>{{ctx.Locale.Tr "admin.config.access_log_template"}}</dt> + <dd><code>{{$.AccessLogTemplate}}</code></dd> + {{end}} + + {{range $loggerName, $loggerDetail := .Loggers}} + <dt>{{ctx.Locale.Tr "admin.config.logger_name_fmt" $loggerName}}</dt> + {{if $loggerDetail.IsEnabled}} + <dd><pre class="tw-m-0">{{$loggerDetail.EventWriters | JsonUtils.EncodeToString | JsonUtils.PrettyIndent}}</pre></dd> + {{else}} + <dd>{{ctx.Locale.Tr "admin.config.disabled_logger"}}</dd> + {{end}} + {{end}} + </dl> + </div> + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/config_settings.tmpl b/templates/admin/config_settings.tmpl new file mode 100644 index 00000000..02ab5fd0 --- /dev/null +++ b/templates/admin/config_settings.tmpl @@ -0,0 +1,42 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}} +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.config.picture_config"}} +</h4> +<div class="ui attached table segment"> + <dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.config.disable_gravatar"}}</dt> + <dd> + <div class="ui toggle checkbox" data-tooltip-content="{{ctx.Locale.Tr "admin.config.disable_gravatar"}}"> + <input type="checkbox" data-config-dyn-key="picture.disable_gravatar" {{if .SystemConfig.Picture.DisableGravatar.Value ctx}}checked{{end}}><label></label> + </div> + </dd> + <div class="divider"></div> + <dt>{{ctx.Locale.Tr "admin.config.enable_federated_avatar"}}</dt> + <dd> + <div class="ui toggle checkbox" data-tooltip-content="{{ctx.Locale.Tr "admin.config.enable_federated_avatar"}}"> + <input type="checkbox" data-config-dyn-key="picture.enable_federated_avatar" {{if .SystemConfig.Picture.EnableFederatedAvatar.Value ctx}}checked{{end}}><label></label> + </div> + </dd> + </dl> +</div> + +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "repository"}} +</h4> +<div class="ui attached segment"> + <form class="ui form form-fetch-action" method="post" action="{{AppSubUrl}}/admin/config?key={{.SystemConfig.Repository.OpenWithEditorApps.DynKey}}"> + <div class="field"> + <details> + <summary>{{ctx.Locale.Tr "admin.config.open_with_editor_app_help"}}</summary> + <pre class="tw-px-4">{{.DefaultOpenWithEditorAppsString}}</pre> + </details> + </div> + <div class="field"> + <textarea name="value">{{(.SystemConfig.Repository.OpenWithEditorApps.Value ctx).ToTextareaString}}</textarea> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "save"}}</button> + </div> + </form> +</div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/cron.tmpl b/templates/admin/cron.tmpl new file mode 100644 index 00000000..3cb64148 --- /dev/null +++ b/templates/admin/cron.tmpl @@ -0,0 +1,39 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}} +<div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.monitor.cron"}} + </h4> + <div class="ui attached table segment"> + <form method="post" action="{{AppSubUrl}}/admin"> + <table class="ui very basic striped table unstackable tw-mb-0"> + <thead> + <tr> + <th></th> + <th>{{ctx.Locale.Tr "admin.monitor.name"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.schedule"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.next"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.previous"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.execute_times"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.last_execution_result"}}</th> + </tr> + </thead> + <tbody> + {{range .Entries}} + <tr> + <td><button type="submit" class="ui primary button" name="op" value="{{.Name}}" title="{{ctx.Locale.Tr "admin.dashboard.operation_run"}}">{{svg "octicon-triangle-right"}}</button></td> + <td>{{ctx.Locale.Tr (printf "admin.dashboard.%s" .Name)}}</td> + <td>{{.Spec}}</td> + <td>{{DateTime "full" .Next}}</td> + <td>{{if gt .Prev.Year 1}}{{DateTime "full" .Prev}}{{else}}-{{end}}</td> + <td>{{.ExecTimes}}</td> + <td {{if ne .Status ""}}data-tooltip-content="{{.FormatLastMessage ctx.Locale}}"{{end}} >{{if eq .Status ""}}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}}</td> + </tr> + {{end}} + </tbody> + </table> + <input type="hidden" name="from" value="monitor"> + {{.CsrfTokenHtml}} + </form> + </div> +</div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl new file mode 100644 index 00000000..9b89b833 --- /dev/null +++ b/templates/admin/dashboard.tmpl @@ -0,0 +1,84 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin dashboard")}} + <div class="admin-setting-content"> + {{if .NeedUpdate}} + <div class="ui negative message flash-error"> + <p>{{ctx.Locale.Tr "admin.dashboard.new_version_hint" .RemoteVersion AppVer}}</p> + </div> + {{end}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.dashboard.operations"}} + </h4> + <div class="ui attached table segment"> + <form method="post" action="{{AppSubUrl}}/admin"> + {{.CsrfTokenHtml}} + <table class="ui very basic table tw-mt-0 tw-px-4"> + <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> + </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> + </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> + </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> + </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> + </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> + </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> + </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> + </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> + </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> + </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> + </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> + </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> + </tr> + </tbody> + </table> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.dashboard.system_status"}} + </h4> + {{/* TODO: make these stats work in multi-server deployments, likely needs per-server stats in DB */}} + <div class="no-loading-indicator tw-hidden"></div> + <div hx-get="{{$.Link}}/system_status" hx-swap="morph:innerHTML" hx-trigger="every 5s" hx-indicator=".no-loading-indicator" class="ui attached table segment"> + {{template "admin/system_status" .}} + </div> + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl new file mode 100644 index 00000000..388863df --- /dev/null +++ b/templates/admin/emails/list.tmpl @@ -0,0 +1,98 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.emails.email_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + </h4> + <div class="ui attached segment"> + <div class="ui secondary filter menu tw-items-center tw-mx-0"> + <form class="ui form ignore-dirty tw-flex-1"> + {{template "shared/search/combo" dict "Value" .Keyword}} + </form> + <!-- Sort --> + <div class="ui dropdown type jump item tw-mr-0"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "email") (not .SortType)}}active {{end}}item" href="?sort=email&q={{$.Keyword}}">{{ctx.Locale.Tr "admin.emails.filter_sort.email"}}</a> + <a class="{{if eq .SortType "reverseemail"}}active {{end}}item" href="?sort=reverseemail&q={{$.Keyword}}">{{ctx.Locale.Tr "admin.emails.filter_sort.email_reverse"}}</a> + <a class="{{if eq .SortType "username"}}active {{end}}item" href="?sort=username&q={{$.Keyword}}">{{ctx.Locale.Tr "admin.emails.filter_sort.name"}}</a> + <a class="{{if eq .SortType "reverseusername"}}active {{end}}item" href="?sort=reverseusername&q={{$.Keyword}}">{{ctx.Locale.Tr "admin.emails.filter_sort.name_reverse"}}</a> + </div> + </div> + </div> + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th data-sortt-asc="username" data-sortt-desc="reverseusername"> + {{ctx.Locale.Tr "admin.users.name"}} + {{SortArrow "username" "reverseusername" $.SortType false}} + </th> + <th>{{ctx.Locale.Tr "admin.users.full_name"}}</th> + <th data-sortt-asc="email" data-sortt-desc="reverseemail" data-sortt-default="true"> + {{ctx.Locale.Tr "email"}} + {{SortArrow "email" "reverseemail" $.SortType true}} + </th> + <th>{{ctx.Locale.Tr "admin.emails.primary"}}</th> + <th>{{ctx.Locale.Tr "admin.emails.activated"}}</th> + </tr> + </thead> + <tbody> + {{range .Emails}} + <tr> + <td><a href="{{AppSubUrl}}/{{.Name | PathEscape}}">{{.Name}}</a></td> + <td class="gt-ellipsis tw-max-w-48">{{.FullName}}</td> + <td class="gt-ellipsis tw-max-w-48">{{.Email}}</td> + <td>{{if .IsPrimary}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td> + {{if .CanChange}} + <a class="link-email-action" href data-uid="{{.UID}}" + data-email="{{.Email}}" + data-primary="{{if .IsPrimary}}1{{else}}0{{end}}" + data-activate="{{if .IsActivated}}0{{else}}1{{end}}"> + {{if .IsActivated}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} + </a> + {{else}} + {{if .IsActivated}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}} + {{end}} + </td> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{template "base/paginate" .}} + + <div class="ui g-modal-confirm modal" id="change-email-modal"> + <div class="header"> + {{ctx.Locale.Tr "admin.emails.change_email_header"}} + </div> + <div class="content"> + <p class="center">{{ctx.Locale.Tr "admin.emails.change_email_text"}}</p> + + <form class="ui form" id="email-action-form" action="{{AppSubUrl}}/admin/emails/activate" method="post"> + {{$.CsrfTokenHtml}} + + <input type="hidden" id="query-sort" name="sort" value="{{.SortType}}"> + <input type="hidden" id="query-keyword" name="q" value="{{.Keyword}}"> + <input type="hidden" id="query-primary" name="is_primary" value="{{.IsPrimary}}" required> + <input type="hidden" id="query-activated" name="is_activated" value="{{.IsActivated}}" required> + + <input type="hidden" id="form-uid" name="uid" value="" required> + <input type="hidden" id="form-email" name="email" value="" required> + <input type="hidden" id="form-primary" name="primary" value="" required> + <input type="hidden" id="form-activate" name="activate" value="" required> + + <div class="center"> + {{template "base/modal_actions_confirm" .}} + </div> + </form> + </div> + </div> + + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/hook_new.tmpl b/templates/admin/hook_new.tmpl new file mode 100644 index 00000000..37dcc49d --- /dev/null +++ b/templates/admin/hook_new.tmpl @@ -0,0 +1,13 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin settings new webhook")}} + <div class="admin-setting-content"> + {{$CustomHeaderTitle := ctx.Locale.Tr "admin.defaulthooks.update_webhook"}} + {{if .PageIsAdminDefaultHooksNew}} + {{$CustomHeaderTitle = ctx.Locale.Tr "admin.defaulthooks.add_webhook"}} + {{else if .PageIsAdminSystemHooksNew}} + {{$CustomHeaderTitle = ctx.Locale.Tr "admin.systemhooks.add_webhook"}} + {{else if .Webhook.IsSystemWebhook}} + {{$CustomHeaderTitle = ctx.Locale.Tr "admin.systemhooks.update_webhook"}} + {{end}} + {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/hooks.tmpl b/templates/admin/hooks.tmpl new file mode 100644 index 00000000..c77d27db --- /dev/null +++ b/templates/admin/hooks.tmpl @@ -0,0 +1,9 @@ +{{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/layout_footer.tmpl b/templates/admin/layout_footer.tmpl new file mode 100644 index 00000000..8d6e564d --- /dev/null +++ b/templates/admin/layout_footer.tmpl @@ -0,0 +1,11 @@ +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} +<div class="page-content"> + <div class="admin-layout-right"> + <div> + {{/* block: admin-setting-content */}} +{{end}} + + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/admin/layout_head.tmpl b/templates/admin/layout_head.tmpl new file mode 100644 index 00000000..8ba47f2f --- /dev/null +++ b/templates/admin/layout_head.tmpl @@ -0,0 +1,13 @@ +{{template "base/head" .ctxData}} +<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}"> + <div class="ui container flex-container"> + {{template "admin/navbar" .ctxData}} + <div class="flex-container-main"> + {{template "base/alert" .ctxData}} + {{/* block: admin-setting-content */}} + +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} + </div> + </div> +</div> +{{end}} diff --git a/templates/admin/navbar.tmpl b/templates/admin/navbar.tmpl new file mode 100644 index 00000000..1ec703b2 --- /dev/null +++ b/templates/admin/navbar.tmpl @@ -0,0 +1,112 @@ +<div class="flex-container-nav"> + <div class="ui fluid vertical menu"> + <div class="header item">{{ctx.Locale.Tr "admin.settings"}}</div> + <a class="{{if .PageIsAdminDashboard}}active {{end}}item" href="{{AppSubUrl}}/admin"> + {{ctx.Locale.Tr "admin.dashboard"}} + </a> + {{if .DatabaseType.IsMySQL}} + <a class="{{if .PageIsAdminSelfCheck}}active {{end}}item" href="{{AppSubUrl}}/admin/self_check"> + {{ctx.Locale.Tr "admin.self_check"}} + </a> + {{end}} + <details class="item toggleable-item" {{if or .PageIsAdminUsers .PageIsAdminEmails .PageIsAdminOrganizations .PageIsAdminAuthentications}}open{{end}}> + <summary>{{ctx.Locale.Tr "admin.identity_access"}}</summary> + <div class="menu"> + <a class="{{if .PageIsAdminAuthentications}}active {{end}}item" href="{{AppSubUrl}}/admin/auths"> + {{ctx.Locale.Tr "admin.authentication"}} + </a> + <a class="{{if .PageIsAdminOrganizations}}active {{end}}item" href="{{AppSubUrl}}/admin/orgs"> + {{ctx.Locale.Tr "admin.organizations"}} + </a> + <a class="{{if .PageIsAdminUsers}}active {{end}}item" href="{{AppSubUrl}}/admin/users"> + {{ctx.Locale.Tr "admin.users"}} + </a> + <a class="{{if .PageIsAdminEmails}}active {{end}}item" href="{{AppSubUrl}}/admin/emails"> + {{ctx.Locale.Tr "admin.emails"}} + </a> + </div> + </details> + <details class="item toggleable-item" {{if or .PageIsAdminRepositories (and .EnablePackages .PageIsAdminPackages)}}open{{end}}> + <summary>{{ctx.Locale.Tr "admin.assets"}}</summary> + <div class="menu"> + {{if .EnablePackages}} + <a class="{{if .PageIsAdminPackages}}active {{end}}item" href="{{AppSubUrl}}/admin/packages"> + {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} + <a class="{{if .PageIsAdminRepositories}}active {{end}}item" href="{{AppSubUrl}}/admin/repos"> + {{ctx.Locale.Tr "admin.repositories"}} + </a> + </div> + </details> + <!-- Webhooks and OAuth can be both disabled here, so add this if statement to display different ui --> + {{if and (not DisableWebhooks) .EnableOAuth2}} + <details class="item toggleable-item" {{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks .PageIsAdminApplications}}open{{end}}> + <summary>{{ctx.Locale.Tr "admin.integrations"}}</summary> + <div class="menu"> + <a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/admin/applications"> + {{ctx.Locale.Tr "settings.applications"}} + </a> + <a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/admin/hooks"> + {{ctx.Locale.Tr "admin.hooks"}} + </a> + </div> + </details> + {{else}} + {{if not DisableWebhooks}} + <a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/admin/hooks"> + {{ctx.Locale.Tr "admin.hooks"}} + </a> + {{end}} + {{if .EnableOAuth2}} + <a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/admin/applications"> + {{ctx.Locale.Tr "settings.applications"}} + </a> + {{end}} + {{end}} + {{if .EnableActions}} + <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsVariables}}open{{end}}> + <summary>{{ctx.Locale.Tr "actions.actions"}}</summary> + <div class="menu"> + <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{AppSubUrl}}/admin/actions/runners"> + {{ctx.Locale.Tr "actions.runners"}} + </a> + <a class="{{if .PageIsSharedSettingsVariables}}active {{end}}item" href="{{AppSubUrl}}/admin/actions/variables"> + {{ctx.Locale.Tr "actions.variables"}} + </a> + </div> + </details> + {{end}} + <details class="item toggleable-item" {{if or .PageIsAdminConfig}}open{{end}}> + <summary>{{ctx.Locale.Tr "admin.config"}}</summary> + <div class="menu"> + <a class="{{if .PageIsAdminConfigSummary}}active {{end}}item" href="{{AppSubUrl}}/admin/config"> + {{ctx.Locale.Tr "admin.config_summary"}} + </a> + <a class="{{if .PageIsAdminConfigSettings}}active {{end}}item" href="{{AppSubUrl}}/admin/config/settings"> + {{ctx.Locale.Tr "admin.config_settings"}} + </a> + </div> + </details> + <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}}> + <summary>{{ctx.Locale.Tr "admin.monitor"}}</summary> + <div class="menu"> + <a class="{{if .PageIsAdminMonitorStats}}active {{end}}item" href="{{AppSubUrl}}/admin/monitor/stats"> + {{ctx.Locale.Tr "admin.monitor.stats"}} + </a> + <a class="{{if .PageIsAdminMonitorCron}}active {{end}}item" href="{{AppSubUrl}}/admin/monitor/cron"> + {{ctx.Locale.Tr "admin.monitor.cron"}} + </a> + <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> + </div> + </details> + </div> +</div> diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl new file mode 100644 index 00000000..33d8a2f9 --- /dev/null +++ b/templates/admin/notice.tmpl @@ -0,0 +1,68 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin notice")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.notices.system_notice_list"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + </h4> + <table class="ui attached segment select selectable striped table unstackable g-table-auto-ellipsis"> + <thead> + <tr> + <th></th> + <th>ID</th> + <th>{{ctx.Locale.Tr "admin.notices.type"}}</th> + <th>{{ctx.Locale.Tr "admin.notices.desc"}}</th> + <th>{{ctx.Locale.Tr "admin.users.created"}}</th> + <th>{{ctx.Locale.Tr "admin.notices.op"}}</th> + </tr> + </thead> + <tbody> + {{range .Notices}} + <tr> + <td><div class="ui checkbox tw-flex" data-id="{{.ID}}"><input type="checkbox"></div></td> + <td>{{.ID}}</td> + <td>{{ctx.Locale.Tr .TrStr}}</td> + <td class="view-detail auto-ellipsis tw-w-4/5"><span class="notice-description">{{.Description}}</span></td> + <td nowrap>{{DateTime "short" .CreatedUnix}}</td> + <td class="view-detail"><a href="#">{{svg "octicon-note" 16}}</a></td> + </tr> + {{end}} + </tbody> + {{if .Notices}} + <tfoot> + <tr> + <th></th> + <th colspan="5"> + <form class="tw-float-right" method="post" action="{{AppSubUrl}}/admin/notices/empty"> + {{.CsrfTokenHtml}} + <button type="submit" class="ui red small button">{{ctx.Locale.Tr "admin.notices.delete_all"}}</button> + </form> + <div class="ui floating upward dropdown small button">{{/* TODO: Make this dropdown accessible */}} + <span class="text">{{ctx.Locale.Tr "admin.notices.operations"}}</span> + <div class="menu"> + <div class="item select action" data-action="select-all"> + {{ctx.Locale.Tr "admin.notices.select_all"}} + </div> + <div class="item select action" data-action="deselect-all"> + {{ctx.Locale.Tr "admin.notices.deselect_all"}} + </div> + <div class="item select action" data-action="inverse"> + {{ctx.Locale.Tr "admin.notices.inverse_selection"}} + </div> + </div> + </div> + <button class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="?page={{.Page.Paginater.Current}}"> + <span class="text">{{ctx.Locale.Tr "admin.notices.delete_selected"}}</span> + </button> + </th> + </tr> + </tfoot> + {{end}} + </table> + {{template "base/paginate" .}} + </div> + +<div class="ui modal admin" id="detail-modal"> + <div class="header">{{ctx.Locale.Tr "admin.notices.view_detail_header"}}</div> + <div class="content"><pre></pre></div> +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl new file mode 100644 index 00000000..987ceab1 --- /dev/null +++ b/templates/admin/org/list.tmpl @@ -0,0 +1,76 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.orgs.org_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/org/create">{{ctx.Locale.Tr "admin.orgs.new_orga"}}</a> + </div> + </h4> + <div class="ui attached segment"> + <div class="ui secondary filter menu tw-items-center tw-mx-0"> + <form class="ui form ignore-dirty tw-flex-1"> + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.org_kind")}} + </form> + <!-- Sort --> + <div class="ui dropdown type jump item tw-mr-0"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "oldest") (not .SortType)}}active {{end}}item" href="?sort=oldest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "newest"}}active {{end}}item" href="?sort=newest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="?sort=alphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?sort=reversealphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> + <a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?sort=recentupdate&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> + <a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?sort=leastupdate&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> + </div> + </div> + </div> + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th data-sortt-asc="oldest" data-sortt-desc="newest">ID{{SortArrow "oldest" "newest" $.SortType false}}</th> + <th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically" data-sortt-default="true"> + {{ctx.Locale.Tr "admin.orgs.name"}} + {{SortArrow "alphabetically" "reversealphabetically" $.SortType true}} + </th> + <th>{{ctx.Locale.Tr "admin.orgs.teams"}}</th> + <th>{{ctx.Locale.Tr "admin.orgs.members"}}</th> + <th>{{ctx.Locale.Tr "admin.users.repos"}}</th> + <th data-sortt-asc="recentupdate" data-sortt-desc="leastupdate"> + {{ctx.Locale.Tr "admin.users.created"}} + {{SortArrow "recentupdate" "leastupdate" $.SortType false}} + </th> + <th></th> + </tr> + </thead> + <tbody> + {{range .Users}} + <tr> + <td>{{.ID}}</td> + <td> + <a href="{{.HomeLink}}">{{.Name}}</a> + {{if .Visibility.IsPrivate}} + <span class="text gold">{{svg "octicon-lock"}}</span> + {{end}} + {{if eq .Type 3}}{{/* Reserved organization */}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.reserved"}}</span> + {{end}} + </td> + <td>{{.NumTeams}}</td> + <td>{{.NumMembers}}</td> + <td>{{.NumRepos}}</td> + <td>{{DateTime "short" .CreatedUnix}}</td> + <td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{template "base/paginate" .}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl new file mode 100644 index 00000000..4ff49b8c --- /dev/null +++ b/templates/admin/packages/list.tmpl @@ -0,0 +1,96 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.packages.package_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .TotalCount}}, + {{ctx.Locale.Tr "admin.packages.total_size" (ctx.Locale.TrSize .TotalBlobSize)}}, + {{ctx.Locale.Tr "admin.packages.unreferenced_size" (ctx.Locale.TrSize .TotalUnreferencedBlobSize)}}) + <div class="ui right"> + <form method="post" action="{{AppSubUrl}}/admin/packages/cleanup"> + {{.CsrfTokenHtml}} + <button class="ui primary tiny button">{{ctx.Locale.Tr "admin.packages.cleanup"}}</button> + </form> + </div> + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty"> + <div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Query}} + <select class="ui small dropdown" name="type"> + <option value="">{{ctx.Locale.Tr "packages.filter.type"}}</option> + <option value="all">{{ctx.Locale.Tr "packages.filter.type.all"}}</option> + {{range $type := .AvailableTypes}} + <option{{if eq $.PackageType $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option> + {{end}} + </select> + {{template "shared/search/button"}} + </div> + </form> + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>ID</th> + <th>{{ctx.Locale.Tr "admin.packages.owner"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.type"}}</th> + <th data-sortt-asc="name_asc" data-sortt-desc="name_desc"> + {{ctx.Locale.Tr "admin.packages.name"}} + {{SortArrow "name_asc" "name_desc" .SortType false}} + </th> + <th data-sortt-asc="version_desc" data-sortt-desc="version_asc"> + {{ctx.Locale.Tr "admin.packages.version"}} + {{SortArrow "version_desc" "version_asc" .SortType false}} + </th> + <th>{{ctx.Locale.Tr "admin.packages.creator"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.repository"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.size"}}</th> + <th data-sortt-asc="created_asc" data-sortt-desc="created_desc"> + {{ctx.Locale.Tr "admin.packages.published"}} + {{SortArrow "created_asc" "created_desc" .SortType true}} + </th> + <th>{{ctx.Locale.Tr "admin.notices.op"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptors}} + <tr> + <td>{{.Version.ID}}</td> + <td> + <a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> + {{if .Owner.Visibility.IsPrivate}} + <span class="text gold">{{svg "octicon-lock"}}</span> + {{end}} + </td> + <td>{{.Package.Type.Name}}</td> + <td class="gt-ellipsis tw-max-w-48">{{.Package.Name}}</td> + <td class="gt-ellipsis tw-max-w-48"><a href="{{.VersionWebLink}}">{{.Version.Version}}</a></td> + <td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td> + <td> + {{if .Repository}} + <a href="{{.Repository.Link}}">{{.Repository.Name}}</a> + {{end}} + </td> + <td>{{ctx.Locale.TrSize .CalculateBlobSize}}</td> + <td>{{DateTime "short" .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> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{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> + <div class="content"> + {{ctx.Locale.Tr "packages.settings.delete.notice" (`<span class="name"></span>`|SafeHTML) (`<span class="dataVersion"></span>`|SafeHTML)}} + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/queue.tmpl b/templates/admin/queue.tmpl new file mode 100644 index 00000000..1be35cf7 --- /dev/null +++ b/templates/admin/queue.tmpl @@ -0,0 +1,36 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}} +<div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.monitor.queues"}} + </h4> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "admin.monitor.queue.name"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.type"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.exemplar"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.numberworkers"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.activeworkers"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.numberinqueue"}}</th> + <th></th> + </tr> + </thead> + <tbody> + {{range $qid, $q := .Queues}} + <tr> + <td>{{$q.GetName}}</td> + <td>{{$q.GetType}}</td> + <td>{{$q.GetItemTypeName}}</td> + <td>{{$q.GetWorkerNumber}}</td> + <td>{{$q.GetWorkerActiveNumber}}</td> + <td>{{$sum := $q.GetQueueItemNumber}}{{if lt $sum 0}}-{{else}}{{$sum}}{{end}}</td> + <td><a href="{{$.Link}}/{{$qid}}" class="button">{{ctx.Locale.Tr "admin.monitor.queue.review_add"}}</a></td> + </tr> + {{end}} + </tbody> + </table> + </div> +</div> +{{template "admin/layout_footer" .}} + diff --git a/templates/admin/queue_manage.tmpl b/templates/admin/queue_manage.tmpl new file mode 100644 index 00000000..dc0196fc --- /dev/null +++ b/templates/admin/queue_manage.tmpl @@ -0,0 +1,61 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.monitor.queue" .Queue.GetName}} + </h4> + <div class="ui attached table segment"> + <table class="ui very basic striped table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "admin.monitor.queue.name"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.type"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.exemplar"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.numberworkers"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.activeworkers"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.maxnumberworkers"}}</th> + <th>{{ctx.Locale.Tr "admin.monitor.queue.numberinqueue"}}</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{.Queue.GetName}}</td> + <td>{{.Queue.GetType}}</td> + <td>{{.Queue.GetItemTypeName}}</td> + <td>{{.Queue.GetWorkerNumber}}</td> + <td>{{.Queue.GetWorkerActiveNumber}}</td> + <td>{{.Queue.GetWorkerMaxNumber}}</td> + <td> + {{$sum := .Queue.GetQueueItemNumber}} + {{if lt $sum 0}} + - + {{else}} + {{$sum}} + <form action="{{$.Link}}/remove-all-items" method="post" class="tw-inline-block tw-ml-4"> + {{$.CsrfTokenHtml}} + <button class="ui tiny basic red button">{{ctx.Locale.Tr "admin.monitor.queue.settings.remove_all_items"}}</button> + </form> + {{end}} + </td> + </tr> + </tbody> + </table> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.monitor.queue.settings.title"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "admin.monitor.queue.settings.desc"}}</p> + <form method="post" action="{{.Link}}/set"> + {{$.CsrfTokenHtml}} + <div class="ui form"> + <div class="inline field"> + <label for="max-number">{{ctx.Locale.Tr "admin.monitor.queue.settings.maxnumberworkers"}}</label> + <input name="max-number" type="text" placeholder="{{ctx.Locale.Tr "admin.monitor.queue.settings.maxnumberworkers.placeholder" .Queue.GetWorkerMaxNumber}}"> + </div> + <button class="ui submit button">{{ctx.Locale.Tr "admin.monitor.queue.settings.submit"}}</button> + </div> + </form> + </div> + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl new file mode 100644 index 00000000..1ea6183d --- /dev/null +++ b/templates/admin/repo/list.tmpl @@ -0,0 +1,110 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.repos.repo_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/admin/repos/unadopted">{{ctx.Locale.Tr "admin.repos.unadopted"}}</a> + </div> + </h4> + <div class="ui attached segment"> + {{template "shared/repo_search" .}} + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th data-sortt-asc="oldest" data-sortt-desc="newest">ID{{SortArrow "oldest" "newest" $.SortType false}}</th> + <th>{{ctx.Locale.Tr "admin.repos.owner"}}</th> + <th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically"> + {{ctx.Locale.Tr "admin.repos.name"}} + {{SortArrow "alphabetically" "reversealphabetically" $.SortType false}} + </th> + <th>{{ctx.Locale.Tr "repo.watchers"}}</th> + <th data-sortt-asc="moststars" data-sortt-desc="feweststars"> + {{ctx.Locale.Tr "repo.stars"}} + {{SortArrow "moststars" "feweststars" $.SortType false}} + </th> + <th data-sortt-asc="mostforks" data-sortt-desc="fewestforks"> + {{ctx.Locale.Tr "repo.forks"}} + {{SortArrow "mostforks" "fewestforks" $.SortType false}} + </th> + <th>{{ctx.Locale.Tr "admin.repos.issues"}}</th> + <th data-sortt-asc="gitsize" data-sortt-desc="reversegitsize"> + {{ctx.Locale.Tr "admin.repos.size"}} + {{SortArrow "gitsize" "reversegitsize" $.SortType false}} + </th> + <th data-sortt-asc="lfssize" data-sortt-desc="reverselfssize"> + {{ctx.Locale.Tr "admin.repos.lfs_size"}} + {{SortArrow "lfssize" "reverselfssize" $.SortType false}} + </th> + <th>{{ctx.Locale.Tr "admin.auths.updated"}}</th> + <th>{{ctx.Locale.Tr "admin.users.created"}}</th> + <th>{{ctx.Locale.Tr "admin.notices.op"}}</th> + </tr> + </thead> + <tbody> + {{range .Repos}} + <tr> + <td>{{.ID}}</td> + <td> + <a class="tw-break-anywhere" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> + {{if .Owner.Visibility.IsPrivate}} + <span class="text gold">{{svg "octicon-lock"}}</span> + {{end}} + </td> + <td> + <a class="tw-break-anywhere" href="{{.Link}}">{{.Name}}</a> + {{if .IsArchived}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span> + {{end}} + {{if .IsPrivate}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.private"}}</span> + {{else}} + {{if .Owner.Visibility.IsPrivate}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.internal"}}</span> + {{end}} + {{end}} + {{if .IsTemplate}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.template"}}</span> + {{end}} + {{if eq .ObjectFormatName "sha256"}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span> + {{end}} + {{if .IsMirror}} + {{svg "octicon-mirror"}} + {{else if .IsFork}} + {{svg "octicon-repo-forked"}} + {{end}} + </td> + <td>{{.NumWatches}}</td> + <td>{{.NumStars}}</td> + <td>{{.NumForks}}</td> + <td>{{.NumIssues}}</td> + <td>{{ctx.Locale.TrSize .GitSize}}</td> + <td>{{ctx.Locale.TrSize .LFSSize}}</td> + <td>{{DateTime "short" .UpdatedUnix}}</td> + <td>{{DateTime "short" .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> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{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> + <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_fork_1"}}<br> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/repo/unadopted.tmpl b/templates/admin/repo/unadopted.tmpl new file mode 100644 index 00000000..a33cb43a --- /dev/null +++ b/templates/admin/repo/unadopted.tmpl @@ -0,0 +1,75 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.repos.unadopted"}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/admin/repos">{{ctx.Locale.Tr "admin.repos.repo_manage_panel"}}</a> + </div> + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty"> + <div class="ui small fluid action input"> + <input name="search" value="true" type="hidden"> + <input name="q" value="{{.Keyword}}" placeholder="{{ctx.Locale.Tr "repo.adopt_search"}}" autofocus> + {{template "shared/search/button"}} + </div> + </form> + </div> + {{if .search}} + <div class="ui attached segment settings"> + {{if .Dirs}} + <div class="ui aligned divided list"> + {{range $dirI, $dir := .Dirs}} + <div class="item tw-flex tw-items-center"> + <span class="tw-flex-1"> {{svg "octicon-file-directory-fill"}} {{$dir}}</span> + <div> + <button class="ui button primary show-modal tw-p-2" data-modal="#adopt-unadopted-modal-{{$dirI}}">{{svg "octicon-plus"}} {{ctx.Locale.Tr "repo.adopt_preexisting_label"}}</button> + <div class="ui g-modal-confirm modal" id="adopt-unadopted-modal-{{$dirI}}"> + <div class="header"> + <span class="label">{{ctx.Locale.Tr "repo.adopt_preexisting"}}</span> + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.adopt_preexisting_content" $dir}}</p> + </div> + <form class="ui form" method="post" action="{{AppSubUrl}}/admin/repos/unadopted"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{$dir}}"> + <input type="hidden" name="action" value="adopt"> + <input type="hidden" name="q" value="{{$.Keyword}}"> + <input type="hidden" name="page" value="{{$.CurrentPage}}"> + {{template "base/modal_actions_confirm"}} + </form> + </div> + <button class="ui button red show-modal tw-p-2" data-modal="#delete-unadopted-modal-{{$dirI}}">{{svg "octicon-x"}} {{ctx.Locale.Tr "repo.delete_preexisting_label"}}</button> + <div class="ui g-modal-confirm modal" id="delete-unadopted-modal-{{$dirI}}"> + <div class="header"> + <span class="label">{{ctx.Locale.Tr "repo.delete_preexisting"}}</span> + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.delete_preexisting_content" $dir}}</p> + </div> + <form class="ui form" method="post" action="{{AppSubUrl}}/admin/repos/unadopted"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{$dir}}"> + <input type="hidden" name="action" value="delete"> + <input type="hidden" name="q" value="{{$.Keyword}}"> + <input type="hidden" name="page" value="{{$.CurrentPage}}"> + {{template "base/modal_actions_confirm" (dict "ModalButtonColors" "primary")}} + </form> + </div> + </div> + </div> + {{end}} + </div> + {{template "base/paginate" .}} + {{else}} + <div class="item"> + {{ctx.Locale.Tr "admin.repos.unadopted.no_more"}} + </div> + {{template "base/paginate" .}} + {{end}} + </div> + {{end}} + </div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/runners/edit.tmpl b/templates/admin/runners/edit.tmpl new file mode 100644 index 00000000..1165c84b --- /dev/null +++ b/templates/admin/runners/edit.tmpl @@ -0,0 +1,5 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin runners")}} + <div class="admin-setting-content"> + {{template "shared/actions/runner_edit" .}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/self_check.tmpl b/templates/admin/self_check.tmpl new file mode 100644 index 00000000..afcd4cd6 --- /dev/null +++ b/templates/admin/self_check.tmpl @@ -0,0 +1,41 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}} + +<div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.self_check"}} + </h4> + <div class="ui attached segment"> + {{if .DatabaseCheckHasProblems}} + {{if .DatabaseType.IsMySQL}} + <div class="tw-p-2">{{ctx.Locale.Tr "admin.self_check.database_fix_mysql"}}</div> + {{end}} + {{if .DatabaseCheckCollationMismatch}} + <div class="ui red message">{{ctx.Locale.Tr "admin.self_check.database_collation_mismatch" .DatabaseCheckResult.ExpectedCollation}}</div> + {{end}} + {{if .DatabaseCheckCollationCaseInsensitive}} + <div class="ui warning message">{{ctx.Locale.Tr "admin.self_check.database_collation_case_insensitive" .DatabaseCheckResult.DatabaseCollation}}</div> + {{end}} + {{if .DatabaseCheckInconsistentCollationColumns}} + <div class="ui red message"> + {{ctx.Locale.Tr "admin.self_check.database_inconsistent_collation_columns" .DatabaseCheckResult.DatabaseCollation}} + <ul class="tw-w-full"> + {{range .DatabaseCheckInconsistentCollationColumns}} + <li>{{.}}</li> + {{end}} + </ul> + </div> + {{end}} + {{else}} + <div class="tw-p-2">{{ctx.Locale.Tr "admin.self_check.no_problem_found"}}</div> + {{end}} + + {{if .CacheError}} + <div class="ui red message">{{ctx.Locale.Tr "admin.config.cache_test_failed" .CacheError}}</div> + {{end}} + {{if .CacheSlow}} + <div class="ui warning message">{{ctx.Locale.Tr "admin.config.cache_test_slow" .CacheSlow}}</div> + {{end}} + </div> +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/stacktrace-row.tmpl b/templates/admin/stacktrace-row.tmpl new file mode 100644 index 00000000..694bf56d --- /dev/null +++ b/templates/admin/stacktrace-row.tmpl @@ -0,0 +1,66 @@ +<div class="item"> + <div class="tw-flex tw-items-center"> + <div class="icon tw-ml-2 tw-mr-2"> + {{if eq .Process.Type "request"}} + {{svg "octicon-globe" 16}} + {{else if eq .Process.Type "system"}} + {{svg "octicon-cpu" 16}} + {{else if eq .Process.Type "normal"}} + {{svg "octicon-terminal" 16}} + {{else}} + {{svg "octicon-code" 16}} + {{end}} + </div> + <div class="content tw-flex-1"> + <div class="header">{{.Process.Description}}</div> + <div class="description">{{if ne .Process.Type "none"}}{{TimeSince .Process.Start ctx.Locale}}{{end}}</div> + </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> + {{end}} + </div> + </div> + {{if .Process.Stacks}} + <div class="divided list tw-ml-2"> + {{range .Process.Stacks}} + <div class="item"> + <details> + <summary> + <div class="flex-text-inline"> + <div class="header tw-ml-2"> + <span class="icon tw-mr-2">{{svg "octicon-code" 16}}</span>{{.Description}}{{if gt .Count 1}} * {{.Count}}{{end}} + </div> + <div class="description"> + {{range .Labels}} + <div class="ui label">{{.Name}}<div class="detail">{{.Value}}</div></div> + {{end}} + </div> + </div> + </summary> + <div class="list"> + {{range .Entry}} + <div class="item tw-flex tw-items-center"> + <span class="icon tw-mr-4">{{svg "octicon-dot-fill" 16}}</span> + <div class="content tw-flex-1"> + <div class="header"><code>{{.Function}}</code></div> + <div class="description"><code>{{.File}}:{{.Line}}</code></div> + </div> + </div> + {{end}} + </div> + </details> + </div> + {{end}} + </div> + {{end}} + + {{if .Process.Children}} + <div class="divided list"> + {{range .Process.Children}} + {{template "admin/stacktrace-row" dict "Process" . "root" $.root}} + {{end}} + </div> + {{end}} + +</div> diff --git a/templates/admin/stacktrace.tmpl b/templates/admin/stacktrace.tmpl new file mode 100644 index 00000000..e324570c --- /dev/null +++ b/templates/admin/stacktrace.tmpl @@ -0,0 +1,48 @@ +{{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> + + <h4 class="ui top attached header"> + {{printf "%d Goroutines" .GoroutineCount}}{{/* Goroutine is non-translatable*/}} + {{- if .ProcessCount -}}, {{ctx.Locale.Tr "admin.monitor.processes_count" .ProcessCount}}{{- end -}} + </h4> + + {{if .ProcessStacks}} + <div class="ui attached segment"> + <div class="ui relaxed divided list"> + {{range .ProcessStacks}} + {{template "admin/stacktrace-row" dict "Process" . "root" $}} + {{end}} + </div> + </div> + {{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/stats.tmpl b/templates/admin/stats.tmpl new file mode 100644 index 00000000..70f2aa7f --- /dev/null +++ b/templates/admin/stats.tmpl @@ -0,0 +1,17 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}} +<div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.dashboard.statistic"}} + </h4> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + {{range $statsKey, $statsValue := .Stats}} + <tr> + <td width="200">{{$statsKey}}</td> + <td>{{$statsValue}}</td> + </tr> + {{end}} + </table> + </div> +</div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/system_status.tmpl b/templates/admin/system_status.tmpl new file mode 100644 index 00000000..7b5c9be6 --- /dev/null +++ b/templates/admin/system_status.tmpl @@ -0,0 +1,62 @@ +<dl class="admin-dl-horizontal"> + <dt>{{ctx.Locale.Tr "admin.dashboard.server_uptime"}}</dt> + <dd><relative-time format="duration" datetime="{{.SysStatus.StartTime}}">{{.SysStatus.StartTime}}</relative-time></dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.current_goroutine"}}</dt> + <dd>{{.SysStatus.NumGoroutine}}</dd> + <div class="divider"></div> + <dt>{{ctx.Locale.Tr "admin.dashboard.current_memory_usage"}}</dt> + <dd>{{.SysStatus.MemAllocated}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.total_memory_allocated"}}</dt> + <dd>{{.SysStatus.MemTotal}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.memory_obtained"}}</dt> + <dd>{{.SysStatus.MemSys}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.pointer_lookup_times"}}</dt> + <dd>{{.SysStatus.Lookups}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.memory_allocate_times"}}</dt> + <dd>{{.SysStatus.MemMallocs}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.memory_free_times"}}</dt> + <dd>{{.SysStatus.MemFrees}}</dd> + <div class="divider"></div> + <dt>{{ctx.Locale.Tr "admin.dashboard.current_heap_usage"}}</dt> + <dd>{{.SysStatus.HeapAlloc}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_obtained"}}</dt> + <dd>{{.SysStatus.HeapSys}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_idle"}}</dt> + <dd>{{.SysStatus.HeapIdle}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_in_use"}}</dt> + <dd>{{.SysStatus.HeapInuse}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_released"}}</dt> + <dd>{{.SysStatus.HeapReleased}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.heap_objects"}}</dt> + <dd>{{.SysStatus.HeapObjects}}</dd> + <div class="divider"></div> + <dt>{{ctx.Locale.Tr "admin.dashboard.bootstrap_stack_usage"}}</dt> + <dd>{{.SysStatus.StackInuse}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.stack_memory_obtained"}}</dt> + <dd>{{.SysStatus.StackSys}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.mspan_structures_usage"}}</dt> + <dd>{{.SysStatus.MSpanInuse}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.mspan_structures_obtained"}}</dt> + <dd>{{.SysStatus.MSpanSys}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.mcache_structures_usage"}}</dt> + <dd>{{.SysStatus.MCacheInuse}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.mcache_structures_obtained"}}</dt> + <dd>{{.SysStatus.MCacheSys}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.profiling_bucket_hash_table_obtained"}}</dt> + <dd>{{.SysStatus.BuckHashSys}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.gc_metadata_obtained"}}</dt> + <dd>{{.SysStatus.GCSys}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.other_system_allocation_obtained"}}</dt> + <dd>{{.SysStatus.OtherSys}}</dd> + <div class="divider"></div> + <dt>{{ctx.Locale.Tr "admin.dashboard.next_gc_recycle"}}</dt> + <dd>{{.SysStatus.NextGC}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.last_gc_time"}}</dt> + <dd><relative-time format="duration" datetime="{{.SysStatus.LastGCTime}}">{{.SysStatus.LastGCTime}}</relative-time></dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.total_gc_pause"}}</dt> + <dd>{{.SysStatus.PauseTotalNs}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.last_gc_pause"}}</dt> + <dd>{{.SysStatus.PauseNs}}</dd> + <dt>{{ctx.Locale.Tr "admin.dashboard.gc_times"}}</dt> + <dd>{{.SysStatus.NumGC}}</dd> +</dl> diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl new file mode 100644 index 00000000..8203a2a0 --- /dev/null +++ b/templates/admin/user/edit.tmpl @@ -0,0 +1,235 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin edit user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.users.edit_account"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="./edit" method="post"> + {{template "base/disable_form_autofill"}} + {{.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"> + </div> + <!-- Types and name --> + <div class="inline required field {{if .Err_LoginType}}error{{end}}"> + <label>{{ctx.Locale.Tr "admin.users.auth_source"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="login_type" name="login_type" value="{{.LoginSource.Type.Int}}-{{.LoginSource.ID}}" required> + <div class="text">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="0-0">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{range .Sources}} + <div class="item" data-value="{{.Type.Int}}-{{.ID}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + + <div class="inline field {{if .Err_Visibility}}error{{end}}"> + <span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "settings.visibility"}}</label></span> + <div class="ui selection type dropdown"> + {{if .User.Visibility.IsPublic}}<input type="hidden" id="visibility" name="visibility" value="0">{{end}} + {{if .User.Visibility.IsLimited}}<input type="hidden" id="visibility" name="visibility" value="1">{{end}} + {{if .User.Visibility.IsPrivate}}<input type="hidden" id="visibility" name="visibility" value="2">{{end}} + <div class="text"> + {{if .User.Visibility.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .User.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .User.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range $mode := .AllowedUserVisibilityModes}} + {{if $mode.IsPublic}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.public_tooltip"}}" data-value="0">{{ctx.Locale.Tr "settings.visibility.public"}}</div> + {{else if $mode.IsLimited}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.limited_tooltip"}}" data-value="1">{{ctx.Locale.Tr "settings.visibility.limited"}}</div> + {{else if $mode.IsPrivate}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.private_tooltip"}}" data-value="2">{{ctx.Locale.Tr "settings.visibility.private"}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + + <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> + </div> + <div class="field {{if .Err_FullName}}error{{end}}"> + <label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label> + <input id="full_name" name="full_name" value="{{.User.FullName}}" maxlength="100"> + </div> + <div class="field"> + <label for="pronouns">{{ctx.Locale.Tr "settings.pronouns"}}</label> + <input id="pronouns" name="pronouns" value="{{.User.Pronouns}}" maxlength="50"> + </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> + </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> + <input id="password" name="password" type="password" autocomplete="new-password"> + <p class="help">{{ctx.Locale.Tr "admin.users.password_helper"}}</p> + </div> + + <div class="field {{if .Err_Language}}error{{end}}"> + <label for="language">{{ctx.Locale.Tr "settings.language"}}</label> + <div class="ui selection dropdown"> + <input name="language" type="hidden" value="{{.User.Language}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{range .AllLangs}}{{if eq $.User.Language .Lang}}{{.Name}}{{end}}{{end}}</div> + <div class="menu"> + {{range .AllLangs}} + <div class="item{{if eq $.User.Language .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + + <div class="field {{if .Err_Website}}error{{end}}"> + <label for="website">{{ctx.Locale.Tr "settings.website"}}</label> + <input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="http://mydomain.com or https://mydomain.com" maxlength="255"> + </div> + <div class="field {{if .Err_Location}}error{{end}}"> + <label for="location">{{ctx.Locale.Tr "settings.location"}}</label> + <input id="location" name="location" value="{{.User.Location}}" maxlength="50"> + </div> + + <div class="divider"></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="{{.User.MaxRepoCreation}}"> + <p class="help">{{ctx.Locale.Tr "admin.users.max_repo_creation_desc"}}</p> + </div> + + <div class="divider"></div> + + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.is_activated"}}</strong></label> + <input name="active" type="checkbox" {{if .User.IsActive}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.prohibit_login"}}</strong></label> + <input name="prohibit_login" type="checkbox" {{if .User.ProhibitLogin}}checked{{end}} {{if (eq .User.ID .SignedUserID)}}disabled{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.is_admin"}}</strong></label> + <input name="admin" type="checkbox" {{if .User.IsAdmin}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.is_restricted"}}</strong></label> + <input name="restricted" type="checkbox" {{if .User.IsRestricted}}checked{{end}}> + </div> + </div> + <div class="inline field {{if DisableGitHooks}}tw-hidden{{end}}"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "admin.users.allow_git_hook_tooltip"}}"> + <label><strong>{{ctx.Locale.Tr "admin.users.allow_git_hook"}}</strong></label> + <input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}> + </div> + </div> + <div class="inline field {{if or (DisableImportLocal) (.DisableMigrations)}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.allow_import_local"}}</strong></label> + <input name="allow_import_local" type="checkbox" {{if .User.CanImportLocal}}checked{{end}} {{if DisableImportLocal}}disabled{{end}}> + </div> + </div> + {{if not .DisableRegularOrgCreation}} + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.allow_create_organization"}}</strong></label> + <input name="allow_create_organization" type="checkbox" {{if .User.CanCreateOrganization}}checked{{end}}> + </div> + </div> + {{end}} + + {{if .TwoFactorEnabled}} + <div class="divider"></div> + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.reset_2fa"}}</strong></label> + <input name="reset_2fa" type="checkbox"> + </div> + </div> + {{end}} + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "admin.users.update_profile"}}</button> + <button class="ui red button show-modal" data-modal="#delete-user-modal">{{ctx.Locale.Tr "admin.users.delete_account"}}</button> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.avatar"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="./avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + {{if not .DisableGravatar}} + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="lookup" type="radio" {{if not .User.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.lookup_avatar_by_mail"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if .Err_Gravatar}}error{{end}}"> + <label for="gravatar">Avatar {{ctx.Locale.Tr "email"}}</label> + <input id="gravatar" name="gravatar" value="{{.User.AvatarEmail}}"> + </div> + {{end}} + + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="local" type="radio" {{if .User.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.enable_custom_avatar"}}</label> + </div> + </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"> + </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="./avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button> + </div> + </form> + </div> + </div> + +<div class="ui g-modal-confirm delete modal" id="delete-user-modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.delete_account_title"}} + </div> + <form class="ui form" method="post" action="./delete"> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.delete_account_desc"}}</p> + {{$.CsrfTokenHtml}} + <div class="field"> + <div class="ui checkbox"> + <label for="purge">{{ctx.Locale.Tr "admin.users.purge"}}</label> + <input name="purge" type="checkbox"> + </div> + <p class="help">{{ctx.Locale.Tr "admin.users.purge_help"}}</p> + </div> + </div> + {{template "base/modal_actions_confirm" .}} + </form> +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/list.tmpl b/templates/admin/user/list.tmpl new file mode 100644 index 00000000..e5d42995 --- /dev/null +++ b/templates/admin/user/list.tmpl @@ -0,0 +1,119 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.users.user_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/admin/users/new">{{ctx.Locale.Tr "admin.users.new_account"}}</a> + </div> + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty" id="user-list-search-form"> + + <!-- Right Menu --> + <div class="ui right floated secondary filter menu"> + <!-- Status Filter Menu Item --> + <div class="ui dropdown type jump item"> + <span class="text">{{ctx.Locale.Tr "admin.users.list_status_filter.menu_text"}}</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="item j-reset-status-filter">{{ctx.Locale.Tr "admin.users.list_status_filter.reset"}}</a> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_admin]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_admin"}}</label> + <label class="item"><input type="radio" name="status_filter[is_admin]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_admin"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_active]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_active"}}</label> + <label class="item"><input type="radio" name="status_filter[is_active]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_active"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_restricted]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_restricted"}}</label> + <label class="item"><input type="radio" name="status_filter[is_restricted]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_restricted"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_prohibit_login]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_prohibit_login"}}</label> + <label class="item"><input type="radio" name="status_filter[is_prohibit_login]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_prohibit_login"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="status_filter[is_2fa_enabled]" value="1"> {{ctx.Locale.Tr "admin.users.list_status_filter.is_2fa_enabled"}}</label> + <label class="item"><input type="radio" name="status_filter[is_2fa_enabled]" value="0"> {{ctx.Locale.Tr "admin.users.list_status_filter.not_2fa_enabled"}}</label> + </div> + </div> + + <!-- Sort Menu Item --> + <div class="ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <button class="item" name="sort" value="oldest">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</button> + <button class="item" name="sort" value="newest">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</button> + <button class="item" name="sort" value="alphabetically">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</button> + <button class="item" name="sort" value="reversealphabetically">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</button> + <button class="item" name="sort" value="recentupdate">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</button> + <button class="item" name="sort" value="leastupdate">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</button> + </div> + </div> + </div> + + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.user_kind")}} + </form> + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th data-sortt-asc="oldest" data-sortt-desc="newest">ID{{SortArrow "oldest" "newest" .SortType false}}</th> + <th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically" data-sortt-default="true"> + {{ctx.Locale.Tr "admin.users.name"}} + {{SortArrow "alphabetically" "reversealphabetically" $.SortType true}} + </th> + <th>{{ctx.Locale.Tr "email"}}</th> + <th>{{ctx.Locale.Tr "admin.users.activated"}}</th> + <th>{{ctx.Locale.Tr "admin.users.restricted"}}</th> + <th>{{ctx.Locale.Tr "admin.users.2fa"}}</th> + <th>{{ctx.Locale.Tr "admin.users.created"}}</th> + <th data-sortt-asc="lastlogin" data-sortt-desc="reverselastlogin"> + {{ctx.Locale.Tr "admin.users.last_login"}} + {{SortArrow "lastlogin" "reverselastlogin" $.SortType false}} + </th> + <th></th> + </tr> + </thead> + <tbody> + {{range .Users}} + <tr> + <td>{{.ID}}</td> + <td> + <a href="{{.HomeLink}}">{{.Name}}</a> + {{if .IsAdmin}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.admin"}}</span> + {{else if eq 2 .Type}}{{/* Reserved user */}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.reserved"}}</span> + {{else if eq 4 .Type}}{{/* Bot "user" */}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.bot"}}</span> + {{else if eq 5 .Type}}{{/* Remote user */}} + <span class="ui mini label">{{ctx.Locale.Tr "admin.users.remote"}}</span> + {{end}} + </td> + <td class="gt-ellipsis tw-max-w-48">{{.Email}}</td> + <td>{{if .IsActive}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if .IsRestricted}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if index $.UsersTwoFaStatus .ID}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{DateTime "short" .CreatedUnix}}</td> + {{if .LastLoginUnix}} + <td>{{DateTime "short" .LastLoginUnix}}</td> + {{else}} + <td><span>{{ctx.Locale.Tr "admin.users.never_login"}}</span></td> + {{end}} + <td> + <div class="tw-flex tw-gap-2"> + <a href="{{$.Link}}/{{.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}">{{svg "octicon-person"}}</a> + <a href="{{$.Link}}/{{.ID}}/edit" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a> + </div> + </td> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{template "base/paginate" .}} + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/new.tmpl b/templates/admin/user/new.tmpl new file mode 100644 index 00000000..b04ebc4b --- /dev/null +++ b/templates/admin/user/new.tmpl @@ -0,0 +1,90 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin new user")}} + <div class="admin-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.users.new_account"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <!-- Types and name --> + <div class="inline required field {{if .Err_LoginType}}error{{end}}"> + <label>{{ctx.Locale.Tr "admin.users.auth_source"}}</label> + <div class="ui selection type dropdown"> + <input type="hidden" id="login_type" name="login_type" value="{{.login_type}}" data-password="required" required> + <div class="text">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="0-0">{{ctx.Locale.Tr "admin.users.local"}}</div> + {{range .Sources}} + <div class="item" data-value="{{.Type.Int}}-{{.ID}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + + <div class="inline field {{if .Err_Visibility}}error{{end}}"> + <span class="inline required field"><label for="visibility">{{ctx.Locale.Tr "settings.visibility"}}</label></span> + <div class="ui selection type dropdown"> + <input type="hidden" id="visibility" name="visibility" value="{{if .visibility}}{{printf "%d" .visibility}}{{else}}{{printf "%d" .DefaultUserVisibilityMode}}{{end}}"> + <div class="text"> + {{if .DefaultUserVisibilityMode.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .DefaultUserVisibilityMode.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .DefaultUserVisibilityMode.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range $mode := .AllowedUserVisibilityModes}} + {{if $mode.IsPublic}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.public_tooltip"}}" data-value="0">{{ctx.Locale.Tr "settings.visibility.public"}}</div> + {{else if $mode.IsLimited}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.limited_tooltip"}}" data-value="1">{{ctx.Locale.Tr "settings.visibility.limited"}}</div> + {{else if $mode.IsPrivate}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.private_tooltip"}}" data-value="2">{{ctx.Locale.Tr "settings.visibility.private"}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + + <div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .login_type "0-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="{{.login_name}}"> + </div> + <div class="required field {{if .Err_UserName}}error{{end}}"> + <label for="user_name">{{ctx.Locale.Tr "username"}}</label> + <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required maxlength="40"> + </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="{{.email}}" required> + </div> + <div class="required local field {{if .Err_Password}}error{{end}} {{if not (eq .login_type "0-0")}}tw-hidden{{end}}"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" autocomplete="new-password" value="{{.password}}" {{if eq .login_type "0-0"}}required{{end}}> + </div> + + <div class="inline field local {{if ne .login_type "0-0"}}tw-hidden{{end}}"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "auth.allow_password_change"}}</strong></label> + <input name="must_change_password" type="checkbox" checked> + </div> + </div> + + <!-- Send register notify e-mail --> + {{if .CanSendEmail}} + <div class="inline field"> + <div class="ui checkbox"> + <label><strong>{{ctx.Locale.Tr "admin.users.send_register_notify"}}</strong></label> + <input name="send_notify" type="checkbox" {{if .send_notify}}checked{{end}}> + </div> + </div> + {{end}} + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "admin.users.new_account"}}</button> + </div> + </form> + </div> + </div> +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/view.tmpl b/templates/admin/user/view.tmpl new file mode 100644 index 00000000..21943a83 --- /dev/null +++ b/templates/admin/user/view.tmpl @@ -0,0 +1,48 @@ +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin view user")}} + +<div class="admin-setting-content"> + <div class="admin-responsive-columns"> + <div class="tw-flex-1"> + <h4 class="ui top attached header"> + {{.Title}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{.Link}}/edit">{{ctx.Locale.Tr "admin.users.edit"}}</a> + </div> + </h4> + <div class="ui attached segment"> + {{template "admin/user/view_details" .}} + </div> + </div> + <div class="tw-flex-1"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.emails"}} + <div class="ui right"> + {{.EmailsTotal}} + </div> + </h4> + <div class="ui attached segment"> + {{template "admin/user/view_emails" .}} + </div> + </div> + </div> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "admin.repositories"}} + <div class="ui right"> + {{.ReposTotal}} + </div> + </h4> + <div class="ui attached segment"> + {{template "explore/repo_list" .}} + </div> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.organization"}} + <div class="ui right"> + {{.OrgsTotal}} + </div> + </h4> + <div class="ui attached segment"> + {{template "explore/user_list" .}} + </div> +</div> + +{{template "admin/layout_footer" .}} diff --git a/templates/admin/user/view_details.tmpl b/templates/admin/user/view_details.tmpl new file mode 100644 index 00000000..be2f32b5 --- /dev/null +++ b/templates/admin/user/view_details.tmpl @@ -0,0 +1,74 @@ +<div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar .User 48}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .User}} + {{if .User.IsAdmin}} + <span class="ui basic label">{{ctx.Locale.Tr "admin.users.admin"}}</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}} + </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}} + </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}} + </div> + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "settings.visibility"}}:</b> + {{if .User.Visibility.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .User.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .User.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </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}} + </div> + {{if .User.Language}} + <div class="flex-item-body"> + <span class="flex-text-inline"> + <b>{{ctx.Locale.Tr "settings.language"}}:</b> + {{range .AllLangs}}{{if eq $.User.Language .Lang}}{{.Name}}{{end}}{{end}} + </span> + </div> + {{end}} + {{if .User.Location}} + <div class="flex-item-body"> + <span class="flex-text-inline">{{svg "octicon-location"}}{{.User.Location}}</span> + </div> + {{end}} + {{if .User.Website}} + <div class="flex-item-body"> + <span class="flex-text-inline"> + {{svg "octicon-link"}} + <a target="_blank" href="{{.User.Website}}">{{.User.Website}}</a> + </span> + </div> + {{end}} + </div> + </div> +</div> diff --git a/templates/admin/user/view_emails.tmpl b/templates/admin/user/view_emails.tmpl new file mode 100644 index 00000000..22ce305a --- /dev/null +++ b/templates/admin/user/view_emails.tmpl @@ -0,0 +1,19 @@ +<div class="flex-list"> + {{range .Emails}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-text-block"> + {{.Email}} + {{if .IsPrimary}} + <div class="ui primary label">{{ctx.Locale.Tr "settings.primary"}}</div> + {{end}} + {{if .IsActivated}} + <div class="ui green label">{{ctx.Locale.Tr "settings.activated"}}</div> + {{else}} + <div class="ui label">{{ctx.Locale.Tr "settings.requires_activation"}}</div> + {{end}} + </div> + </div> + </div> + {{end}} +</div> diff --git a/templates/api/packages/pypi/simple.tmpl b/templates/api/packages/pypi/simple.tmpl new file mode 100644 index 00000000..181f8266 --- /dev/null +++ b/templates/api/packages/pypi/simple.tmpl @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> + <head> + <title>Links for {{.PackageDescriptor.Package.Name}}</title> + </head> + <body> + <h1>Links for {{.PackageDescriptor.Package.Name}}</h1> + {{range .PackageDescriptors}} + {{$p := .}} + {{range .Files}} + <a href="{{$.RegistryURL}}/files/{{$p.Package.LowerName}}/{{$p.Version.Version}}/{{.File.Name}}#sha256={{.Blob.HashSHA256}}"{{if $p.Metadata.RequiresPython}} data-requires-python="{{$p.Metadata.RequiresPython}}"{{end}}>{{.File.Name}}</a><br> + {{end}} + {{end}} + </body> +</html> diff --git a/templates/base/alert.tmpl b/templates/base/alert.tmpl new file mode 100644 index 00000000..760d3bfa --- /dev/null +++ b/templates/base/alert.tmpl @@ -0,0 +1,20 @@ +{{if .Flash.ErrorMsg}} + <div class="ui negative message flash-message flash-error"> + <p>{{.Flash.ErrorMsg | SanitizeHTML}}</p> + </div> +{{end}} +{{if .Flash.SuccessMsg}} + <div class="ui positive message flash-message flash-success"> + <p>{{.Flash.SuccessMsg | SanitizeHTML}}</p> + </div> +{{end}} +{{if .Flash.InfoMsg}} + <div class="ui info message flash-message flash-info"> + <p>{{.Flash.InfoMsg | SanitizeHTML}}</p> + </div> +{{end}} +{{if .Flash.WarningMsg}} + <div class="ui warning message flash-message flash-warning"> + <p>{{.Flash.WarningMsg | SanitizeHTML}}</p> + </div> +{{end}} diff --git a/templates/base/alert_details.tmpl b/templates/base/alert_details.tmpl new file mode 100644 index 00000000..6801c824 --- /dev/null +++ b/templates/base/alert_details.tmpl @@ -0,0 +1,7 @@ +{{.Message}} +<details> + <summary>{{.Summary}}</summary> + <code> + {{.Details | SanitizeHTML}} + </code> +</details> diff --git a/templates/base/disable_form_autofill.tmpl b/templates/base/disable_form_autofill.tmpl new file mode 100644 index 00000000..6f06395b --- /dev/null +++ b/templates/base/disable_form_autofill.tmpl @@ -0,0 +1,31 @@ +{{/* +Why we need to disable form autofill: +1. Many pages contain different password inputs for different usages, eg: repo setting, autofill will make a mess. +2. We have `areYouSure` confirm dialog if a user leaves a pages without submit. +Autofill will make the form changed even if the user didn't input anything. Then the user keeps seeing annoying confirm dialog. + +In history, Gitea put `<input class="fake" type="password">` in forms to bypass the autofill, +but there were still many forms suffered the autofill problem. + +Now we improve it. + +Solutions which do NOT work: +1. Adding `autocomplete=off` doesn't help. New Chrome completely ignores it. +2. Use a JavaScript to run in a few seconds later after the page is loaded to process the autofilled inputs, it doesn't work. +Because for security reason, the inputs won't be filled before the user makes an interaction in the page. +So we can not predict the correct time to run the JavaScript code. + +Solutions which work: +1. Some hacky methods like: https://github.com/matteobad/detect-autofill +2. This solution: use invisible inputs. Be aware of: +(a) The inputs must be at the beginning of the form, and can not be hidden. +(b) The input for username must have a valid name. +(c) There should be no negative word (eg: fake) in the `name` attribute. +(d) Chrome seems to use a weighted algorithm to choose an input to fill text, so the using "username" as input name is better than using "user". +We make the names of these dummy inputs begin with an underline to indicate it is for special usage, +and these dummy form values won't be used by backend code. +*/}} +<div class="autofill-dummy" aria-hidden="true"> + <input type="text" name="_autofill_dummy_username" class="ays-ignore" tabindex="-1"> + <input type="password" name="_autofill_dummy_password" class="ays-ignore" tabindex="-1"> +</div> diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl new file mode 100644 index 00000000..fed426a4 --- /dev/null +++ b/templates/base/footer.tmpl @@ -0,0 +1,20 @@ +{{if false}} + {{/* to make html structure "likely" complete to prevent IDE warnings */}} +<html> +<body> + <div> +{{end}} + + {{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/footer_content.tmpl b/templates/base/footer_content.tmpl new file mode 100644 index 00000000..5db74644 --- /dev/null +++ b/templates/base/footer_content.tmpl @@ -0,0 +1,32 @@ +<footer class="page-footer" role="group" aria-label="{{ctx.Locale.Tr "aria.footer"}}"> + <div class="left-links" role="contentinfo" aria-label="{{ctx.Locale.Tr "aria.footer.software"}}"> + {{if ShowFooterPoweredBy}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org">{{ctx.Locale.Tr "powered_by" "Forgejo"}}</a> + {{end}} + {{if (or .ShowFooterVersion .PageIsAdmin)}} + {{ctx.Locale.Tr "version"}}: + {{if .IsAdmin}} + <a href="{{AppSubUrl}}/admin/config">{{AppVer}}</a> + {{else}} + {{AppVer}} + {{end}} + {{end}} + {{if and .TemplateLoadTimes ShowFooterTemplateLoadTime}} + {{ctx.Locale.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> + {{ctx.Locale.Tr "template"}}{{if .TemplateName}} {{.TemplateName}}{{end}}: <strong>{{call .TemplateLoadTimes}}</strong> + {{end}} + </div> + <div class="right-links" role="group" aria-label="{{ctx.Locale.Tr "aria.footer.links"}}"> + <div class="ui dropdown upward language"> + <span class="flex-text-inline">{{svg "octicon-globe" 14}} {{ctx.Locale.LangName}}</span> + <div class="menu language-menu"> + {{range .AllLangs}} + <a lang="{{.Lang}}" data-url="{{AppSubUrl}}/?lang={{.Lang}}" class="item {{if eq ctx.Locale.Lang .Lang}}active selected{{end}}">{{.Name}}</a> + {{end}} + </div> + </div> + <a href="{{AssetUrlPrefix}}/licenses.txt">{{ctx.Locale.Tr "licenses"}}</a> + {{if .EnableSwagger}}<a href="{{AppSubUrl}}/api/swagger">API</a>{{end}} + {{template "custom/extra_links_footer" .}} + </div> +</footer> diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl new file mode 100644 index 00000000..7753f492 --- /dev/null +++ b/templates/base/head.tmpl @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<html lang="{{ctx.Locale.Lang}}" data-theme="{{ThemeName .SignedUser}}"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1"> + {{/* Display `- .Repository.FullName` only if `.Title` does not already start with that. */}} + <title>{{if .Title}}{{.Title}} - {{end}}{{if and (.Repository.Name) (not (StringUtils.HasPrefix .Title .Repository.FullName))}}{{.Repository.FullName}} - {{end}}{{AppDisplayName}}</title> + {{if .ManifestData}}<link rel="manifest" href="data:{{.ManifestData}}">{{end}} + <meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}"> + <meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{MetaDescription}}{{end}}"> + <meta name="keywords" content="{{MetaKeywords}}"> + <meta name="referrer" content="no-referrer"> +{{if .GoGetImport}} + <meta name="go-import" content="{{.GoGetImport}} git {{.RepoCloneLink.HTTPS}}"> + <meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}"> +{{end}} +{{if and .EnableFeed .FeedURL}} + <link rel="alternate" type="application/atom+xml" title="" href="{{.FeedURL}}.atom"> + <link rel="alternate" type="application/rss+xml" title="" href="{{.FeedURL}}.rss"> +{{end}} + <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" .}} +</head> +<body hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}' hx-swap="outerHTML" hx-ext="morph" hx-push-url="false"> + {{template "custom/body_outer_pre" .}} + + <div class="full height"> + <noscript>{{ctx.Locale.Tr "enable_javascript"}}</noscript> + + {{template "custom/body_inner_pre" .}} + + {{if not .PageIsInstall}} + {{template "base/head_navbar" .}} + {{end}} + +{{if false}} + {{/* to make html structure "likely" complete to prevent IDE warnings */}} + </div> +</body> +</html> +{{end}} diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl new file mode 100644 index 00000000..068271bb --- /dev/null +++ b/templates/base/head_navbar.tmpl @@ -0,0 +1,205 @@ +{{$notificationUnreadCount := 0}} +{{if and .IsSigned .NotificationUnreadCount}} + {{$notificationUnreadCount = call .NotificationUnreadCount}} +{{end}} + +<nav id="navbar" aria-label="{{ctx.Locale.Tr "aria.navbar"}}"> + <div class="navbar-left ui secondary menu"> + <!-- the logo --> + <a class="item" id="navbar-logo" href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home"}}{{end}}"> + <img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true"> + </a> + + <!-- 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 item navbar-mobile-right only-mobile"> + {{if .IsSigned}} + <a id="mobile-notifications-icon" class="item tw-w-auto tw-p-2" 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}} + <button class="item tw-w-auto ui icon mini button tw-p-2 tw-m-0" id="navbar-expand-toggle" aria-label="{{ctx.Locale.Tr "toggle_menu"}}">{{svg "octicon-three-bars"}}</button> + </div> + + <!-- navbar links non-mobile --> + {{if and .IsSigned .MustChangePassword}} + {{/* No links */}} + {{else if .IsSigned}} + {{if not .UnitIssuesGlobalDisabled}} + <a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubUrl}}/issues">{{ctx.Locale.Tr "issues"}}</a> + {{end}} + {{if not .UnitPullsGlobalDisabled}} + <a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubUrl}}/pulls">{{ctx.Locale.Tr "pull_requests"}}</a> + {{end}} + {{if not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled)}} + {{if .ShowMilestonesDashboardPage}} + <a class="item{{if .PageIsMilestonesDashboard}} active{{end}}" href="{{AppSubUrl}}/milestones">{{ctx.Locale.Tr "milestones"}}</a> + {{end}} + {{end}} + <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "explore"}}</a> + {{else if .IsLandingPageOrganizations}} + <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{ctx.Locale.Tr "explore"}}</a> + {{else}} + <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "explore"}}</a> + {{end}} + + {{template "custom/extra_links" .}} + + {{if not .IsSigned}} + <a class="item" target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/">{{ctx.Locale.Tr "help"}}</a> + {{end}} + </div> + + <!-- the full dropdown menus --> + <div class="navbar-right ui secondary menu"> + {{if and .IsSigned .MustChangePassword}} + <div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}"> + <span class="text tw-flex tw-items-center"> + {{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}} + <span class="only-mobile tw-ml-2">{{.SignedUser.Name}}</span> + <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> + </span> + <div class="menu user-menu"> + <div class="ui header"> + {{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> + </div> + + <div class="divider"></div> + <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout"> + {{svg "octicon-sign-out"}} + {{ctx.Locale.Tr "sign_out"}} + </a> + </div><!-- end content avatar menu --> + </div><!-- end dropdown avatar menu --> + {{else if .IsSigned}} + {{if EnableTimetracking}} + <a class="active-stopwatch-trigger item tw-mx-0{{if not .ActiveStopwatch}} tw-hidden{{end}}" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}"> + <div class="tw-relative"> + {{svg "octicon-stopwatch"}} + <span class="header-stopwatch-dot"></span> + </div> + <span class="only-mobile tw-ml-2">{{ctx.Locale.Tr "active_stopwatch"}}</span> + </a> + <div class="active-stopwatch-popup item tippy-target tw-p-2"> + <div class="tw-flex tw-items-center"> + <a class="stopwatch-link tw-flex tw-items-center" href="{{.ActiveStopwatch.IssueLink}}"> + {{svg "octicon-issue-opened" 16 "tw-mr-2"}} + <span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span> + <span class="ui primary label stopwatch-time tw-my-0 tw-mx-4" data-seconds="{{.ActiveStopwatch.Seconds}}"> + {{if .ActiveStopwatch}}{{Sec2Time .ActiveStopwatch.Seconds}}{{end}} + </span> + </a> + <form class="stopwatch-commit" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/toggle"> + {{.CsrfTokenHtml}} + <button + type="submit" + class="ui button mini compact basic icon" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.stop_tracking"}}" + >{{svg "octicon-square-fill"}}</button> + </form> + <form class="stopwatch-cancel" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/cancel"> + {{.CsrfTokenHtml}} + <button + type="submit" + class="ui button mini compact basic icon" + data-tooltip-content="{{ctx.Locale.Tr "repo.issues.cancel_tracking"}}" + >{{svg "octicon-trash"}}</button> + </form> + </div> + </div> + {{end}} + + <a class="item not-mobile tw-mx-0" 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> + + <div class="ui dropdown jump item tw-mx-0 tw-pr-2" data-tooltip-content="{{ctx.Locale.Tr "create_new"}}"> + <span class="text"> + {{svg "octicon-plus"}} + <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> + <span class="only-mobile">{{ctx.Locale.Tr "create_new"}}</span> + </span> + <div class="menu"> + <a class="item" href="{{AppSubUrl}}/repo/create"> + {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} + </a> + {{if not .DisableMigrations}} + <a class="item" href="{{AppSubUrl}}/repo/migrate"> + {{svg "octicon-repo-push"}} {{ctx.Locale.Tr "new_migrate"}} + </a> + {{end}} + {{if .SignedUser.CanCreateOrganization}} + <a class="item" href="{{AppSubUrl}}/org/create"> + {{svg "octicon-organization"}} {{ctx.Locale.Tr "new_org"}} + </a> + {{end}} + </div><!-- end content create new menu --> + </div><!-- end dropdown menu create new --> + + <div class="ui dropdown jump item tw-mx-0 tw-pr-2" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}"> + <span class="text tw-flex tw-items-center"> + {{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}} + <span class="only-mobile tw-ml-2">{{.SignedUser.Name}}</span> + <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> + </span> + <div class="menu user-menu"> + <div class="ui header"> + {{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> + </div> + + <div class="divider"></div> + <a class="item" href="{{.SignedUser.HomeLink}}"> + {{svg "octicon-person"}} + {{ctx.Locale.Tr "your_profile"}} + </a> + {{if not .DisableStars}} + <a class="item" href="{{.SignedUser.HomeLink}}?tab=stars"> + {{svg "octicon-star"}} + {{ctx.Locale.Tr "your_starred"}} + </a> + {{end}} + <a class="item" href="{{AppSubUrl}}/notifications/subscriptions"> + {{svg "octicon-bell"}} + {{ctx.Locale.Tr "notification.subscriptions"}} + </a> + <a class="{{if .PageIsUserSettings}}active {{end}}item" href="{{AppSubUrl}}/user/settings"> + {{svg "octicon-tools"}} + {{ctx.Locale.Tr "your_settings"}} + </a> + <a class="item" target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/"> + {{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"}} + {{ctx.Locale.Tr "sign_out"}} + </a> + </div><!-- end content avatar menu --> + </div><!-- end dropdown avatar menu --> + {{else}} + {{if .ShowRegistrationButton}} + <a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "register"}} + </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"}} + </a> + {{end}} + </div><!-- end full right menu --> +</nav> diff --git a/templates/base/head_opengraph.tmpl b/templates/base/head_opengraph.tmpl new file mode 100644 index 00000000..c02adaba --- /dev/null +++ b/templates/base/head_opengraph.tmpl @@ -0,0 +1,47 @@ +{{- /* og:description - a one to two sentence description of your object, maybe it only needs at most 300 bytes */ -}} +{{if .PageIsUserProfile}} + <meta property="og:title" content="{{.ContextUser.DisplayName}}"> + <meta property="og:type" content="profile"> + <meta property="og:image" content="{{.ContextUser.AvatarLink ctx}}"> + <meta property="og:url" content="{{.ContextUser.HTMLURL}}"> + {{if .ContextUser.Description}} + <meta property="og:description" content="{{StringUtils.EllipsisString .ContextUser.Description 300}}"> + {{end}} +{{else if .Repository}} + {{if .Issue}} + <meta property="og:title" content="{{.Issue.Title}}"> + <meta property="og:url" content="{{.Issue.HTMLURL}}"> + {{if .Issue.Content}} + <meta property="og:description" content="{{StringUtils.EllipsisString .Issue.Content 300}}"> + {{end}} + {{else if or .PageIsDiff .IsViewFile}} + <meta property="og:title" content="{{.Title}}"> + <meta property="og:url" content="{{AppUrl}}{{.Link}}"> + {{if and .PageIsDiff .Commit}} + {{- $commitMessageParts := StringUtils.Cut .Commit.Message "\n" -}} + {{- $commitMessageBody := index $commitMessageParts 1 -}} + {{- if $commitMessageBody -}} + <meta property="og:description" content="{{StringUtils.EllipsisString $commitMessageBody 300}}"> + {{- end -}} + {{end}} + {{else}} + <meta property="og:title" content="{{.Repository.Name}}"> + <meta property="og:url" content="{{.Repository.HTMLURL}}"> + {{if .Repository.Description}} + <meta property="og:description" content="{{StringUtils.EllipsisString .Repository.Description 300}}"> + {{end}} + {{end}} + <meta property="og:type" content="object"> + {{if (.Repository.AvatarLink ctx)}} + <meta property="og:image" content="{{.Repository.AvatarLink ctx}}"> + {{else}} + <meta property="og:image" content="{{.Repository.Owner.AvatarLink ctx}}"> + {{end}} +{{else}} + <meta property="og:title" content="{{AppDisplayName}}"> + <meta property="og:type" content="website"> + <meta property="og:image" content="{{AssetUrlPrefix}}/img/logo.png"> + <meta property="og:url" content="{{AppUrl}}"> + <meta property="og:description" content="{{MetaDescription}}"> +{{end}} +<meta property="og:site_name" content="{{AppDisplayName}}"> diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl new file mode 100644 index 00000000..22e08e9c --- /dev/null +++ b/templates/base/head_script.tmpl @@ -0,0 +1,50 @@ +{{/* +==== DO NOT EDIT ==== +If you are customizing Gitea, please do not change this file. +If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. +*/}} +<script> + {{/* before our JS code gets loaded, use arrays to store errors, then the arrays will be switched to our error handler later */}} + window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);}); + window.addEventListener('unhandledrejection', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);}); + window.config = { + appUrl: '{{AppUrl}}', + appSubUrl: '{{AppSubUrl}}', + assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly + assetUrlPrefix: '{{AssetUrlPrefix}}', + runModeIsProd: {{.RunModeIsProd}}, + customEmojis: {{CustomEmojis}}, + csrfToken: '{{.CsrfToken}}', + pageData: {{.PageData}}, + notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}} + enableTimeTracking: {{EnableTimetracking}}, + {{if or .Participants .Assignees .MentionableTeams}} + mentionValues: Array.from(new Map([ + {{- range .Participants -}} + ['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}], + {{- end -}} + {{- range .Assignees -}} + ['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}], + {{- end -}} + {{- range .MentionableTeams -}} + ['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}', name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}], + {{- end -}} + ]).values()), + {{end}} + mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}}, + {{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}} + i18n: { + copy_success: {{ctx.Locale.Tr "copy_success"}}, + copy_error: {{ctx.Locale.Tr "copy_error"}}, + error_occurred: {{ctx.Locale.Tr "error.occurred"}}, + network_error: {{ctx.Locale.Tr "error.network_error"}}, + remove_label_str: {{ctx.Locale.Tr "remove_label_str"}}, + modal_confirm: {{ctx.Locale.Tr "modal.confirm"}}, + modal_cancel: {{ctx.Locale.Tr "modal.cancel"}}, + more_items: {{ctx.Locale.Tr "more_items"}}, + }, + }; + {{/* 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> diff --git a/templates/base/head_style.tmpl b/templates/base/head_style.tmpl new file mode 100644 index 00000000..0793eaca --- /dev/null +++ b/templates/base/head_style.tmpl @@ -0,0 +1,2 @@ +<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/index.css?v={{AssetVersion}}"> +<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/theme-{{ThemeName .SignedUser | PathEscape}}.css?v={{AssetVersion}}"> diff --git a/templates/base/modal_actions_confirm.tmpl b/templates/base/modal_actions_confirm.tmpl new file mode 100644 index 00000000..c44320de --- /dev/null +++ b/templates/base/modal_actions_confirm.tmpl @@ -0,0 +1,35 @@ +{{/* +Two buttons (negative, positive): +* ModalButtonTypes: "yes" (default) or "confirm" +* ModalButtonColors: "primary" (default) / "blue" / "yellow" +* ModalButtonCancelText +* ModalButtonOkText + +Single danger button (GitHub-like): +* ModalButtonDangerText "This action will destroy your data" + +The ".ok.button" and ".cancel.button" selectors are also used by Fomantic Modal internally +*/}} +<div class="actions"> + {{if .ModalButtonDangerText}} + <button class="ui danger red ok button">{{.ModalButtonDangerText}}</button> + {{else}} + {{$textNegitive := ctx.Locale.Tr "modal.no"}} + {{$textPositive := ctx.Locale.Tr "modal.yes"}} + {{if eq .ModalButtonTypes "confirm"}} + {{$textNegitive = ctx.Locale.Tr "modal.cancel"}} + {{$textPositive = ctx.Locale.Tr "modal.confirm"}} + {{end}} + {{if .ModalButtonCancelText}}{{$textNegitive = .ModalButtonCancelText}}{{end}} + {{if .ModalButtonOkText}}{{$textPositive = .ModalButtonOkText}}{{end}} + + {{$stylePositive := "primary"}} + {{if eq .ModalButtonColors "blue"}} + {{$stylePositive = "blue"}} + {{else if eq .ModalButtonColors "yellow"}} + {{$stylePositive = "yellow"}} + {{end}} + <button class="ui cancel button">{{svg "octicon-x"}} {{$textNegitive}}</button> + <button class="ui {{$stylePositive}} ok button">{{svg "octicon-check"}} {{$textPositive}}</button> + {{end}} +</div> diff --git a/templates/base/paginate.tmpl b/templates/base/paginate.tmpl new file mode 100644 index 00000000..2ca72f6a --- /dev/null +++ b/templates/base/paginate.tmpl @@ -0,0 +1,34 @@ +{{$paginationParams := .Page.GetParams}} +{{$paginationLink := $.Link}} +{{if eq $paginationLink AppSubUrl}}{{$paginationLink = print $paginationLink "/"}}{{end}} +{{with .Page.Paginater}} + {{if gt .TotalPages 1}} + <div class="center page buttons"> + <div class="ui borderless pagination menu"> + <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> + <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}} + {{if eq .Num -1}} + <a class="disabled item">...</a> + {{else}} + <a class="{{if .IsCurrent}}active {{end}}item tw-items-center" {{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> + <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> + </div> + </div> + {{end}} +{{end}} diff --git a/templates/custom/body_inner_post.tmpl b/templates/custom/body_inner_post.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/body_inner_post.tmpl diff --git a/templates/custom/body_inner_pre.tmpl b/templates/custom/body_inner_pre.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/body_inner_pre.tmpl diff --git a/templates/custom/body_outer_post.tmpl b/templates/custom/body_outer_post.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/body_outer_post.tmpl diff --git a/templates/custom/body_outer_pre.tmpl b/templates/custom/body_outer_pre.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/body_outer_pre.tmpl diff --git a/templates/custom/extra_links.tmpl b/templates/custom/extra_links.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/extra_links.tmpl diff --git a/templates/custom/extra_links_footer.tmpl b/templates/custom/extra_links_footer.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/extra_links_footer.tmpl diff --git a/templates/custom/extra_tabs.tmpl b/templates/custom/extra_tabs.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/extra_tabs.tmpl diff --git a/templates/custom/footer.tmpl b/templates/custom/footer.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/footer.tmpl diff --git a/templates/custom/header.tmpl b/templates/custom/header.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/header.tmpl diff --git a/templates/custom/repo_flag_banners.tmpl b/templates/custom/repo_flag_banners.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/custom/repo_flag_banners.tmpl diff --git a/templates/devtest/fetch-action.tmpl b/templates/devtest/fetch-action.tmpl new file mode 100644 index 00000000..be15a538 --- /dev/null +++ b/templates/devtest/fetch-action.tmpl @@ -0,0 +1,44 @@ +{{template "base/head" .}} +<div class="page-content devtest ui container"> + {{template "base/alert" .}} + <div> + <h1>link-action</h1> + <div> + Use "window.fetch" to send a request to backend, the request is defined in an "A" or "BUTTON" element. + It might be renamed to "link-fetch-action" to match the "form-fetch-action". + </div> + <div> + <button class="link-action" data-url="fetch-action-test?k=1">test action</button> + <button class="link-action" data-url="fetch-action-test?k=1" data-modal-confirm="confirm?">test with confirm</button> + <button class="ui red button link-action" data-url="fetch-action-test?k=1" data-modal-confirm="confirm?">test with risky confirm</button> + </div> + </div> + <div> + <h1>form-fetch-action</h1> + <div>Use "window.fetch" to send a form request to backend</div> + <div> + <form method="get" action="fetch-action-test?k=1" class="form-fetch-action"> + <button name="btn">submit get</button> + </form> + <form method="post" action="fetch-action-test?k=1" class="form-fetch-action"> + <div><textarea name="text" rows="3" class="js-quick-submit"></textarea></div> + <div><label><input name="check" type="checkbox"> check</label></div> + <div><button name="btn">submit post</button></div> + </form> + <form method="post" action="no-such-uri" class="form-fetch-action"> + <div class="tw-py-8">bad action url</div> + <div><button name="btn">submit test</button></div> + </form> + </div> + </div> +</div> +<style> + .ui.message.flash-message { + text-align: left; + } + .form-fetch-action { + margin-bottom: 1em; + border: 1px red dashed; /* show the border for demo purpose */ + } +</style> +{{template "base/footer" .}} diff --git a/templates/devtest/flex-list.tmpl b/templates/devtest/flex-list.tmpl new file mode 100644 index 00000000..015ab1e1 --- /dev/null +++ b/templates/devtest/flex-list.tmpl @@ -0,0 +1,115 @@ +{{template "base/head" .}} +<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/devtest.css?v={{AssetVersion}}"> +<div class="page-content devtest"> + <div class="ui container"> + <h1>Flex List (standalone)</h1> + <div class="divider"></div> + <div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg "octicon-info" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + Flex Item + <span class="ui basic label"> + with label + </span> + </div> + <div class="flex-item-body"> + consists of leading/main/trailing part + </div> + <div class="flex-item-body"> + main part contains title and (multiple) body lines + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui tiny red button"> + {{svg "octicon-alert" 14}} CJK文本测试 + </button> + <button class="ui tiny primary button"> + {{svg "octicon-info" 14}} Button + </button> + <button class="ui tiny primary button"> + Button with long text + </button> + </div> + </div> + + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg "octicon-info" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong title + </div> + <div class="flex-item-body"> + consists of leading/main/trailing part + </div> + <div class="flex-item-body"> + Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content + <span class="text truncate">Truncate very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong content</span> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui tiny red button"> + {{svg "octicon-alert" 12}} CJK文本测试 <!-- single CJK text test, it shouldn't be horizontal --> + </button> + </div> + </div> + + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg "octicon-repo" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-header"> + <div class="flex-item-title"> + <a class="text primary" href="{{$.Link}}"> + gitea-org / gitea + </a> + <span data-tooltip-content="{{ctx.Locale.Tr "repo.fork"}}">{{svg "octicon-repo-forked"}}</span> + </div> + <div class="flex-item-trailing"> + <a class="muted" href="{{$.Link}}"> + <span class="flex-text-inline"><i class="color-icon tw-mr-2 tw-bg-blue"></i>Go</span> + </a> + <a class="text grey flex-text-inline" href="{{$.Link}}">{{svg "octicon-star" 16}}45000</a> + <a class="text grey flex-text-inline" href="{{$.Link}}">{{svg "octicon-git-branch" 16}}1234</a> + </div> + </div> + <div class="flex-item-body"> + when inside header, the trailing part will wrap below the title + </div> + </div> + </div> + </div> + + <div class="divider"></div> + + <h1>Flex List (with "ui segment")</h1> + <div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item">item 1</div> + <div class="flex-item">item 2</div> + </div> + </div> + <div class="ui attached segment"> + <h1>Flex List (with "ui segment")</h1> + <div class="flex-list"> + <div class="flex-item">item 1</div> + <div class="flex-item">item 2</div> + </div> + </div> + + <h1>If parent provides the padding/margin space:</h1> + <div class="tw-border tw-border-secondary tw-py-4"> + <div class="flex-list flex-space-fitted"> + <div class="flex-item">item 1 (no padding top)</div> + <div class="flex-item">item 2 (no padding bottom)</div> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/devtest/fomantic-modal.tmpl b/templates/devtest/fomantic-modal.tmpl new file mode 100644 index 00000000..5cd36721 --- /dev/null +++ b/templates/devtest/fomantic-modal.tmpl @@ -0,0 +1,86 @@ +{{template "base/head" .}} +<div class="page-content devtest ui container"> + {{template "base/alert" .}} + + <div id="test-modal-form-1" class="ui mini modal"> + <div class="header">Form dialog (layout 1)</div> + <form class="content" 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 id="test-modal-form-2" class="ui mini modal"> + <div class="header">Form dialog (layout 2)</div> + <form method="post"> + <div class="content"> + <div class="ui input tw-w-full"><input name="user_input"></div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </div> + </form> + </div> + + <div id="test-modal-form-3" class="ui mini modal"> + <div class="header">Form dialog (layout 3)</div> + <form method="post"> + <div class="content"> + <div class="ui input tw-w-full"><input name="user_input"></div> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> + </div> + + <div id="test-modal-form-4" class="ui mini modal"> + <div class="header">Form dialog (layout 4)</div> + <div class="content"> + <div class="ui input tw-w-full"><input name="user_input"></div> + </div> + <form method="post"> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> + </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"> + very long aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + </div> + {{template "base/modal_actions_confirm"}} + </div> + + <div class="ui g-modal-confirm modal" id="test-modal-confirm"> + <div class="header">Confirm dialog</div> + <div class="content">hello, this is the modal dialog content</div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </div> + + <div class="ui g-modal-confirm modal" id="test-modal-blue"> + <div class="header">Blue dialog</div> + <div class="content">hello, this is the modal dialog content</div> + {{template "base/modal_actions_confirm" (dict "ModalButtonColors" "blue")}} + </div> + + <div class="ui g-modal-confirm modal" id="test-modal-yellow"> + <div class="header">yellow dialog</div> + <div class="content">hello, this is the modal dialog content</div> + {{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}} + </div> + + <div class="ui g-modal-confirm modal" id="test-modal-danger"> + {{svg "octicon-x" 16 "inside close"}} + <div class="header">dangerous action dialog</div> + <div class="content">hello, this is the modal dialog content, this is a dangerous operation</div> + {{template "base/modal_actions_confirm" (dict "ModalButtonDangerText" "I know and must do this is dangerous operation")}} + </div> + + <div class="modal-buttons flex-text-block tw-flex-wrap"></div> + <script type="module"> + for (const el of $('.ui.modal')) { + const $btn = $('<button>').text(`${el.id}`).on('click', () => { + $(el).modal({onApprove() {alert('confirmed')}}).modal('show'); + }); + $('.modal-buttons').append($btn); + } + </script> +</div> +{{template "base/footer" .}} diff --git a/templates/devtest/gitea-ui.tmpl b/templates/devtest/gitea-ui.tmpl new file mode 100644 index 00000000..8c5db4d8 --- /dev/null +++ b/templates/devtest/gitea-ui.tmpl @@ -0,0 +1,330 @@ +{{template "base/head" .}} +<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/devtest.css?v={{AssetVersion}}"> +<div class="page-content devtest ui container"> + <div> + <h1>Link</h1> + <div> + <a href="#">normal</a> + <a class="muted" href="#">muted</a> + <a class="suppressed" href="#">suppressed</a> + <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> + </div> + <div> + State: + <label><input type="checkbox" name="button-state-disabled" value="disabled">disabled</label> + </div> + <div id="devtest-button-samples"> + <ul class="button-sample-groups"> + <li class="sample-group"> + <h2>General purpose:</h2> + <button class="ui button">Unclassed</button> + <button class="ui basic button">Basic Unclassed</button> + <button class="ui primary button">Primary</button> + <button class="ui basic primary button">Basic Primary</button> + <button class="ui negative button">Negative</button> + <button class="ui basic negative button">Basic Negative</button> + <button class="ui positive button">Positive</button> + <button class="ui basic positive button">Basic Positive</button> + </li> + <li class="sample-group"> + <h2>Recommended colors:</h2> + <button class="ui red button">Red</button> + <button class="ui basic red button">Basic Red</button> + <button class="ui primary button">Green</button> + <button class="ui basic primary button">Basic Green</button> + <button class="ui blue button">Blue</button> + <button class="ui basic blue button">Basic Blue</button> + <button class="ui orange button">Orange</button> + <button class="ui basic orange button">Basic Orange</button> + <button class="ui yellow button">Yellow</button> + <button class="ui basic yellow button">Basic Yellow</button> + </li> + <li class="sample-group"> + <h2>Supported but not recommended:</h2> + <p>Do not use if there is no strong requirement. Do not use grey/black buttons, they don't work well with dark theme.</p> + <button class="ui secondary button">Secondary</button> + <button class="ui basic secondary button">Basic Secondary</button> + <button class="ui olive button">Olive</button> + <button class="ui basic olive button">Basic Olive</button> + <button class="ui teal button">Teal</button> + <button class="ui basic teal button">Basic Teal</button> + <button class="ui violet button">Violet</button> + <button class="ui basic violet button">Basic Violet</button> + <button class="ui purple button">Purple</button> + <button class="ui basic purple button">Basic Purple</button> + <button class="ui pink button">Pink</button> + <button class="ui basic pink button">Basic Pink</button> + <button class="ui brown button">Brown</button> + <button class="ui basic brown button">Basic Brown</button> + </li> + <li class="sample-group"> + <h2>Inline / Plain:</h2> + <div class="tw-my-1"> + <button class="btn tw-p-2">Plain button</button> + <button class="btn interact-fg tw-p-2">Plain button with interact fg</button> + <button class="btn interact-bg tw-p-2">Plain button with interact bg</button> + </div> + </li> + </ul> + <script type="module"> + const $buttons = $('#devtest-button-samples').find('button.ui'); + + const $buttonStyles = $('input[name*="button-style"]'); + $buttonStyles.on('click', () => $buttonStyles.map((_ ,el) => $buttons.toggleClass(el.value, el.checked))); + + const $buttonStates = $('input[name*="button-state"]'); + $buttonStates.on('click', () => $buttonStates.map((_ ,el) => $buttons.prop(el.value, el.checked))); + </script> + </div> + </div> + + <div> + <h1>Buttons</h1> + <div class="ui buttons"><button class="ui button">1</button><button class="ui button">2</button><button class="ui button">3</button></div> + <div class="ui buttons"><button class="ui button active">1</button><button class="ui button">2</button><button class="ui button">3</button></div> + <div class="ui buttons"><button class="ui button">1</button><button class="ui button active">2</button><button class="ui button">3</button></div> + <div class="ui buttons"><button class="ui button">1</button><button class="ui button">2</button><button class="ui button active">3</button></div> + </div> + + <div> + <h1>Tooltip</h1> + <div><span data-tooltip-content="test tooltip">text with tooltip</span></div> + <div><span data-tooltip-content="test tooltip" data-tooltip-interactive="true">text with interactive tooltip</span></div> + </div> + + <div> + <h1>Loading</h1> + <div class="is-loading loading-icon-2px tw-border tw-border-secondary tw-py-1"><span>loading ...</span></div> + <div class="is-loading tw-border tw-border-secondary tw-py-4"> + <p>loading ...</p> + <p>loading ...</p> + <p>loading ...</p> + <p>loading ...</p> + </div> + </div> + + <div> + <h1><origin-url></h1> + <div><origin-url data-url="test/url"></origin-url></div> + <div><origin-url data-url="/test/url"></origin-url></div> + </div> + + <div> + <h1><overflow-menu></h1> + <overflow-menu class="ui secondary pointing tabular borderless menu"> + <div class="overflow-menu-items"> + <a class="active item">item</a> + <a class="item">item 1</a> + <a class="item">item 2</a> + <a class="item">item 3</a> + <a class="item">item 4</a> + <a class="item">item 5</a> + <a class="item">item 6</a> + <a class="item">item 7</a> + <a class="item">item 8</a> + <a class="item">item 9</a> + <a class="item">item 10</a> + <a class="item">item 11</a> + <a class="item">item 12</a> + <a class="item">item 13</a> + <a class="item">item 14</a> + <a class="item">item 15</a> + <a class="item">item 16</a> + <a class="item">item 17</a> + <a class="item">item 18</a> + </div> + </overflow-menu> + </div> + + <div> + <h1>GiteaAbsoluteDate</h1> + <div><absolute-date date="2024-03-11" year="numeric" day="numeric" month="short"></absolute-date></div> + <div><absolute-date date="2024-03-11" year="numeric" day="numeric" month="long"></absolute-date></div> + <div><absolute-date date="2024-03-11" year="" day="numeric" month="numeric"></absolute-date></div> + <div><absolute-date date="2024-03-11" year="" day="numeric" month="numeric" weekday="long"></absolute-date></div> + <div><absolute-date date="2024-03-11T19:00:00-05:00" year="" day="numeric" month="numeric" weekday="long"></absolute-date></div> + <div class="tw-text-text-light-2">relative-time: <relative-time format="datetime" datetime="2024-03-11" year="" day="numeric" month="numeric"></relative-time></div> + </div> + + <div> + <h1>LocaleNumber</h1> + <div>{{ctx.Locale.PrettyNumber 1}}</div> + <div>{{ctx.Locale.PrettyNumber 12}}</div> + <div>{{ctx.Locale.PrettyNumber 123}}</div> + <div>{{ctx.Locale.PrettyNumber 1234}}</div> + <div>{{ctx.Locale.PrettyNumber 12345}}</div> + <div>{{ctx.Locale.PrettyNumber 123456}}</div> + <div>{{ctx.Locale.PrettyNumber 1234567}}</div> + </div> + + <div> + <h1>TimeSince</h1> + <div>Now: {{TimeSince .TimeNow ctx.Locale}}</div> + <div>5s past: {{TimeSince .TimePast5s ctx.Locale}}</div> + <div>5s future: {{TimeSince .TimeFuture5s ctx.Locale}}</div> + <div>2m past: {{TimeSince .TimePast2m ctx.Locale}}</div> + <div>2m future: {{TimeSince .TimeFuture2m ctx.Locale}}</div> + <div>1y past: {{TimeSince .TimePast1y ctx.Locale}}</div> + <div>1y future: {{TimeSince .TimeFuture1y ctx.Locale}}</div> + </div> + + <div> + <h1>SVG alignment</h1> + + <h2>Text with SVG</h2> + <div class="flex-text-block">{{svg "octicon-alert"}} {{svg "octicon-x"}} text (block)</div> + <div><div class="flex-text-inline">{{svg "octicon-alert"}} {{svg "octicon-x"}} text</div> (inline)</div> + + <div class="flex-text-block">{{svg "octicon-alert"}} flex item with very very very very very very very very long content</div> + + <div class="flex-items-block"> + <div class="item">{{svg "octicon-alert"}} flex every line</div> + <div class="item">{{svg "octicon-alert"}} flex every item</div> + <div class="item">{{svg "octicon-alert"}} flex item with very very very very very very very very long content</div> + </div> + + <h2>Button with SVG</h2> + <div> + <button class="ui red button">{{svg "octicon-alert" 24}} {{svg "octicon-x" 24}} text</button> + <div class="ui labeled button"> + <button class="ui basic button">labeled button</button> + <a class="ui basic label">123</a> + </div> + <button class="ui yellow button">{{svg "octicon-x" 16}} button with very very very very very very very very long text</button> + </div> + + <h2>Input with SVG</h2> + <div> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search"}}</i> + <input type="text" placeholder="place holder"> + </div> + </div> + + <h2>Dropdown with SVG</h2> + <div> + <div class="ui dropdown" style="border: 1px red dashed" data-tooltip-content="border for demo purpose only"> + <span class="text">simple</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"><i class="icon">{{svg "octicon-search"}}</i><input type="text" value="search input in menu"></div> + <div class="item">item</div> + </div> + </div> + <div class="ui search selection dropdown"> + <span class="text">search ...</span> + <input name="value" class="search"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{svg "octicon-x" 14 "remove icon"}} + <div class="menu"> + <div class="item">item</div> + </div> + </div> + <div class="ui multiple selection dropdown"> + <input class="hidden" value="1"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{svg "octicon-x" 14 "remove icon"}} + <div class="default text">empty multiple dropdown</div> + <div class="menu"> + <div class="item">item</div> + </div> + </div> + <div class="ui multiple clearable search selection dropdown"> + <input type="hidden" value="1"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{svg "octicon-x" 14 "remove icon"}} + <div class="default text">clearable search dropdown</div> + <div class="menu"> + <div class="item" data-value="1">item</div> + </div> + </div> + <div class="ui buttons"> + <button class="ui button">Button with Dropdown</button> + <div class="ui dropdown button icon"> + {{svg "octicon-triangle-down"}} + <div class="menu"> + <div class="item">item</div> + </div> + </div> + </div> + </div> + + <div> + <div class="ui dropdown mini button"> + <span class="text">mini dropdown</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui dropdown tiny button"> + <span class="text">tiny dropdown</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui button dropdown"> + <span class="text">button dropdown</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui dropdown large button"> + <span class="text">large dropdown</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + </div> + + <div> + <div class="ui dropdown mini compact button"> + <span class="text">mini compact</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui dropdown tiny compact button"> + <span class="text">tiny compact</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui button compact dropdown"> + <span class="text">button compact</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui dropdown large compact button"> + <span class="text">large compact</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + </div> + + <div> + <hr> + <div class="ui tiny button">Button align with ...</div> + <div class="ui dropdown tiny button"> + <span class="text">... Dropdown Button</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + </div> + </div> + + <div> + <h1>Toast</h1> + <div> + <button class="ui button" id="info-toast">Show Info Toast</button> + <button class="ui button" id="warning-toast">Show Warning Toast</button> + <button class="ui button" id="error-toast">Show Error Toast</button> + </div> + </div> + + <div> + <h1>ComboMarkdownEditor</h1> + <div>ps: no JS code attached, so just a layout</div> + {{template "shared/combomarkdowneditor" .}} + </div> + + <h1>Tailwind CSS Demo</h1> + <div> + <button class="{{if true}}tw-bg-red{{end}} tw-p-5 tw-border tw-rounded hover:tw-bg-blue active:tw-bg-yellow">Button</button> + </div> + + <script src="{{AssetUrlPrefix}}/js/devtest.js?v={{AssetVersion}}"></script> +</div> +{{template "base/footer" .}} diff --git a/templates/devtest/label.tmpl b/templates/devtest/label.tmpl new file mode 100644 index 00000000..c4b52a3e --- /dev/null +++ b/templates/devtest/label.tmpl @@ -0,0 +1,27 @@ +{{template "base/head" .}} +<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/devtest.css?v={{AssetVersion}}"> +<div class="page-content devtest ui container"> + <div> + <h1>Label</h1> + <div class="flex-text-block tw-my-2"> + <span class="ui label">simple label</span> + <span class="ui red label">red label</span> + <span class="ui green label">green label</span> + </div> + <div class="flex-text-block tw-my-2"> + <span class="ui basic label">basic label</span> + <span class="ui basic red label">basic red label</span> + <span class="ui basic green label">basic green label</span> + </div> + <div class="flex-text-block tw-my-2"> + <span class="ui label">long content must be in a non-flex "gt-ellipsis" element, otherwise it won't get ellipsis. very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong label</span> + </div> + <div class="flex-text-block tw-my-2"> + <span class="ui label"><span class="gt-ellipsis">very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong label</span></span> + </div> + <div class="tw-my-2"> + <span class="ui label tw-max-w-full"><span class="gt-ellipsis">very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong label</span></span> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/devtest/list.tmpl b/templates/devtest/list.tmpl new file mode 100644 index 00000000..90b1fcc9 --- /dev/null +++ b/templates/devtest/list.tmpl @@ -0,0 +1,15 @@ +{{template "base/head" .}} + +<ul> + {{range .SubNames}} + <li><a href="{{AppSubUrl}}/devtest/{{.}}">{{.}}</a></li> + {{end}} +</ul> + +<style> +ul { + line-height: 2em; +} +</style> + +{{template "base/footer" .}} diff --git a/templates/devtest/tmplerr-sub.tmpl b/templates/devtest/tmplerr-sub.tmpl new file mode 100644 index 00000000..f7974eb1 --- /dev/null +++ b/templates/devtest/tmplerr-sub.tmpl @@ -0,0 +1,3 @@ +sub template triggers an executing error + + {{ctx.Locale.NoSuch "asdf"}} diff --git a/templates/devtest/tmplerr.tmpl b/templates/devtest/tmplerr.tmpl new file mode 100644 index 00000000..dd938c89 --- /dev/null +++ b/templates/devtest/tmplerr.tmpl @@ -0,0 +1,12 @@ +{{template "base/head" .}} +<div class="page-content devtest"> + <div class="tw-flex"> + <div class="tw-w-4/5"> + hello hello hello hello hello hello hello hello hello hello + </div> + <div class="tw-w-1/5"> + {{template "devtest/tmplerr-sub" .}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/explore/code.tmpl b/templates/explore/code.tmpl new file mode 100644 index 00000000..039933fa --- /dev/null +++ b/templates/explore/code.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content explore users"> + {{template "explore/navbar" .}} + <div class="ui container"> + {{template "shared/search/code/search" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/explore/navbar.tmpl b/templates/explore/navbar.tmpl new file mode 100644 index 00000000..8e619fa6 --- /dev/null +++ b/templates/explore/navbar.tmpl @@ -0,0 +1,20 @@ +<overflow-menu class="ui secondary pointing tabular top attached borderless menu secondary-nav"> + <div class="overflow-menu-items tw-justify-center"> + <a class="{{if .PageIsExploreRepositories}}active {{end}}item" href="{{AppSubUrl}}/explore/repos"> + {{svg "octicon-repo"}} {{ctx.Locale.Tr "explore.repos"}} + </a> + {{if not .UsersIsDisabled}} + <a class="{{if .PageIsExploreUsers}}active {{end}}item" href="{{AppSubUrl}}/explore/users"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "explore.users"}} + </a> + {{end}} + <a class="{{if .PageIsExploreOrganizations}}active {{end}}item" href="{{AppSubUrl}}/explore/organizations"> + {{svg "octicon-organization"}} {{ctx.Locale.Tr "explore.organizations"}} + </a> + {{if and (not $.UnitTypeCode.UnitGlobalDisabled) .IsRepoIndexerEnabled}} + <a class="{{if .PageIsExploreCode}}active {{end}}item" href="{{AppSubUrl}}/explore/code"> + {{svg "octicon-code"}} {{ctx.Locale.Tr "explore.code"}} + </a> + {{end}} + </div> +</overflow-menu> diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl new file mode 100644 index 00000000..59bc6c8a --- /dev/null +++ b/templates/explore/repo_list.tmpl @@ -0,0 +1,73 @@ +<div class="flex-list"> + {{range .Repos}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{template "repo/icon" .}} + </div> + <div class="flex-item-main"> + <div class="flex-item-header"> + <div class="flex-item-title"> + {{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}} + <a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/ + {{end}} + <a class="text primary name" href="{{.Link}}">{{.Name}}</a> + <span class="label-list"> + {{if .IsArchived}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span> + {{end}} + {{if .IsPrivate}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.private"}}</span> + {{else}} + {{if .Owner.Visibility.IsPrivate}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.internal"}}</span> + {{end}} + {{end}} + {{if .IsTemplate}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.template"}}</span> + {{end}} + {{if eq .ObjectFormatName "sha256"}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span> + {{end}} + </span> + </div> + <div class="flex-item-trailing muted-links"> + {{if .PrimaryLanguage}} + <a class="flex-text-inline" href="?q={{$.Keyword}}&sort={{$.SortType}}&language={{.PrimaryLanguage.Language}}{{if $.TabName}}&tab={{$.TabName}}{{end}}"> + <i class="color-icon tw-mr-2" style="background-color: {{.PrimaryLanguage.Color}}"></i> + {{.PrimaryLanguage.Language}} + </a> + {{end}} + {{if not $.DisableStars}} + <a class="flex-text-inline" href="{{.Link}}/stars" aria-label="{{ctx.Locale.TrN .NumStars "explore.stars_one" "explore.stars_few" .NumStars}}" {{if ge .NumStars 1000}}data-tooltip-content="{{.NumStars}}"{{end}}> + {{svg "octicon-star" 16}} + {{CountFmt .NumStars}} + </a> + {{end}} + {{if not $.DisableForks}} + <a class="flex-text-inline" href="{{.Link}}/forks" aria-label="{{ctx.Locale.TrN .NumForks "explore.forks_one" "explore.forks_few" .NumForks}}" {{if ge .NumForks 1000}}data-tooltip-content="{{.NumForks}}"{{end}}> + {{svg "octicon-git-branch" 16}} + {{CountFmt .NumForks}} + </a> + {{end}} + </div> + </div> + {{$description := .DescriptionHTML $.Context}} + {{if $description}} + <div class="flex-item-body">{{$description}}</div> + {{end}} + {{if .Topics}} + <div class="label-list"> + {{range .Topics}} + {{if ne . ""}}<a class="ui label" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic=1">{{.}}</a>{{end}} + {{end}} + </div> + {{end}} + <div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated" (TimeSinceUnix .UpdatedUnix ctx.Locale)}}</div> + </div> + </div> + {{else}} + <div> + {{ctx.Locale.Tr "search.no_results"}} + </div> + {{end}} +</div> diff --git a/templates/explore/repos.tmpl b/templates/explore/repos.tmpl new file mode 100644 index 00000000..53742bf0 --- /dev/null +++ b/templates/explore/repos.tmpl @@ -0,0 +1,10 @@ +{{template "base/head" .}} +<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 "base/paginate" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/explore/search.tmpl b/templates/explore/search.tmpl new file mode 100644 index 00000000..1d984a2e --- /dev/null +++ b/templates/explore/search.tmpl @@ -0,0 +1,23 @@ +<div class="ui small secondary filter menu tw-items-center tw-mx-0"> + <form class="ui form ignore-dirty tw-flex-1"> + {{if .PageIsExploreUsers}} + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.user_kind")}} + {{else}} + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.org_kind")}} + {{end}} + </form> + <!-- Sort --> + <div class="ui small dropdown type jump item tw-mr-0"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if eq .SortType "newest"}}active {{end}}item" href="?sort=newest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a class="{{if eq .SortType "oldest"}}active {{end}}item" href="?sort=oldest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="?sort=alphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?sort=reversealphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> + </div> + </div> +</div> +<div class="divider"></div> diff --git a/templates/explore/user_list.tmpl b/templates/explore/user_list.tmpl new file mode 100644 index 00000000..f2cf939f --- /dev/null +++ b/templates/explore/user_list.tmpl @@ -0,0 +1,33 @@ +<div class="flex-list"> + {{range .Users}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar . 48}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .}} + {{if .Visibility.IsPrivate}} + <span class="ui basic tiny label">{{ctx.Locale.Tr "repo.desc.private"}}</span> + {{end}} + </div> + <div class="flex-item-body"> + {{if .Location}} + <span class="flex-text-inline">{{svg "octicon-location"}}{{.Location}}</span> + {{end}} + {{if and .Email (or (and $.ShowUserEmail $.IsSigned (not .KeepEmailPrivate)) $.PageIsAdminUsers)}} + <span class="flex-text-inline"> + {{svg "octicon-mail"}} + <a href="mailto:{{.Email}}">{{.Email}}</a> + </span> + {{end}} + <span class="flex-text-inline">{{svg "octicon-calendar"}}{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix)}}</span> + </div> + </div> + </div> + {{else}} + <div class="flex-item"> + {{ctx.Locale.Tr "search.no_results"}} + </div> + {{end}} +</div> diff --git a/templates/explore/users.tmpl b/templates/explore/users.tmpl new file mode 100644 index 00000000..e9046125 --- /dev/null +++ b/templates/explore/users.tmpl @@ -0,0 +1,10 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content explore users"> + {{template "explore/navbar" .}} + <div class="ui container"> + {{template "explore/search" .}} + {{template "explore/user_list" .}} + {{template "base/paginate" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/home.tmpl b/templates/home.tmpl new file mode 100644 index 00000000..23b1feae --- /dev/null +++ b/templates/home.tmpl @@ -0,0 +1,51 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home"}}{{end}}" class="page-content home"> + <div class="tw-mb-8 tw-px-8"> + <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"> + {{AppDisplayName}} + </h1> + <h2>{{ctx.Locale.Tr "startpage.app_desc"}}</h2> + </div> + </div> + </div> + <div class="ui stackable middle very relaxed page grid"> + <div class="eight wide center column"> + <h1 class="hero ui icon header"> + {{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}} + </h1> + <p class="large"> + {{ctx.Locale.Tr "startpage.install_desc"}} + </p> + </div> + <div class="eight wide center column"> + <h1 class="hero ui icon header"> + {{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}} + </h1> + <p class="large"> + {{ctx.Locale.Tr "startpage.platform_desc"}} + </p> + </div> + </div> + <div class="ui stackable middle very relaxed page grid"> + <div class="eight wide center column"> + <h1 class="hero ui icon header"> + {{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}} + </h1> + <p class="large"> + {{ctx.Locale.Tr "startpage.lightweight_desc"}} + </p> + </div> + <div class="eight wide center column"> + <h1 class="hero ui icon header"> + {{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}} + </h1> + <p class="large"> + {{ctx.Locale.Tr "startpage.license_desc"}} + </p> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/install.tmpl b/templates/install.tmpl new file mode 100644 index 00000000..ae800df1 --- /dev/null +++ b/templates/install.tmpl @@ -0,0 +1,367 @@ +{{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"> + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "install.title"}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + + <form class="ui form" action="{{AppSubUrl}}/" method="post"> + <p class="tw-mt-0">{{ctx.Locale.Tr "install.docker_helper" "https://forgejo.org/docs/latest/admin/installation-docker/"}}</p> + + <!-- Database Settings --> + <h4 class="ui dividing header">{{ctx.Locale.Tr "install.db_title"}}</h4> + <p>{{ctx.Locale.Tr "install.require_db_desc"}}</p> + <div class="inline required field {{if .Err_DbType}}error{{end}}"> + <label>{{ctx.Locale.Tr "install.db_type"}}</label> + <div class="ui selection database type dropdown"> + <input type="hidden" id="db_type" name="db_type" value="{{.CurDbType}}"> + <div class="text">{{.CurDbType}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .DbTypeNames}} + <div class="item" data-value="{{.type}}">{{.name}}</div> + {{end}} + </div> + </div> + </div> + + <div class="tw-mt-4 tw-hidden" data-db-setting-for="common-host"> + <div class="inline required field {{if .Err_DbSetting}}error{{end}}"> + <label for="db_host">{{ctx.Locale.Tr "install.host"}}</label> + <input id="db_host" name="db_host" value="{{.db_host}}"> + </div> + <div class="inline required field {{if .Err_DbSetting}}error{{end}}"> + <label for="db_user">{{ctx.Locale.Tr "install.user"}}</label> + <input id="db_user" name="db_user" value="{{.db_user}}"> + </div> + <div class="inline required field {{if .Err_DbSetting}}error{{end}}"> + <label for="db_passwd">{{ctx.Locale.Tr "install.password"}}</label> + <input id="db_passwd" name="db_passwd" type="password" value="{{.db_passwd}}"> + </div> + <div class="inline required field {{if .Err_DbSetting}}error{{end}}"> + <label for="db_name">{{ctx.Locale.Tr "install.db_name"}}</label> + <input id="db_name" name="db_name" value="{{.db_name}}"> + </div> + </div> + + <div class="tw-mt-4 tw-hidden" data-db-setting-for="postgres"> + <div class="inline required field"> + <label>{{ctx.Locale.Tr "install.ssl_mode"}}</label> + <div class="ui selection database type dropdown"> + <input type="hidden" name="ssl_mode" value="{{if .ssl_mode}}{{.ssl_mode}}{{else}}disable{{end}}"> + <div class="default text">disable</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="disable">Disable</div> + <div class="item" data-value="require">Require</div> + <div class="item" data-value="verify-full">Verify Full</div> + </div> + </div> + </div> + <div class="inline field {{if .Err_DbSetting}}error{{end}}"> + <label for="db_schema">{{ctx.Locale.Tr "install.db_schema"}}</label> + <input id="db_schema" name="db_schema" value="{{.db_schema}}"> + <span class="help">{{ctx.Locale.Tr "install.db_schema_helper"}}</span> + </div> + </div> + + <div class="tw-mt-4 tw-hidden" data-db-setting-for="sqlite3"> + <div class="inline required field {{if or .Err_DbPath .Err_DbSetting}}error{{end}}"> + <label for="db_path">{{ctx.Locale.Tr "install.path"}}</label> + <input id="db_path" name="db_path" value="{{.db_path}}"> + <span class="help">{{ctx.Locale.Tr "install.sqlite_helper"}}</span> + </div> + </div> + + {{if .Err_DbInstalledBefore}} + <div> + <p class="reinstall-message">{{ctx.Locale.Tr "install.reinstall_confirm_message"}}</p> + <div class="reinstall-confirm"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.reinstall_confirm_check_1"}}</label> + <input name="reinstall_confirm_first" type="checkbox"> + </div> + </div> + <div class="reinstall-confirm"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.reinstall_confirm_check_2"}}</label> + <input name="reinstall_confirm_second" type="checkbox"> + </div> + </div> + <div class="reinstall-confirm"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.reinstall_confirm_check_3"}}</label> + <input name="reinstall_confirm_third" type="checkbox"> + </div> + </div> + </div> + {{end}} + + <!-- General Settings --> + <h4 class="ui dividing header">{{ctx.Locale.Tr "install.general_title"}}</h4> + <div class="inline required field {{if .Err_AppName}}error{{end}}"> + <label for="app_name">{{ctx.Locale.Tr "install.app_name"}}</label> + <input id="app_name" name="app_name" value="{{.app_name}}" required> + <span class="help">{{ctx.Locale.Tr "install.app_name_helper"}}</span> + </div> + <div class="inline field"> + <label for="app_slogan">{{ctx.Locale.Tr "install.app_slogan"}}</label> + <input id="app_slogan" name="app_slogan" value="{{.app_slogan}}"> + <span class="help">{{ctx.Locale.Tr "install.app_slogan_helper"}}</span> + </div> + <div class="inline required field {{if .Err_RepoRootPath}}error{{end}}"> + <label for="repo_root_path">{{ctx.Locale.Tr "install.repo_path"}}</label> + <input id="repo_root_path" name="repo_root_path" value="{{.repo_root_path}}" required> + <span class="help">{{ctx.Locale.Tr "install.repo_path_helper"}}</span> + </div> + <div class="inline field {{if .Err_LFSRootPath}}error{{end}}"> + <label for="lfs_root_path">{{ctx.Locale.Tr "install.lfs_path"}}</label> + <input id="lfs_root_path" name="lfs_root_path" value="{{.lfs_root_path}}"> + <span class="help">{{ctx.Locale.Tr "install.lfs_path_helper"}}</span> + </div> + <div class="inline required field {{if .Err_RunUser}}error{{end}}"> + <label for="run_user">{{ctx.Locale.Tr "install.run_user"}}</label> + <input id="run_user" name="run_user" value="{{.run_user}}" readonly> + <span class="help">{{ctx.Locale.Tr "install.run_user_helper"}}</span> + </div> + <div class="inline required field"> + <label for="domain">{{ctx.Locale.Tr "install.domain"}}</label> + <input id="domain" name="domain" value="{{.domain}}" placeholder="next.forgejo.org" required> + <span class="help">{{ctx.Locale.Tr "install.domain_helper"}}</span> + </div> + <div class="inline field"> + <label for="ssh_port">{{ctx.Locale.Tr "install.ssh_port"}}</label> + <input id="ssh_port" name="ssh_port" value="{{.ssh_port}}"> + <span class="help">{{ctx.Locale.Tr "install.ssh_port_helper"}}</span> + </div> + <div class="inline required field"> + <label for="http_port">{{ctx.Locale.Tr "install.http_port"}}</label> + <input id="http_port" name="http_port" value="{{.http_port}}" required> + <span class="help">{{ctx.Locale.Tr "install.http_port_helper"}}</span> + </div> + <div class="inline required field"> + <label for="app_url">{{ctx.Locale.Tr "install.app_url"}}</label> + <input id="app_url" name="app_url" value="{{.app_url}}" placeholder="https://next.forgejo.org" required> + <span class="help">{{ctx.Locale.Tr "install.app_url_helper"}}</span> + </div> + <div class="inline required field"> + <label for="log_root_path">{{ctx.Locale.Tr "install.log_root_path"}}</label> + <input id="log_root_path" name="log_root_path" value="{{.log_root_path}}" placeholder="log" required> + <span class="help">{{ctx.Locale.Tr "install.log_root_path_helper"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox" id="disable-registration"> + <label class="{{if .Err_DisabledRegistration}}text red{{end}}">{{ctx.Locale.Tr "install.disable_registration"}}</label> + <input name="disable_registration" type="checkbox" {{if .disable_registration}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.disable_registration.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.enable_update_checker"}}</label> + <input name="enable_update_checker" type="checkbox" {{if .enable_update_checker}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.enable_update_checker_helper_forgejo"}}</span> + </div> + + <!-- Optional Settings --> + <h4 class="ui dividing header">{{ctx.Locale.Tr "install.optional_title"}}</h4> + + <!-- Email --> + <details class="collapsible optional field"> + <summary class="tw-py-2{{if .Err_SMTP}} text red{{end}}"> + {{ctx.Locale.Tr "install.email_title"}} + </summary> + <div class="inline field"> + <label for="smtp_addr">{{ctx.Locale.Tr "install.smtp_addr"}}</label> + <input id="smtp_addr" name="smtp_addr" value="{{.smtp_addr}}"> + </div> + <div class="inline field"> + <label for="smtp_port">{{ctx.Locale.Tr "install.smtp_port"}}</label> + <input id="smtp_port" name="smtp_port" value="{{.smtp_port}}"> + </div> + <div class="inline field {{if .Err_SMTPFrom}}error{{end}}"> + <label for="smtp_from">{{ctx.Locale.Tr "install.smtp_from"}}</label> + <input id="smtp_from" name="smtp_from" value="{{.smtp_from}}"> + <span class="help">{{ctx.Locale.TrString "install.smtp_from_helper"}}{{/* it contains lt/gt chars*/}}</span> + </div> + <div class="inline field {{if .Err_SMTPUser}}error{{end}}"> + <label for="smtp_user">{{ctx.Locale.Tr "install.mailer_user"}}</label> + <input id="smtp_user" name="smtp_user" value="{{.smtp_user}}"> + </div> + <div class="inline field"> + <label for="smtp_passwd">{{ctx.Locale.Tr "install.mailer_password"}}</label> + <input id="smtp_passwd" name="smtp_passwd" type="password" value="{{.smtp_passwd}}"> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.register_confirm"}}</label> + <input name="register_confirm" type="checkbox" {{if .register_confirm}}checked{{end}}> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.mail_notify"}}</label> + <input name="mail_notify" type="checkbox" {{if .mail_notify}}checked{{end}}> + </div> + </div> + </details> + + <!-- Server and other services --> + <details class="collapsible optional field"> + <summary class="tw-py-2"> + {{ctx.Locale.Tr "install.server_service_title"}} + </summary> + <div class="inline field"> + <div class="ui checkbox" id="offline-mode"> + <label>{{ctx.Locale.Tr "install.offline_mode"}}</label> + <input name="offline_mode" type="checkbox" {{if .offline_mode}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.offline_mode.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox" id="disable-gravatar"> + <label>{{ctx.Locale.Tr "install.disable_gravatar"}}</label> + <input name="disable_gravatar" type="checkbox" {{if .disable_gravatar}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.disable_gravatar.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox" id="federated-avatar-lookup"> + <label>{{ctx.Locale.Tr "install.federated_avatar_lookup"}}</label> + <input name="enable_federated_avatar" type="checkbox" {{if .enable_federated_avatar}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.federated_avatar_lookup.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox" id="enable-openid-signin"> + <label>{{ctx.Locale.Tr "install.openid_signin"}}</label> + <input name="enable_open_id_sign_in" type="checkbox" {{if .enable_open_id_sign_in}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.openid_signin.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox" id="allow-only-external-registration"> + <label>{{ctx.Locale.Tr "install.allow_only_external_registration"}}</label> + <input name="allow_only_external_registration" type="checkbox" {{if .allow_only_external_registration}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.allow_only_external_registration.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox" id="enable-openid-signup"> + <label>{{ctx.Locale.Tr "install.openid_signup"}}</label> + <input name="enable_open_id_sign_up" type="checkbox" {{if .enable_open_id_sign_up}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.openid_signup.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox" id="enable-captcha"> + <label>{{ctx.Locale.Tr "install.enable_captcha"}}</label> + <input name="enable_captcha" type="checkbox" {{if .enable_captcha}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.enable_captcha.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.require_sign_in_view"}}</label> + <input name="require_sign_in_view" type="checkbox" {{if .require_sign_in_view}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.require_sign_in_view.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.default_keep_email_private"}}</label> + <input name="default_keep_email_private" type="checkbox" {{if .default_keep_email_private}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.default_keep_email_private.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.default_allow_create_organization"}}</label> + <input name="default_allow_create_organization" type="checkbox" {{if .default_allow_create_organization}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.default_allow_create_organization.description"}}</span> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "install.default_enable_timetracking"}}</label> + <input name="default_enable_timetracking" type="checkbox" {{if .default_enable_timetracking}}checked{{end}}> + </div> + <span class="help">{{ctx.Locale.Tr "install.default_enable_timetracking.description"}}</span> + </div> + <div class="inline field"> + <label for="no_reply_address">{{ctx.Locale.Tr "install.no_reply_address"}}</label> + <input id="_no_reply_address" name="no_reply_address" value="{{.no_reply_address}}"> + <span class="help">{{ctx.Locale.Tr "install.no_reply_address_helper"}}</span> + </div> + <div class="inline field"> + <label for="password_algorithm">{{ctx.Locale.Tr "install.password_algorithm"}}</label> + <div class="ui selection dropdown"> + <input id="password_algorithm" type="hidden" name="password_algorithm" value="{{.password_algorithm}}"> + <div class="text">{{.password_algorithm}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .PasswordHashAlgorithms}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + <span class="help">{{ctx.Locale.Tr "install.password_algorithm_helper"}}</span> + </div> + </details> + + <!-- Admin --> + <details class="collapsible optional field"> + <summary class="tw-py-2{{if .Err_Admin}} text red{{end}}"> + {{ctx.Locale.Tr "install.admin_title"}} + </summary> + <p class="center">{{ctx.Locale.Tr "install.admin_setting.description"}}</p> + <div class="inline field {{if .Err_AdminName}}error{{end}}"> + <label for="admin_name">{{ctx.Locale.Tr "install.admin_name"}}</label> + <input id="admin_name" name="admin_name" value="{{.admin_name}}"> + </div> + <div class="inline field {{if .Err_AdminEmail}}error{{end}}"> + <label for="admin_email">{{ctx.Locale.Tr "install.admin_email"}}</label> + <input id="admin_email" name="admin_email" type="email" value="{{.admin_email}}"> + </div> + <div class="inline field {{if .Err_AdminPasswd}}error{{end}}"> + <label for="admin_passwd">{{ctx.Locale.Tr "install.admin_password"}}</label> + <input id="admin_passwd" name="admin_passwd" type="password" autocomplete="new-password" value="{{.admin_passwd}}"> + </div> + <div class="inline field {{if .Err_AdminPasswd}}error{{end}}"> + <label for="admin_confirm_passwd">{{ctx.Locale.Tr "install.confirm_password"}}</label> + <input id="admin_confirm_passwd" name="admin_confirm_passwd" autocomplete="new-password" type="password" value="{{.admin_confirm_passwd}}"> + </div> + </details> + + <div class="divider"></div> + + {{if .EnvConfigKeys}} + <!-- Environment Config --> + <h4 class="ui dividing header">{{ctx.Locale.Tr "install.env_config_keys"}}</h4> + <div class="inline field"> + <div class="right-content"> + {{ctx.Locale.Tr "install.env_config_keys_prompt"}} + </div> + <div class="right-content tw-mt-2"> + {{range .EnvConfigKeys}}<span class="ui label">{{.}}</span>{{end}} + </div> + </div> + {{end}} + + <p>{{ctx.Locale.Tr "install.config_location_hint"}} {{.CustomConfFile}}</p> + <div class="inline field"> + <div class="tw-mt-4 tw-mb-2 tw-text-center"> + <button class="ui primary button">{{ctx.Locale.Tr "install.install_btn_confirm"}}</button> + </div> + </div> + </form> + </div> + </div> + </div> +</div> +<img class="tw-hidden" src="{{AssetUrlPrefix}}/img/forgejo-loading.svg" width="256" height="256"> +{{template "base/footer" .}} diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl new file mode 100644 index 00000000..eb7ea5a8 --- /dev/null +++ b/templates/mail/auth/activate.tmpl @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"> +</head> + +{{$activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}} +<body> + <p>{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName}}</p><br> + <p>{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br> + <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> + + <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> +</body> +</html> diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl new file mode 100644 index 00000000..9ca54d30 --- /dev/null +++ b/templates/mail/auth/activate_email.tmpl @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta Name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"> +</head> + +{{$activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}} +<body> + <p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape)}}</p><br> + <p>{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br> + <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> + + <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> +</body> +</html> diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/auth/register_notify.tmpl new file mode 100644 index 00000000..d3a668b0 --- /dev/null +++ b/templates/mail/auth/register_notify.tmpl @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"> +</head> + +{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}} +<body> + <p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape)}}</p><br> + <p>{{.locale.Tr "mail.register_notify.text_1" AppName}}</p><br> + <p>{{.locale.Tr "mail.register_notify.text_2" .Username}}</p><p><a href="{{AppUrl}}user/login">{{AppUrl}}user/login</a></p><br> + <p>{{.locale.Tr "mail.register_notify.text_3" $set_pwd_url}}</p><br> + + <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> +</body> +</html> diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl new file mode 100644 index 00000000..b85b770d --- /dev/null +++ b/templates/mail/auth/reset_passwd.tmpl @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"> +</head> + +{{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}} +<body> + <p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape)}}</p><br> + <p>{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br> + <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> + + <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> +</body> +</html> diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl new file mode 100644 index 00000000..f8ad62ae --- /dev/null +++ b/templates/mail/issue/assigned.tmpl @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html> +<head> + <style> + .footer { font-size:small; color:#666;} + </style> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +</head> + +{{$repo_url := HTMLFormat "<a href='%s'>%s</a>" .Issue.Repo.HTMLURL .Issue.Repo.FullName}} +{{$link := HTMLFormat "<a href='%s'>#%d</a>" .Link .Issue.Index}} +<body> + <p> + {{if .IsPull}} + {{.locale.Tr "mail.issue_assigned.pull" .Doer.Name $link $repo_url}} + {{else}} + {{.locale.Tr "mail.issue_assigned.issue" .Doer.Name $link $repo_url}} + {{end}} + </p> + <div class="footer"> + <p> + --- + <br> + <a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>. + </p> + </div> +</body> +</html> diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl new file mode 100644 index 00000000..a94a10e2 --- /dev/null +++ b/templates/mail/issue/default.tmpl @@ -0,0 +1,90 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + + <style> + blockquote { padding-left: 1em; margin: 1em 0; border-left: 1px solid grey; color: #777} + .footer { font-size:small; color:#666;} + {{if .ReviewComments}} + .review { padding-left: 1em; margin: 1em 0; } + .review > pre { padding: 1em; border-left: 1px solid grey; } + {{end}} + </style> + +</head> + +<body> + {{if .IsMention}}<p>{{.locale.Tr "mail.issue.x_mentioned_you" .Doer.Name}}</p>{{end}} + {{if eq .ActionName "push"}} + <p> + {{if .Comment.IsForcePush}} + {{$oldCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.HTMLURL .Comment.OldCommit}} + {{$oldShortSha := ShortSha .Comment.OldCommit}} + {{$oldCommitLink := HTMLFormat "<a href='%[1]s'><b>%[2]s</b></a>" $oldCommitUrl $oldShortSha}} + + {{$newCommitUrl := printf "%s/commit/%s" .Comment.Issue.PullRequest.BaseRepo.HTMLURL .Comment.NewCommit}} + {{$newShortSha := ShortSha .Comment.NewCommit}} + {{$newCommitLink := HTMLFormat "<a href='%[1]s'><b>%[2]s</b></a>" $newCommitUrl $newShortSha}} + + {{.locale.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink}} + {{else}} + {{.locale.TrN (len .Comment.Commits) "mail.issue.action.push_1" "mail.issue.action.push_n" .Doer.Name .Comment.Issue.PullRequest.HeadBranch (len .Comment.Commits)}} + {{end}} + </p> + {{end}} + <p> + {{if eq .ActionName "close"}} + {{.locale.Tr "mail.issue.action.close" .Doer.Name .Issue.Index}} + {{else if eq .ActionName "reopen"}} + {{.locale.Tr "mail.issue.action.reopen" .Doer.Name .Issue.Index}} + {{else if eq .ActionName "merge"}} + {{.locale.Tr "mail.issue.action.merge" .Doer.Name .Issue.Index .Issue.PullRequest.BaseBranch}} + {{else if eq .ActionName "approve"}} + {{.locale.Tr "mail.issue.action.approve" .Doer.Name}} + {{else if eq .ActionName "reject"}} + {{.locale.Tr "mail.issue.action.reject" .Doer.Name}} + {{else if eq .ActionName "review"}} + {{.locale.Tr "mail.issue.action.review" .Doer.Name}} + {{else if eq .ActionName "review_dismissed"}} + {{.locale.Tr "mail.issue.action.review_dismissed" .Doer.Name .Comment.Review.Reviewer.Name}} + {{else if eq .ActionName "ready_for_review"}} + {{.locale.Tr "mail.issue.action.ready_for_review" .Doer.Name}} + {{end}} + + {{- if eq .Body ""}} + {{if eq .ActionName "new"}} + {{.locale.Tr "mail.issue.action.new" .Doer.Name .Issue.Index}} + {{end}} + {{else}} + {{.Body}} + {{end -}} + {{- range .ReviewComments}} + <hr> + {{$.locale.Tr "mail.issue.in_tree_path" .TreePath}} + <div class="review"> + <pre>{{.Patch}}</pre> + <div>{{.RenderedContent}}</div> + </div> + {{end -}} + {{if eq .ActionName "push"}} + <ul> + {{range .Comment.Commits}} + <li> + <a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.ID}}"> + {{ShortSha .ID.String}} + </a> - {{.Summary}} + </li> + {{end}} + </ul> + {{end}} + </p> + <div class="footer"> + <p> + --- + <br> + <a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>{{if .CanReply}} {{.locale.Tr "mail.reply"}}{{end}}. + </p> + </div> +</body> +</html> diff --git a/templates/mail/notify/admin_new_user.tmpl b/templates/mail/notify/admin_new_user.tmpl new file mode 100644 index 00000000..655c7ce5 --- /dev/null +++ b/templates/mail/notify/admin_new_user.tmpl @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + + <style> + blockquote { padding-left: 1em; margin: 1em 0; border-left: 1px solid grey; color: #777} + .footer { font-size:small; color:#666;} + </style> + +</head> + +<body> + <ul> + <h3>{{.Locale.Tr "mail.admin.new_user.user_info"}}: <a href="{{.NewUserUrl}}">@{{.NewUser.Name}}</a></h3> + <li>{{.Locale.Tr "admin.users.created"}}: {{DateTime "full" .NewUser.CreatedUnix}}</li> + </ul> + <p> {{.Body | SanitizeHTML}} </p> +</body> +</html> diff --git a/templates/mail/notify/collaborator.tmpl b/templates/mail/notify/collaborator.tmpl new file mode 100644 index 00000000..6108d40e --- /dev/null +++ b/templates/mail/notify/collaborator.tmpl @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> + <style> + .footer { font-size:small; color:#666;} + </style> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +</head> + +<body> + <p>{{.locale.Tr "mail.repo.collaborator.added.text"}} <code>{{.RepoName}}</code></p> + <div class="footer"> + <p> + --- + <br> + <a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>. + </p> + </div> +</body> +</html> diff --git a/templates/mail/notify/repo_transfer.tmpl b/templates/mail/notify/repo_transfer.tmpl new file mode 100644 index 00000000..bc4c4b36 --- /dev/null +++ b/templates/mail/notify/repo_transfer.tmpl @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +</head> + +{{$url := HTMLFormat "<a href='%[1]s'>%[2]s</a>" .Link .Repo}} +<body> + <p>{{.Subject}}. + {{.locale.Tr "mail.repo.transfer.body" $url}} + </p> + <p> + --- + <br> + <a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>. + </p> +</body> +</html> diff --git a/templates/mail/release.tmpl b/templates/mail/release.tmpl new file mode 100644 index 00000000..8c01aec2 --- /dev/null +++ b/templates/mail/release.tmpl @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + + <style> + blockquote { padding-left: 1em; margin: 1em 0; border-left: 1px solid grey; color: #777} + .footer { font-size:small; color:#666;} + </style> + +</head> + +{{$release_url := HTMLFormat "<a href='%s'>%s</a>" .Release.HTMLURL .Release.TagName}} +{{$repo_url := HTMLFormat "<a href='%s'>%s</a>" .Release.Repo.HTMLURL .Release.Repo.FullName}} +<body> + <p> + {{.locale.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url}} + </p> + <h4>{{.locale.Tr "mail.release.title" .Release.Title}}</h4> + <p> + {{.locale.Tr "mail.release.note"}}<br> + {{- if eq .Release.RenderedNote ""}} + {{else}} + {{.Release.RenderedNote}} + {{end -}} + </p> + <br><br> + <p> + --- + <br> + {{.locale.Tr "mail.release.downloads"}} + <ul> + {{if not .DisableDownloadSourceArchives}} + <li> + <a href="{{.Release.Repo.Link}}/archive/{{.Release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{.locale.Tr "mail.release.download.zip"}}</strong></a> + </li> + <li> + <a href="{{.Release.Repo.Link}}/archive/{{.Release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{.locale.Tr "mail.release.download.targz"}}</strong></a> + </li> + {{end}} + {{if .Release.Attachments}} + {{range .Release.Attachments}} + <li> + <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}"> + <strong>{{.Name}} ({{.Size | $.locale.TrSize}})</strong> + </a> + </li> + {{end}} + {{end}} + </ul> + </p> + <div class="footer"> + <p> + --- + <br> + <a href="{{.Link}}">{{.locale.Tr "mail.view_it_on" AppName}}</a>. + </p> + </div> +</body> +</html> diff --git a/templates/mail/team_invite.tmpl b/templates/mail/team_invite.tmpl new file mode 100644 index 00000000..cb0c0c0a --- /dev/null +++ b/templates/mail/team_invite.tmpl @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no"> +</head> +<body> + <p>{{.locale.Tr "mail.team_invite.text_1" (DotEscape .Inviter.DisplayName) (DotEscape .Team.Name) (DotEscape .Organization.DisplayName)}}</p> + <p>{{.locale.Tr "mail.team_invite.text_2"}}</p><p><a href="{{.InviteURL}}">{{.InviteURL}}</a></p> + <p>{{.locale.Tr "mail.link_not_working_do_paste"}}</p> + <p>{{.locale.Tr "mail.team_invite.text_3" .Invite.Email}}</p> + + <p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p> +</body> +</html> diff --git a/templates/org/create.tmpl b/templates/org/create.tmpl new file mode 100644 index 00000000..92be4a0a --- /dev/null +++ b/templates/org/create.tmpl @@ -0,0 +1,57 @@ +{{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"> + {{.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 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> + </div> + + <div class="inline field" id="permission_box"> + <span class="inline field"><label>{{ctx.Locale.Tr "org.settings.permission"}}</label></span> + <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> + </div> + + <div class="inline field"> + <label></label> + <button class="ui primary button"> + {{ctx.Locale.Tr "org.create_org"}} + </button> + </div> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/follow_unfollow.tmpl b/templates/org/follow_unfollow.tmpl new file mode 100644 index 00000000..ba0bd01e --- /dev/null +++ b/templates/org/follow_unfollow.tmpl @@ -0,0 +1,7 @@ +<button class="ui basic button tw-mr-0" hx-post="{{.Org.HomeLink}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}"> + {{if $.IsFollowing}} + {{ctx.Locale.Tr "user.unfollow"}} + {{else}} + {{ctx.Locale.Tr "user.follow"}} + {{end}} +</button> diff --git a/templates/org/header.tmpl b/templates/org/header.tmpl new file mode 100644 index 00000000..494dedf6 --- /dev/null +++ b/templates/org/header.tmpl @@ -0,0 +1,37 @@ +<div class="ui container tw-flex"> + {{ctx.AvatarUtils.Avatar .Org 100 "org-avatar"}} + <div id="org-info" class="tw-flex tw-flex-col"> + <div class="ui header"> + <div class="org-title"> + {{.Org.DisplayName}} + <span class="org-visibility"> + {{if .Org.Visibility.IsLimited}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</span>{{end}} + {{if .Org.Visibility.IsPrivate}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</span>{{end}} + </span> + </div> + <span class="tw-flex tw-items-center button-row tw-ml-auto tw-text-16 tw-whitespace-nowrap"> + {{if .EnableFeed}} + <a class="ui basic label button tw-mr-0" href="{{.Org.HomeLink}}.rss" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}"> + {{svg "octicon-rss" 24}} + </a> + {{end}} + {{if .IsSigned}} + {{template "org/follow_unfollow" .}} + {{end}} + {{if .IsOrganizationMember}} + <a class="ui basic button tw-mr-0" href="{{.OrgLink}}/dashboard">{{ctx.Locale.Tr "org.open_dashboard"}}</a> + {{end}} + </span> + </div> + {{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}} + {{if .IsSigned}} + {{if .Org.Email}}<div class="flex-text-block">{{svg "octicon-mail"}} <a class="muted" href="mailto:{{.Org.Email}}">{{.Org.Email}}</a></div>{{end}} + {{end}} + </div> + </div> +</div> + +{{template "org/menu" .}} diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl new file mode 100644 index 00000000..e4d6b195 --- /dev/null +++ b/templates/org/home.tmpl @@ -0,0 +1,73 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization profile"> + {{if .Flash}} + <div class="ui container tw-mb-8"> + {{template "base/alert" .}} + </div> + {{end}} + {{template "org/header" .}} + + <div class="ui container"> + <div class="ui mobile reversed stackable grid"> + <div class="ui {{if .ShowMemberAndTeamTab}}eleven wide{{end}} column"> + {{if .ProfileReadme}} + <div id="readme_profile" class="markup">{{.ProfileReadme}}</div> + {{end}} + {{template "shared/repo_search" .}} + {{template "explore/repo_list" .}} + {{template "base/paginate" .}} + </div> + + {{if .ShowMemberAndTeamTab}} + <div class="ui five wide column"> + {{if .CanCreateOrgRepo}} + <div class="center aligned"> + <a class="ui primary button tw-mb-1" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{ctx.Locale.Tr "new_repo"}}</a> + {{if not .DisableNewPullMirrors}} + <a class="ui primary button tw-mb-1" href="{{AppSubUrl}}/repo/migrate?org={{.Org.ID}}&mirror=1">{{ctx.Locale.Tr "new_migrate"}}</a> + {{end}} + </div> + <div class="divider"></div> + {{end}} + {{if .NumMembers}} + <h4 class="ui top attached header tw-flex"> + <strong class="tw-flex-1">{{ctx.Locale.Tr "org.members"}}</strong> + <a class="text grey tw-flex tw-items-center" href="{{.OrgLink}}/members"><span>{{.NumMembers}}</span> {{svg "octicon-chevron-right"}}</a> + </h4> + <div class="ui attached segment members"> + {{$isMember := .IsOrganizationMember}} + {{range .Members}} + {{if or $isMember (call $.IsPublicMember .ID)}} + <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}">{{ctx.AvatarUtils.Avatar . 48}}</a> + {{end}} + {{end}} + </div> + {{end}} + {{if .IsOrganizationMember}} + <div class="ui top attached header tw-flex"> + <strong class="tw-flex-1">{{ctx.Locale.Tr "org.teams"}}</strong> + <a class="text grey tw-flex tw-items-center" href="{{.OrgLink}}/teams"><span>{{.Org.NumTeams}}</span> {{svg "octicon-chevron-right"}}</a> + </div> + <div class="ui attached table segment teams"> + {{range .Teams}} + <div class="item"> + <a href="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}"><strong class="team-name">{{.Name}}</strong></a> + <p class="text grey"> + <a class="muted" href="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}"><strong>{{.NumMembers}}</strong> {{ctx.Locale.Tr "org.lower_members"}}</a> · + <a class="muted" href="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}/repositories"><strong>{{.NumRepos}}</strong> {{ctx.Locale.Tr "org.lower_repositories"}}</a> + </p> + </div> + {{end}} + </div> + {{if .IsOrganizationOwner}} + <div class="ui bottom attached segment"> + <a class="ui primary small button" href="{{.OrgLink}}/teams/new">{{ctx.Locale.Tr "org.create_new_team"}}</a> + </div> + {{end}} + {{end}} + </div> + {{end}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl new file mode 100644 index 00000000..4388dc95 --- /dev/null +++ b/templates/org/member/members.tmpl @@ -0,0 +1,90 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization members"> + {{template "org/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + + <div class="flex-list"> + {{range .Members}} + {{$isPublic := index $.MembersIsPublicMember .ID}} + <div class="flex-item {{if $.PublicOnly}}tw-items-center{{end}}"> + <div class="flex-item-leading"> + <a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 48}}</a> + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .}} + {{if not $isPublic}} + <span class="ui basic tiny label">{{ctx.Locale.Tr "org.members.private"}}</span> + {{end}} + </div> + {{if not $.PublicOnly}} + <div class="flex-item-body"> + {{ctx.Locale.Tr "org.members.member_role"}} + <strong class="flex-text-inline">{{if index $.MembersIsUserOrgOwner .ID}}{{svg "octicon-shield-lock"}} {{ctx.Locale.Tr "org.members.owner"}}{{else}}{{ctx.Locale.Tr "org.members.member"}}{{end}}</strong> + </div> + {{if $.IsOrganizationOwner}} + <div class="flex-item-body"> + {{ctx.Locale.Tr "admin.users.2fa"}} + <strong> + {{if index $.MembersTwoFaStatus .ID}} + <span class="text green">{{svg "octicon-check"}}</span> + {{else}} + {{svg "octicon-x"}} + {{end}} + </strong> + </div> + {{end}} + {{end}} + </div> + <div class="flex-item-trailing"> + {{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}} + {{if $isPublic}} + <a class="ui tiny button link-action" href data-url="{{$.OrgLink}}/members/action/private?uid={{.ID}}">{{svg "octicon-eye-closed" 12 "icon"}}{{ctx.Locale.Tr "org.members.public_helper"}}</a> + {{else}} + <a class="ui tiny button link-action" href data-url="{{$.OrgLink}}/members/action/public?uid={{.ID}}">{{svg "octicon-eye" 12 "icon"}}{{ctx.Locale.Tr "org.members.private_helper"}}</a> + {{end}} + {{end}} + {{if eq $.SignedUser.ID .ID}} + <form> + <button class="ui red tiny button delete-button" data-modal-id="leave-organization" + data-url="{{$.OrgLink}}/members/action/leave" data-datauid="{{.ID}}" + data-name="{{.DisplayName}}" + data-data-organization-name="{{$.Org.DisplayName}}">{{ctx.Locale.Tr "org.members.leave"}}</button> + </form> + {{else if $.IsOrganizationOwner}} + <form> + <button class="ui red tiny button delete-button" data-modal-id="remove-organization-member" + data-url="{{$.OrgLink}}/members/action/remove" data-datauid="{{.ID}}" + data-name="{{.DisplayName}}" + data-data-organization-name="{{$.Org.DisplayName}}">{{ctx.Locale.Tr "org.members.remove"}}</button> + </form> + {{end}} + </div> + </div> + {{end}} + </div> + + {{template "base/paginate" .}} + </div> +</div> +<div class="ui g-modal-confirm delete modal" id="leave-organization"> + <div class="header"> + {{ctx.Locale.Tr "org.members.leave"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "org.members.leave.detail" (`<span class="dataOrganizationName"></span>`|SafeHTML)}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> +<div class="ui g-modal-confirm delete modal" id="remove-organization-member"> + <div class="header"> + {{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> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "base/footer" .}} diff --git a/templates/org/menu.tmpl b/templates/org/menu.tmpl new file mode 100644 index 00000000..21215499 --- /dev/null +++ b/templates/org/menu.tmpl @@ -0,0 +1,53 @@ +<div class="ui container"> + <overflow-menu class="ui secondary pointing tabular borderless menu tw-mb-4"> + <div class="overflow-menu-items"> + <a class="{{if .PageIsViewRepositories}}active {{end}}item" href="{{$.Org.HomeLink}}"> + {{svg "octicon-repo"}} {{ctx.Locale.Tr "user.repositories"}} + {{if .RepoCount}} + <div class="ui small label">{{.RepoCount}}</div> + {{end}} + <span hidden test-name="repository-count">{{.RepoCount}}</span> + </a> + {{if .CanReadProjects}} + <a class="{{if .PageIsViewProjects}}active {{end}}item" href="{{$.Org.HomeLink}}/-/projects"> + {{svg "octicon-project-symlink"}} {{ctx.Locale.Tr "user.projects"}} + {{if .ProjectCount}} + <div class="ui small label">{{.ProjectCount}}</div> + {{end}} + <span hidden test-name="project-count">{{.ProjectCount}}</span> + </a> + {{end}} + {{if and .IsPackageEnabled .CanReadPackages}} + <a class="{{if .IsPackagesPage}}active {{end}}item" href="{{$.Org.HomeLink}}/-/packages"> + {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} + {{if and .IsRepoIndexerEnabled .CanReadCode}} + <a class="{{if .IsCodePage}}active {{end}}item" href="{{$.Org.HomeLink}}/-/code"> + {{svg "octicon-code"}} {{ctx.Locale.Tr "org.code"}} + </a> + {{end}} + {{if .NumMembers}} + <a class="{{if $.PageIsOrgMembers}}active {{end}}item" href="{{$.OrgLink}}/members"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "org.members"}} + <div class="ui small label">{{.NumMembers}}</div> + </a> + {{end}} + <span hidden test-name="member-count">{{.NumMembers}}</span> + {{if .IsOrganizationMember}} + <a class="{{if $.PageIsOrgTeams}}active {{end}}item" href="{{$.OrgLink}}/teams"> + {{svg "octicon-people"}} {{ctx.Locale.Tr "org.teams"}} + {{if .NumTeams}} + <div class="ui small label">{{.NumTeams}}</div> + {{end}} + </a> + {{end}} + <span hidden test-name="team-count">{{.NumTeams}}</span> + {{if .IsOrganizationOwner}} + <a id="settings-btn" class="{{if .PageIsOrgSettings}}active {{end}}right item" href="{{.OrgLink}}/settings"> + {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} + </a> + {{end}} + </div> + </overflow-menu> +</div> diff --git a/templates/org/projects/list.tmpl b/templates/org/projects/list.tmpl new file mode 100644 index 00000000..80dde1c4 --- /dev/null +++ b/templates/org/projects/list.tmpl @@ -0,0 +1,24 @@ +{{template "base/head" .}} +{{if .ContextUser.IsOrganization}} + <div role="main" aria-label="{{.Title}}" class="page-content organization projects"> + {{template "org/header" .}} + <div class="ui container"> + {{template "projects/list" .}} + </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/list" .}} + </div> + </div> + </div> + </div> +{{end}} +{{template "base/footer" .}} diff --git a/templates/org/projects/new.tmpl b/templates/org/projects/new.tmpl new file mode 100644 index 00000000..fc52130f --- /dev/null +++ b/templates/org/projects/new.tmpl @@ -0,0 +1,9 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization projects edit-project new"> + {{template "shared/user/org_profile_avatar" .}} + <div class="ui container"> + {{template "user/overview/header" .}} + {{template "projects/new" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/projects/view.tmpl b/templates/org/projects/view.tmpl new file mode 100644 index 00000000..e1ab81c4 --- /dev/null +++ b/templates/org/projects/view.tmpl @@ -0,0 +1,11 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository projects view-project"> + {{template "shared/user/org_profile_avatar" .}} + <div class="ui container tw-mb-4"> + {{template "user/overview/header" .}} + </div> + <div class="ui container fluid padded"> + {{template "projects/view" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/settings/actions.tmpl b/templates/org/settings/actions.tmpl new file mode 100644 index 00000000..abb9c984 --- /dev/null +++ b/templates/org/settings/actions.tmpl @@ -0,0 +1,11 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings actions")}} + <div class="org-setting-content"> + {{if eq .PageType "runners"}} + {{template "shared/actions/runner_list" .}} + {{else if eq .PageType "secrets"}} + {{template "shared/secrets/add_list" .}} + {{else if eq .PageType "variables"}} + {{template "shared/variables/variable_list" .}} + {{end}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/applications.tmpl b/templates/org/settings/applications.tmpl new file mode 100644 index 00000000..df5f4e9d --- /dev/null +++ b/templates/org/settings/applications.tmpl @@ -0,0 +1,9 @@ +{{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 "settings.applications"}} + </h4> + + {{template "user/settings/applications_oauth2_list" .}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/applications_oauth2_edit.tmpl b/templates/org/settings/applications_oauth2_edit.tmpl new file mode 100644 index 00000000..987803ac --- /dev/null +++ b/templates/org/settings/applications_oauth2_edit.tmpl @@ -0,0 +1,5 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings options")}} + <div class="org-setting-content"> + {{template "user/settings/applications_oauth2_edit_form" .}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/blocked_users.tmpl b/templates/org/settings/blocked_users.tmpl new file mode 100644 index 00000000..f685a1b9 --- /dev/null +++ b/templates/org/settings/blocked_users.tmpl @@ -0,0 +1,21 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings blocked-users")}} +<div class="org-setting-content"> + <div class="ui attached segment"> + <form class="ui form ignore-dirty tw-flex tw-flex-wrap tw-gap-2" action="{{$.Link}}/block" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="uid" value=""> + <div class="ui left"> + <div id="search-user-box" class="ui search"> + <div class="ui input"> + <input class="prompt" name="uname" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" required> + </div> + </div> + </div> + <button type="submit" class="ui red button">{{ctx.Locale.Tr "user.block"}}</button> + </form> + </div> + <div class="ui attached segment"> + {{template "shared/blocked_users_list" .}} + </div> +</div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/delete.tmpl b/templates/org/settings/delete.tmpl new file mode 100644 index 00000000..e1ef471e --- /dev/null +++ b/templates/org/settings/delete.tmpl @@ -0,0 +1,35 @@ +{{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/hook_new.tmpl b/templates/org/settings/hook_new.tmpl new file mode 100644 index 00000000..f89ee5f2 --- /dev/null +++ b/templates/org/settings/hook_new.tmpl @@ -0,0 +1,7 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings new webhook")}} + <div class="org-setting-content"> + {{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}} + {{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}} + {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/hooks.tmpl b/templates/org/settings/hooks.tmpl new file mode 100644 index 00000000..9f307968 --- /dev/null +++ b/templates/org/settings/hooks.tmpl @@ -0,0 +1,5 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings webhooks")}} + <div class="org-setting-content"> + {{template "repo/settings/webhook/list" .}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/labels.tmpl b/templates/org/settings/labels.tmpl new file mode 100644 index 00000000..25a562c9 --- /dev/null +++ b/templates/org/settings/labels.tmpl @@ -0,0 +1,15 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings labels")}} + <div class="org-setting-content"> + <div class="tw-flex tw-items-center"> + <div class="tw-flex-1"> + {{ctx.Locale.Tr "org.settings.labels_desc"}} + </div> + <button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button> + </div> + <div class="divider"></div> + {{template "repo/issue/labels/label_new" .}} + {{template "repo/issue/labels/label_list" .}} + </div> +{{template "repo/issue/labels/edit_delete_label" .}} +{{template "org/settings/layout_footer" .}} + diff --git a/templates/org/settings/layout_footer.tmpl b/templates/org/settings/layout_footer.tmpl new file mode 100644 index 00000000..09d88c0c --- /dev/null +++ b/templates/org/settings/layout_footer.tmpl @@ -0,0 +1,11 @@ +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} +<div class="page-content"> + <div class="org-layout-right"> + <div> + {{/* block: org-setting-content */}} +{{end}} + + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/settings/layout_head.tmpl b/templates/org/settings/layout_head.tmpl new file mode 100644 index 00000000..31dad2c1 --- /dev/null +++ b/templates/org/settings/layout_head.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .ctxData}} +<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}"> + {{template "org/header" .ctxData}} + <div class="ui container flex-container"> + {{template "org/settings/navbar" .ctxData}} + <div class="flex-container-main"> + {{template "base/alert" .ctxData}} + {{/* block: org-setting-content */}} + +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} + </div> + </div> +</div> +{{end}} diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl new file mode 100644 index 00000000..b2457682 --- /dev/null +++ b/templates/org/settings/navbar.tmpl @@ -0,0 +1,48 @@ +<div class="flex-container-nav"> + <div class="ui fluid vertical menu"> + <div class="header item">{{ctx.Locale.Tr "org.settings"}}</div> + <a class="{{if .PageIsSettingsOptions}}active {{end}}item" href="{{.OrgLink}}/settings"> + {{ctx.Locale.Tr "org.settings.options"}} + </a> + {{if not DisableWebhooks}} + <a class="{{if .PageIsSettingsHooks}}active {{end}}item" href="{{.OrgLink}}/settings/hooks"> + {{ctx.Locale.Tr "repo.settings.hooks"}} + </a> + {{end}} + <a class="{{if .PageIsOrgSettingsLabels}}active {{end}}item" href="{{.OrgLink}}/settings/labels"> + {{ctx.Locale.Tr "repo.labels"}} + </a> + {{if .EnableOAuth2}} + <a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{.OrgLink}}/settings/applications"> + {{ctx.Locale.Tr "settings.applications"}} + </a> + {{end}} + {{if .EnablePackages}} + <a class="{{if .PageIsSettingsPackages}}active {{end}}item" href="{{.OrgLink}}/settings/packages"> + {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} + {{if .EnableActions}} + <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables}}open{{end}}> + <summary>{{ctx.Locale.Tr "actions.actions"}}</summary> + <div class="menu"> + <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{.OrgLink}}/settings/actions/runners"> + {{ctx.Locale.Tr "actions.runners"}} + </a> + <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{.OrgLink}}/settings/actions/secrets"> + {{ctx.Locale.Tr "secrets.secrets"}} + </a> + <a class="{{if .PageIsSharedSettingsVariables}}active {{end}}item" href="{{.OrgLink}}/settings/actions/variables"> + {{ctx.Locale.Tr "actions.variables"}} + </a> + </div> + </details> + {{end}} + <a class="{{if .PageIsSettingsBlockedUsers}}active {{end}}item" href="{{.OrgLink}}/settings/blocked_users"> + {{ctx.Locale.Tr "settings.blocked_users"}} + </a> + <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 new file mode 100644 index 00000000..62debfc0 --- /dev/null +++ b/templates/org/settings/options.tmpl @@ -0,0 +1,102 @@ +{{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}}"> + <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="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> + + {{if .SignedUser.IsAdmin}} + <div class="divider"></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}} + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "org.settings.update_settings"}}</button> + </div> + </form> + + <div class="divider"></div> + + <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label> + <input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp"> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button> + <button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button> + </div> + </form> + </div> + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/packages.tmpl b/templates/org/settings/packages.tmpl new file mode 100644 index 00000000..91106c3f --- /dev/null +++ b/templates/org/settings/packages.tmpl @@ -0,0 +1,6 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings packages")}} + <div class="org-setting-content"> + {{template "package/shared/cleanup_rules/list" .}} + {{template "package/shared/cargo" .}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/packages_cleanup_rules_edit.tmpl b/templates/org/settings/packages_cleanup_rules_edit.tmpl new file mode 100644 index 00000000..ff4c2dd6 --- /dev/null +++ b/templates/org/settings/packages_cleanup_rules_edit.tmpl @@ -0,0 +1,5 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings packages")}} + <div class="org-setting-content"> + {{template "package/shared/cleanup_rules/edit" .}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/packages_cleanup_rules_preview.tmpl b/templates/org/settings/packages_cleanup_rules_preview.tmpl new file mode 100644 index 00000000..5a2f0612 --- /dev/null +++ b/templates/org/settings/packages_cleanup_rules_preview.tmpl @@ -0,0 +1,5 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings packages")}} + <div class="org-setting-content"> + {{template "package/shared/cleanup_rules/preview" .}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/runners_edit.tmpl b/templates/org/settings/runners_edit.tmpl new file mode 100644 index 00000000..acd67a4d --- /dev/null +++ b/templates/org/settings/runners_edit.tmpl @@ -0,0 +1,5 @@ +{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings runners")}} + <div class="org-setting-content"> + {{template "shared/actions/runner_edit" .}} + </div> +{{template "org/settings/layout_footer" .}} diff --git a/templates/org/team/invite.tmpl b/templates/org/team/invite.tmpl new file mode 100644 index 00000000..1167828d --- /dev/null +++ b/templates/org/team/invite.tmpl @@ -0,0 +1,23 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization invite"> + <div class="ui container"> + {{template "base/alert" .}} + <div class="ui centered card"> + <div class="image"> + {{ctx.AvatarUtils.Avatar .Organization 140}} + </div> + <div class="content"> + <div class="header">{{ctx.Locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name}}</div> + <div class="meta">{{ctx.Locale.Tr "org.teams.invite.by" .Inviter.Name}}</div> + <div class="description">{{ctx.Locale.Tr "org.teams.invite.description"}}</div> + </div> + <div class="extra content"> + <form class="ui form" action="" method="post"> + {{.CsrfTokenHtml}} + <button class="fluid ui primary button">{{ctx.Locale.Tr "org.teams.join"}}</button> + </form> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl new file mode 100644 index 00000000..7e9a59a6 --- /dev/null +++ b/templates/org/team/members.tmpl @@ -0,0 +1,88 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization teams"> + {{template "org/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <div class="ui stackable grid"> + {{template "org/team/sidebar" .}} + <div class="ui ten wide column"> + {{template "org/team/navbar" .}} + {{if .IsOrganizationOwner}} + <div class="ui attached segment"> + <form class="ui form ignore-dirty tw-flex tw-flex-wrap tw-gap-2" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/add" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="uid" value="{{.SignedUser.ID}}"> + <div id="search-user-box" class="ui search tw-mr-2"{{if .IsEmailInviteEnabled}} data-allow-email="true" data-allow-email-description="{{ctx.Locale.Tr "org.teams.invite_team_member" $.Team.Name}}"{{end}}> + <div class="ui input"> + <input class="prompt" name="uname" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" required> + </div> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "org.teams.add_team_member"}}</button> + </form> + </div> + {{end}} + <div class="ui attached segment"> + <div class="flex-list"> + {{range .Team.Members}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + <a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a> + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .}} + </div> + </div> + <div class="flex-item-trailing"> + {{if and $.IsOrganizationOwner (not (and ($.Team.IsOwnerTeam) (eq (len $.Team.Members) 1)))}} + <form> + <button class="ui red button delete-button" data-modal-id="remove-team-member" + data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/remove" data-datauid="{{.ID}}" + data-name="{{.DisplayName}}" + data-data-team-name="{{$.Team.Name}}">{{ctx.Locale.Tr "org.members.remove"}}</button> + </form> + {{end}} + </div> + </div> + {{else}} + <div class="flex-item"> + <span class="text grey tw-italic">{{ctx.Locale.Tr "org.teams.members.none"}}</span> + </div> + {{end}} + </div> + </div> + {{if and .Invites $.IsOrganizationOwner}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "org.teams.invite_team_member.list"}}</h4> + <div class="ui attached segment"> + <div class="flex-list"> + {{range .Invites}} + <div class="flex-item tw-items-center"> + <div class="flex-item-main"> + {{.Email}} + </div> + <div class="flex-item-trailing"> + <form action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/remove_invite" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="iid" value="{{.ID}}"> + <button class="ui red button">{{ctx.Locale.Tr "org.members.remove"}}</button> + </form> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + </div> + </div> + </div> +</div> +<div class="ui g-modal-confirm delete modal" id="remove-team-member"> + <div class="header"> + {{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> + </div> + {{template "base/modal_actions_confirm" .}} +</div> +{{template "base/footer" .}} diff --git a/templates/org/team/navbar.tmpl b/templates/org/team/navbar.tmpl new file mode 100644 index 00000000..8f2571e1 --- /dev/null +++ b/templates/org/team/navbar.tmpl @@ -0,0 +1,4 @@ +<div class="ui top attached tabular menu org-team-navbar"> + <a class="item{{if .PageIsOrgTeamMembers}} active{{end}}" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}">{{svg "octicon-person"}} <strong>{{.Team.NumMembers}}</strong> {{ctx.Locale.Tr "org.lower_members"}}</a> + <a class="item{{if .PageIsOrgTeamRepos}} active{{end}}" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/repositories">{{svg "octicon-repo"}} <strong>{{.Team.NumRepos}}</strong> {{ctx.Locale.Tr "org.lower_repositories"}}</a> +</div> diff --git a/templates/org/team/new.tmpl b/templates/org/team/new.tmpl new file mode 100644 index 00000000..9608eac1 --- /dev/null +++ b/templates/org/team/new.tmpl @@ -0,0 +1,161 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization new team"> + {{template "org/header" .}} + <div class="ui container"> + <div class="ui grid"> + <div class="column"> + <form class="ui form" action="{{if .PageIsOrgTeamsNew}}{{.OrgLink}}/teams/new{{else}}{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit{{end}}" data-delete-url="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/delete" method="post"> + {{.CsrfTokenHtml}} + <h3 class="ui top attached header"> + {{if .PageIsOrgTeamsNew}}{{ctx.Locale.Tr "org.create_new_team"}}{{else}}{{ctx.Locale.Tr "org.teams.settings"}}{{end}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <div class="required field {{if .Err_TeamName}}error{{end}}"> + <label for="team_name">{{ctx.Locale.Tr "org.team_name"}}</label> + {{if eq .Team.LowerName "owners"}} + <input type="hidden" name="team_name" value="{{.Team.Name}}"> + {{end}} + <input id="team_name" name="team_name" value="{{.Team.Name}}" required {{if eq .Team.LowerName "owners"}}disabled{{end}} autofocus> + <span class="help">{{ctx.Locale.Tr "org.team_name_helper"}}</span> + </div> + <div class="field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "org.team_desc"}}</label> + <input id="description" name="description" value="{{.Team.Description}}"> + <span class="help">{{ctx.Locale.Tr "org.team_desc_helper"}}</span> + </div> + {{if not (eq .Team.LowerName "owners")}} + <div class="grouped field"> + <label>{{ctx.Locale.Tr "org.team_access_desc"}}</label> + <br> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" name="repo_access" value="specific" {{if not .Team.IncludesAllRepositories}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.teams.specific_repositories"}}</label> + <span class="help">{{ctx.Locale.Tr "org.teams.specific_repositories_helper"}}</span> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" name="repo_access" value="all" {{if .Team.IncludesAllRepositories}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.teams.all_repositories"}}</label> + <span class="help">{{ctx.Locale.Tr "org.teams.all_repositories_helper"}}</span> + </div> + </div> + + <div class="field"> + <div class="ui checkbox"> + <label for="can_create_org_repo">{{ctx.Locale.Tr "org.teams.can_create_org_repo"}}</label> + <input id="can_create_org_repo" name="can_create_org_repo" type="checkbox" {{if .Team.CanCreateOrgRepo}}checked{{end}}> + <span class="help">{{ctx.Locale.Tr "org.teams.can_create_org_repo_helper"}}</span> + </div> + </div> + </div> + <div class="grouped field"> + <label>{{ctx.Locale.Tr "org.team_permission_desc"}}</label> + <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}}> + <label>{{ctx.Locale.Tr "org.teams.general_access"}}</label> + <span class="help">{{ctx.Locale.Tr "org.teams.general_access_helper"}}</span> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" name="permission" value="admin" {{if eq .Team.AccessMode 3}}checked{{end}}> + <label>{{ctx.Locale.Tr "org.teams.admin_access"}}</label> + <span class="help">{{ctx.Locale.Tr "org.teams.admin_access_helper"}}</span> + </div> + </div> + </div> + <div class="divider"></div> + + <div class="team-units required grouped field {{if eq .Team.AccessMode 3}}tw-hidden{{end}}"> + <label>{{ctx.Locale.Tr "org.team_unit_desc"}}</label> + <table class="ui celled table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "units.unit"}}</th> + <th class="center aligned">{{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"}} + <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"}} + <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> + <tbody> + {{range $t, $unit := $.Units}} + {{if ge $unit.MaxPerm 2}} + <tr> + <td> + <div {{if $unit.Type.UnitGlobalDisabled}}class="field" data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{- else -}}class="field"{{end}}> + <div> + <label>{{ctx.Locale.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{ctx.Locale.Tr "org.team_unit_disabled"}}{{end}}</label> + <span class="help">{{ctx.Locale.Tr $unit.DescKey}}</span> + </div> + </div> + </td> + <td class="center aligned"> + <div class="ui radio checkbox"> + <input type="radio" name="unit_{{$unit.Type.Value}}" value="0"{{if or ($unit.Type.UnitGlobalDisabled) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 0)}} checked{{end}} title="{{ctx.Locale.Tr "org.teams.none_access"}}"> + </div> + </td> + <td class="center aligned"> + <div class="ui radio checkbox"> + <input type="radio" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $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"> + <div class="ui radio checkbox"> + <input type="radio" name="unit_{{$unit.Type.Value}}" value="2"{{if (ge ($.Team.UnitAccessMode $.Context $unit.Type) 2)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}} title="{{ctx.Locale.Tr "org.teams.write_access"}}"> + </div> + </td> + </tr> + {{end}} + {{end}} + </tbody> + </table> + {{range $t, $unit := $.Units}} + {{if lt $unit.MaxPerm 2}} + <div {{if $unit.Type.UnitGlobalDisabled}}class="field" data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{else}}class="field"{{end}}> + <div class="ui checkbox"> + <input type="checkbox" name="unit_{{$unit.Type.Value}}" value="1"{{if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 1)}} checked{{end}} {{if $unit.Type.UnitGlobalDisabled}}disabled{{end}}> + <label>{{ctx.Locale.Tr $unit.NameKey}}{{if $unit.Type.UnitGlobalDisabled}} {{ctx.Locale.Tr "org.team_unit_disabled"}}{{end}}</label> + <span class="help">{{ctx.Locale.Tr $unit.DescKey}}</span> + </div> + </div> + {{end}} + {{end}} + </div> + {{end}} + + <div class="field"> + {{if .PageIsOrgTeamsNew}} + <button class="ui primary button">{{ctx.Locale.Tr "org.create_team"}}</button> + {{else}} + <button class="ui primary button">{{ctx.Locale.Tr "org.teams.update_settings"}}</button> + {{if not (eq .Team.LowerName "owners")}} + <button class="ui red button delete-button" data-url="{{.OrgLink}}/teams/{{.Team.Name | PathEscape}}/delete">{{ctx.Locale.Tr "org.teams.delete_team"}}</button> + {{end}} + {{end}} + </div> + </div> + </form> + </div> + </div> + </div> +</div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "org.teams.delete_team_title"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "org.teams.delete_team_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> +{{template "base/footer" .}} diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl new file mode 100644 index 00000000..f5d68ce4 --- /dev/null +++ b/templates/org/team/repositories.tmpl @@ -0,0 +1,61 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization teams"> + {{template "org/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <div class="ui stackable grid"> + {{template "org/team/sidebar" .}} + <div class="ui ten wide column"> + {{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"> + <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"> + <div class="ui input"> + <input class="prompt" name="repo_name" placeholder="{{ctx.Locale.Tr "search.repo_kind"}}" autocomplete="off" required> + </div> + </div> + <button class="ui primary button tw-ml-2">{{ctx.Locale.Tr "add"}}</button> + </form> + <div class="tw-inline-block"> + <button class="ui primary button link-action" data-modal-confirm="{{ctx.Locale.Tr "org.teams.add_all_repos_desc"}}" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/addall">{{ctx.Locale.Tr "add_all"}}</button> + <button class="ui red button link-action" data-modal-confirm="{{ctx.Locale.Tr "org.teams.remove_all_repos_desc"}}" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/removeall">{{ctx.Locale.Tr "remove_all"}}</button> + </div> + </div> + {{end}} + <div class="ui attached segment"> + <div class="flex-list"> + {{range .Team.Repos}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{template "repo/icon" .}} + </div> + <div class="flex-item-main"> + <a class="flex-item-title text primary" href="{{$.Org.HomeLink}}/{{.Name | PathEscape}}"> + {{$.Org.Name}}/{{.Name}} + </a> + </div> + <div class="flex-item-trailing"> + {{if $canAddRemove}} + <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/remove"> + {{$.CsrfTokenHtml}} + <button type="submit" class="ui red small button" name="repoid" value="{{.ID}}">{{ctx.Locale.Tr "remove"}}</button> + </form> + {{end}} + </div> + </div> + {{else}} + <div class="flex-item"> + <span class="text grey tw-italic">{{ctx.Locale.Tr "org.teams.repos.none"}}</span> + </div> + {{end}} + </div> + </div> + </div> + </div> + </div> +</div> + +{{template "base/footer" .}} diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl new file mode 100644 index 00000000..c9f80259 --- /dev/null +++ b/templates/org/team/sidebar.tmpl @@ -0,0 +1,94 @@ +<div class="ui six wide column"> + <h4 class="ui top attached header"> + <strong>{{.Team.Name}}</strong> + <div class="ui right"> + {{if .Team.IsMember ctx $.SignedUser.ID}} + <form> + <button class="ui red tiny button delete-button" data-modal-id="leave-team-sidebar" + data-url="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/action/leave" data-datauid="{{$.SignedUser.ID}}" + data-name="{{.Team.Name}}">{{ctx.Locale.Tr "org.teams.leave"}}</button> + </form> + {{else if .IsOrganizationOwner}} + <form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/action/join"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="page" value="team"> + <button type="submit" class="ui primary tiny button" name="uid" value="{{$.SignedUser.ID}}">{{ctx.Locale.Tr "org.teams.join"}}</button> + </form> + {{end}} + </div> + </h4> + <div class="ui attached table segment detail"> + <div class="item"> + {{if .Team.Description}} + {{.Team.Description}} + {{else}} + <span class="text grey tw-italic">{{ctx.Locale.Tr "org.teams.no_desc"}}</span> + {{end}} + </div> + {{if eq .Team.LowerName "owners"}} + <div class="item"> + {{ctx.Locale.Tr "org.teams.owners_permission_desc"}} + </div> + {{else}} + <div class="item"> + <h3>{{ctx.Locale.Tr "org.team_access_desc"}}</h3> + <ul> + {{if .Team.IncludesAllRepositories}} + <li>{{ctx.Locale.Tr "org.teams.all_repositories"}}</li> + {{else}} + <li>{{ctx.Locale.Tr "org.teams.specific_repositories"}}</li> + {{end}} + {{if .Team.CanCreateOrgRepo}} + <li>{{ctx.Locale.Tr "org.teams.can_create_org_repo"}}</li> + {{end}} + </ul> + {{if (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)}} + <h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3> + {{ctx.Locale.Tr "org.teams.admin_permission_desc"}} + {{else}} + <table class="ui table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "units.unit"}}</th> + <th>{{ctx.Locale.Tr "org.team_permission_desc"}}</th> + </tr> + </thead> + <tbody> + {{range $t, $unit := $.Units}} + {{if (not $unit.Type.UnitGlobalDisabled)}} + <tr> + <td><strong>{{ctx.Locale.Tr $unit.NameKey}}</strong></td> + <td>{{if eq ($.Team.UnitAccessMode $.Context $unit.Type) 0 -}} + {{ctx.Locale.Tr "org.teams.none_access"}} + {{- else if or (eq $.Team.ID 0) (eq ($.Team.UnitAccessMode $.Context $unit.Type) 1) -}} + {{ctx.Locale.Tr "org.teams.read_access"}} + {{- else if eq ($.Team.UnitAccessMode $.Context $unit.Type) 2 -}} + {{ctx.Locale.Tr "org.teams.write_access"}} + {{- end}}</td> + </tr> + {{end}} + {{end}} + </tbody> + </table> + {{end}} + </div> + {{end}} + </div> + {{if .IsOrganizationOwner}} + <div class="ui bottom attached segment"> + <a class="ui teal small button" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit">{{svg "octicon-gear"}} {{ctx.Locale.Tr "org.teams.settings"}}</a> + </div> + {{end}} +</div> +<div class="ui g-modal-confirm delete modal" id="leave-team-sidebar"> + <div class="header"> + {{ctx.Locale.Tr "org.teams.leave"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "org.teams.leave.detail" (`<span class="name"></span>`|SafeHTML)}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl new file mode 100644 index 00000000..53c909ee --- /dev/null +++ b/templates/org/team/teams.tmpl @@ -0,0 +1,56 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content organization teams"> + {{template "org/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{if .IsOrganizationOwner}} + <div class="text right"> + <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> + {{end}} + + <div class="ui two column stackable grid"> + {{range .Teams}} + <div class="column"> + <div class="ui top attached header"> + <a class="text black" href="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}"><strong>{{.Name}}</strong></a> + <div class="ui right"> + <a class="ui primary tiny button" href="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}">{{ctx.Locale.Tr "view"}}</a> + {{if .IsMember ctx $.SignedUser.ID}} + <form> + <button class="ui red tiny button delete-button" data-modal-id="leave-team" + data-url="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}/action/leave" data-datauid="{{$.SignedUser.ID}}" + data-name="{{.Name}}">{{ctx.Locale.Tr "org.teams.leave"}}</button> + </form> + {{else if $.IsOrganizationOwner}} + <form method="post" action="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}/action/join"> + {{$.CsrfTokenHtml}} + <button type="submit" class="ui primary tiny button" name="uid" value="{{$.SignedUser.ID}}">{{ctx.Locale.Tr "org.teams.join"}}</button> + </form> + {{end}} + </div> + </div> + <div class="ui attached segment members"> + {{range .Members}} + {{template "shared/user/avatarlink" dict "user" .}} + {{end}} + </div> + <div class="ui bottom attached header"> + <p class="team-meta"><a class="muted" href="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}">{{.NumMembers}} {{ctx.Locale.Tr "org.lower_members"}}</a> · <a class="muted" href="{{$.OrgLink}}/teams/{{.LowerName | PathEscape}}/repositories">{{.NumRepos}} {{ctx.Locale.Tr "org.lower_repositories"}}</a></p> + </div> + </div> + {{end}} + </div> + </div> +</div> +<div class="ui g-modal-confirm delete modal" id="leave-team"> + <div class="header"> + {{ctx.Locale.Tr "org.teams.leave"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "org.teams.leave.detail" (`<span class="name"></span>`|SafeHTML)}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> +{{template "base/footer" .}} diff --git a/templates/package/content/alpine.tmpl b/templates/package/content/alpine.tmpl new file mode 100644 index 00000000..8914006f --- /dev/null +++ b/templates/package/content/alpine.tmpl @@ -0,0 +1,52 @@ +{{if eq .PackageDescriptor.Package.Type "alpine"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.alpine.registry"}}</label> + <div class="markup"><pre class="code-block"><code><origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/alpine"></origin-url>/$branch/$repository</code></pre></div> + <p>{{ctx.Locale.Tr "packages.alpine.registry.info"}}</p> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.alpine.registry.key"}}</label> + <div class="markup"><pre class="code-block"><code>curl -JO <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/alpine/key"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.alpine.install"}}</label> + <div class="markup"> + <pre class="code-block"><code>sudo apk add {{$.PackageDescriptor.Package.Name}}={{$.PackageDescriptor.Version.Version}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Alpine" "https://forgejo.org/docs/latest/user/packages/alpine/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.alpine.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.branches"}}</h5></td> + <td>{{StringUtils.Join .Branches ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.repositories"}}</h5></td> + <td>{{StringUtils.Join .Repositories ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.alpine.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/cargo.tmpl b/templates/package/content/cargo.tmpl new file mode 100644 index 00000000..2f14945d --- /dev/null +++ b/templates/package/content/cargo.tmpl @@ -0,0 +1,63 @@ +{{if eq .PackageDescriptor.Package.Type "cargo"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.cargo.registry"}}</label> + <div class="markup"><pre class="code-block"><code>[registry] +default = "forgejo" + +[registries.forgejo] +index = "sparse+<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cargo/"></origin-url>" # Sparse index +# index = "<origin-url data-url="{{AppSubUrl}}/{{.PackageDescriptor.Owner.Name}}/_cargo-index.git"></origin-url>" # Git + +[net] +git-fetch-with-cli = true</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.cargo.install"}}</label> + <div class="markup"><pre class="code-block"><code>cargo add {{.PackageDescriptor.Package.Name}}@{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Cargo" "https://forgejo.org/docs/latest/user/packages/cargo/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="six wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{.Req}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/chef.tmpl b/templates/package/content/chef.tmpl new file mode 100644 index 00000000..d39164b9 --- /dev/null +++ b/templates/package/content/chef.tmpl @@ -0,0 +1,48 @@ +{{if eq .PackageDescriptor.Package.Type "chef"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.chef.registry"}}</label> + <div class="markup"><pre class="code-block"><code>knife[:supermarket_site] = '<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/chef"></origin-url>'</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.chef.install"}}</label> + <div class="markup"><pre class="code-block"><code>knife supermarket install {{.PackageDescriptor.Package.Name}} {{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Chef" "https://forgejo.org/docs/latest/user/packages/chef/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.LongDescription}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}<p>{{.PackageDescriptor.Metadata.Description}}</p>{{end}} + {{if .PackageDescriptor.Metadata.LongDescription}}{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}}{{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/composer.tmpl b/templates/package/content/composer.tmpl new file mode 100644 index 00000000..73ab3ac7 --- /dev/null +++ b/templates/package/content/composer.tmpl @@ -0,0 +1,50 @@ +{{if eq .PackageDescriptor.Package.Type "composer"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.composer.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{ + "repositories": [{ + "type": "composer", + "url": "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/composer"></origin-url>" + } + ] +}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.composer.install"}}</label> + <div class="markup"><pre class="code-block"><code>composer require {{.PackageDescriptor.Package.Name}}:{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Composer" "https://forgejo.org/docs/latest/user/packages/composer/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Comments}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Comments}}<div class="ui attached segment">{{StringUtils.Join .PackageDescriptor.Metadata.Comments " "}}</div>{{end}} + {{end}} + + {{if or .PackageDescriptor.Metadata.Require .PackageDescriptor.Metadata.RequireDev}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/composer_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.Require "title" (ctx.Locale.Tr "packages.composer.dependencies")}} + {{template "package/content/composer_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.RequireDev "title" (ctx.Locale.Tr "packages.composer.dependencies.development")}} + </div> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/composer_dependencies.tmpl b/templates/package/content/composer_dependencies.tmpl new file mode 100644 index 00000000..dba45750 --- /dev/null +++ b/templates/package/content/composer_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/conan.tmpl b/templates/package/content/conan.tmpl new file mode 100644 index 00000000..8ebc258e --- /dev/null +++ b/templates/package/content/conan.tmpl @@ -0,0 +1,34 @@ +{{if eq .PackageDescriptor.Package.Type "conan"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conan.registry"}}</label> + <div class="markup"><pre class="code-block"><code>conan remote add forgejo <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conan"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conan.install"}}</label> + <div class="markup"><pre class="code-block"><code>conan install --remote=forgejo {{.PackageDescriptor.Package.Name}}/{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Conan" "https://forgejo.org/docs/latest/user/packages/conan/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/conda.tmpl b/templates/package/content/conda.tmpl new file mode 100644 index 00000000..5ff79445 --- /dev/null +++ b/templates/package/content/conda.tmpl @@ -0,0 +1,30 @@ +{{if eq .PackageDescriptor.Package.Type "conda"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.conda.registry"}}</label> + <div class="markup"><pre class="code-block"><code>channel_alias: <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url> +channels: +  - <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url> +default_channels: +  - <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/conda"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.conda.install"}}</label> + {{$channel := .PackageDescriptor.PackageProperties.GetByName "conda.channel"}} + <div class="markup"><pre class="code-block"><code>conda install{{if $channel}} -c {{$channel}}{{end}} {{.PackageDescriptor.PackageProperties.GetByName "conda.name"}}={{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Conda" "https://forgejo.org/docs/latest/user/packages/conda/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Summary}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{else}}{{.PackageDescriptor.Metadata.Summary}}{{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl new file mode 100644 index 00000000..b5fdcfeb --- /dev/null +++ b/templates/package/content/container.tmpl @@ -0,0 +1,90 @@ +{{if eq .PackageDescriptor.Package.Type "container"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.container.pull"}}</label> + {{if eq .PackageDescriptor.Metadata.Type "helm"}} + <div class="markup"><pre class="code-block"><code>helm pull oci://{{.RegistryHost}}/{{.PackageDescriptor.Owner.LowerName}}/{{.PackageDescriptor.Package.LowerName}} --version {{.PackageDescriptor.Version.LowerVersion}}</code></pre></div> + {{else}} + {{$separator := ":"}} + {{if not .PackageDescriptor.Metadata.IsTagged}} + {{$separator = "@"}} + {{end}} + <div class="markup"><pre class="code-block"><code>docker pull {{.RegistryHost}}/{{.PackageDescriptor.Owner.LowerName}}/{{.PackageDescriptor.Package.LowerName}}{{$separator}}{{.PackageDescriptor.Version.LowerVersion}}</code></pre></div> + {{end}} + </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> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Container" "https://forgejo.org/docs/latest/user/packages/container/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Manifests}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.multi_arch"}}</h4> + <div class="ui attached segment"> + <table class="ui very basic compact table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "packages.container.digest"}}</th> + <th>{{ctx.Locale.Tr "packages.container.multi_arch"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.size"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Manifests}} + <tr> + <td><a href="{{$.PackageDescriptor.PackageWebLink}}/{{PathEscape .Digest}}">{{.Digest}}</a></td> + <td>{{.Platform}}</td> + <td>{{ctx.Locale.TrSize .Size}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.ImageLayers}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.container.layers"}}</h4> + <div class="ui attached segment tw-break-anywhere"> + <table class="ui very basic compact table"> + <tbody> + {{range .PackageDescriptor.Metadata.ImageLayers}} + <tr> + <td>{{.}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + {{if .PackageDescriptor.Metadata.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"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "packages.container.labels.key"}}</th> + <th>{{ctx.Locale.Tr "packages.container.labels.value"}}</th> + </tr> + </thead> + <tbody> + {{range $key, $value := .PackageDescriptor.Metadata.Labels}} + <tr> + <td class="top aligned">{{$key}}</td> + <td class="tw-break-anywhere">{{$value}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/cran.tmpl b/templates/package/content/cran.tmpl new file mode 100644 index 00000000..df7a48c3 --- /dev/null +++ b/templates/package/content/cran.tmpl @@ -0,0 +1,59 @@ +{{if eq .PackageDescriptor.Package.Type "cran"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.cran.registry"}}</label> + <div class="markup"><pre class="code-block"><code>options("repos" = c(getOption("repos"), c(forgejo="<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/cran"></origin-url>")))</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.cran.install"}}</label> + <div class="markup"><pre class="code-block"><code>install.packages("{{.PackageDescriptor.Package.Name}}")</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "CRAN" "https://forgejo.org/docs/latest/user/packages/cran/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Title}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Title}}{{else}}{{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Imports .PackageDescriptor.Metadata.Depends .PackageDescriptor.Metadata.LinkingTo .PackageDescriptor.Metadata.Suggests}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + {{if .PackageDescriptor.Metadata.Imports}} + <tr> + <td>Imports</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Imports ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.Depends}} + <tr> + <td>Depends</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Depends ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.LinkingTo}} + <tr> + <td>LinkingTo</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.LinkingTo ", "}}</td> + </tr> + {{end}} + {{if .PackageDescriptor.Metadata.Suggests}} + <tr> + <td>Suggests</td> + <td>{{StringUtils.Join .PackageDescriptor.Metadata.Suggests ", "}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/debian.tmpl b/templates/package/content/debian.tmpl new file mode 100644 index 00000000..782ac1c8 --- /dev/null +++ b/templates/package/content/debian.tmpl @@ -0,0 +1,65 @@ +{{if eq .PackageDescriptor.Package.Type "debian"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.debian.registry"}}</label> + <div class="markup"><pre class="code-block"><code>sudo curl <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/debian/repository.key"></origin-url> -o /etc/apt/keyrings/forgejo-{{$.PackageDescriptor.Owner.Name}}.asc +echo "deb [signed-by=/etc/apt/keyrings/forgejo-{{$.PackageDescriptor.Owner.Name}}.asc] <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/debian"></origin-url> $distribution $component" | sudo tee -a /etc/apt/sources.list.d/forgejo.list +sudo apt update</code></pre></div> + <p>{{ctx.Locale.Tr "packages.debian.registry.info"}}</p> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.debian.install"}}</label> + <div class="markup"> + <pre class="code-block"><code>sudo apt install {{$.PackageDescriptor.Package.Name}}={{$.PackageDescriptor.Version.Version}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Debian" "https://forgejo.org/docs/latest/user/packages/debian/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.debian.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.distributions"}}</h5></td> + <td>{{StringUtils.Join .Distributions ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.components"}}</h5></td> + <td>{{StringUtils.Join .Components ", "}}</td> + </tr> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.debian.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/generic.tmpl b/templates/package/content/generic.tmpl new file mode 100644 index 00000000..4ebfb910 --- /dev/null +++ b/templates/package/content/generic.tmpl @@ -0,0 +1,18 @@ +{{if eq .PackageDescriptor.Package.Type "generic"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.generic.download"}}</label> + <div class="markup"><pre class="code-block"><code> +{{- range .PackageDescriptor.Files -}} +curl -OJ <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/generic/{{$.PackageDescriptor.Package.Name}}/{{$.PackageDescriptor.Version.Version}}/{{.File.Name}}"></origin-url> +{{end -}} + </code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Generic" "https://forgejo.org/docs/latest/user/packages/generic/"}}</label> + </div> + </div> + </div> +{{end}} diff --git a/templates/package/content/go.tmpl b/templates/package/content/go.tmpl new file mode 100644 index 00000000..5e32ea7f --- /dev/null +++ b/templates/package/content/go.tmpl @@ -0,0 +1,14 @@ +{{if eq .PackageDescriptor.Package.Type "go"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.go.install"}}</label> + <div class="markup"><pre class="code-block"><code>GOPROXY=<origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/go"></origin-url> go install {{$.PackageDescriptor.Package.Name}}@{{$.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Go" "https://forgejo.org/docs/latest/user/packages/go/"}}</label> + </div> + </div> + </div> +{{end}} diff --git a/templates/package/content/helm.tmpl b/templates/package/content/helm.tmpl new file mode 100644 index 00000000..9d855559 --- /dev/null +++ b/templates/package/content/helm.tmpl @@ -0,0 +1,57 @@ +{{if eq .PackageDescriptor.Package.Type "helm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.helm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>helm repo add {{AppDomain}} <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/helm"></origin-url> +helm repo update</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.helm.install"}}</label> + <div class="markup"><pre class="code-block"><code>helm install {{.PackageDescriptor.Package.Name}} {{AppDomain}}/{{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Helm" "https://forgejo.org/docs/latest/user/packages/helm/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="six wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .PackageDescriptor.Metadata.Dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{.Version}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/maven.tmpl b/templates/package/content/maven.tmpl new file mode 100644 index 00000000..7f7e3faf --- /dev/null +++ b/templates/package/content/maven.tmpl @@ -0,0 +1,75 @@ +{{if eq .PackageDescriptor.Package.Type "maven"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.registry"}}</label> + <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> + </repository> +</repositories> + +<distributionManagement> + <repository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </repository> + + <snapshotRepository> + <id>gitea</id> + <url><origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url></url> + </snapshotRepository> +</distributionManagement></code></pre></div> + </div> + {{if .PackageDescriptor.Metadata}} + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.install"}}</label> + <div class="markup"><pre class="code-block"><code><dependency> + <groupId>{{.PackageDescriptor.Metadata.GroupID}}</groupId> + <artifactId>{{.PackageDescriptor.Metadata.ArtifactID}}</artifactId> + <version>{{.PackageDescriptor.Version.Version}}</version> +</dependency></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.install2"}}</label> + <div class="markup"><pre class="code-block"><code>mvn install</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.download"}}</label> + <div class="markup"><pre class="code-block"><code>mvn dependency:get -DremoteRepositories=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url> -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Maven" "https://forgejo.org/docs/latest/user/packages/maven/"}}</label> + </div> + {{end}} + </div> + </div> + + {{if .PackageDescriptor.Metadata}} + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{.PackageDescriptor.Metadata.Description}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{range .PackageDescriptor.Metadata.Dependencies}} + <div class="item"> + <i class="icon">{{svg "octicon-package-dependencies" 16 ""}}</i> + <div class="content"> + <div class="header">{{.GroupID}}:{{.ArtifactID}}</div> + <div class="description text small">{{.Version}}</div> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + {{end}} +{{end}} diff --git a/templates/package/content/npm.tmpl b/templates/package/content/npm.tmpl new file mode 100644 index 00000000..1ffbd199 --- /dev/null +++ b/templates/package/content/npm.tmpl @@ -0,0 +1,65 @@ +{{if eq .PackageDescriptor.Package.Type "npm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.npm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{{if .PackageDescriptor.Metadata.Scope}}{{.PackageDescriptor.Metadata.Scope}}:{{end}}registry=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/npm/"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.npm.install"}}</label> + <div class="markup"><pre class="code-block"><code>npm install {{.PackageDescriptor.Package.Name}}@{{.PackageDescriptor.Version.Version}}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.npm.install2"}}</label> + <div class="markup"><pre class="code-block"><code>"{{.PackageDescriptor.Package.Name}}": "{{.PackageDescriptor.Version.Version}}"</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "npm" "https://forgejo.org/docs/latest/user/packages/npm/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Readme}} + <div class="markup markdown"> + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}} + </div> + {{else if .PackageDescriptor.Metadata.Description}} + {{.PackageDescriptor.Metadata.Description}} + {{end}} + </div> + {{end}} + + {{if or .PackageDescriptor.Metadata.Dependencies .PackageDescriptor.Metadata.DevelopmentDependencies .PackageDescriptor.Metadata.PeerDependencies .PackageDescriptor.Metadata.OptionalDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.Dependencies "title" (ctx.Locale.Tr "packages.npm.dependencies")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.development")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.PeerDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.peer")}} + {{template "package/content/npm_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.OptionalDependencies "title" (ctx.Locale.Tr "packages.npm.dependencies.optional")}} + </div> + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.BundleDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.npm.dependencies.bundle"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.BundleDependencies}} + {{.}} + {{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/npm_dependencies.tmpl b/templates/package/content/npm_dependencies.tmpl new file mode 100644 index 00000000..dba45750 --- /dev/null +++ b/templates/package/content/npm_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range $dependency, $version := .dependencies}} + <tr> + <td>{{$dependency}}</td> + <td>{{$version}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/nuget.tmpl b/templates/package/content/nuget.tmpl new file mode 100644 index 00000000..ea665c7b --- /dev/null +++ b/templates/package/content/nuget.tmpl @@ -0,0 +1,51 @@ +{{if eq .PackageDescriptor.Package.Type "nuget"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.nuget.registry"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet nuget add source --name {{.PackageDescriptor.Owner.Name}} --username your_username --password your_token <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/nuget/index.json"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.nuget.install"}}</label> + <div class="markup"><pre class="code-block"><code>dotnet add package --source {{.PackageDescriptor.Owner.Name}} --version {{.PackageDescriptor.Version.Version}} {{.PackageDescriptor.Package.Name}}</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "NuGet" "https://forgejo.org/docs/latest/user/packages/nuget/"}}</label> + </div> + </div> + </div> + + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.ReleaseNotes .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment markup markdown">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ReleaseNotes}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.ReleaseNotes}}</div>{{end}} + {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <thead> + <tr> + <th class="ten wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="three wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + <th class="three wide">{{ctx.Locale.Tr "packages.nuget.dependency.framework"}}</th> + </tr> + </thead> + <tbody> + {{range $framework, $dependencies := .PackageDescriptor.Metadata.Dependencies}} + {{range $dependencies}} + <tr> + <td>{{.ID}}</td> + <td>{{.Version}}</td> + <td>{{$framework}}</td> + </tr> + {{end}} + {{end}} + </tbody> + </table> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/pub.tmpl b/templates/package/content/pub.tmpl new file mode 100644 index 00000000..8448b974 --- /dev/null +++ b/templates/package/content/pub.tmpl @@ -0,0 +1,19 @@ +{{if eq .PackageDescriptor.Package.Type "pub"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.pub.install"}}</label> + <div class="markup"><pre class="code-block"><code>dart pub add {{.PackageDescriptor.Package.Name}}:{{.PackageDescriptor.Version.Version}} --hosted-url=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/pub/"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Pub" "https://forgejo.org/docs/latest/user/packages/pub/"}}</label> + </div> + </div> + </div> + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Readme}}<div class="ui attached segment">{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/content/pypi.tmpl b/templates/package/content/pypi.tmpl new file mode 100644 index 00000000..6addac3f --- /dev/null +++ b/templates/package/content/pypi.tmpl @@ -0,0 +1,31 @@ +{{if eq .PackageDescriptor.Package.Type "pypi"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <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> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "PyPI" "https://forgejo.org/docs/latest/user/packages/pypi/"}}</label> + </div> + </div> + </div> + {{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.LongDescription .PackageDescriptor.Metadata.Summary}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + <p>{{if .PackageDescriptor.Metadata.Summary}}{{.PackageDescriptor.Metadata.Summary}}{{end}}</p> + {{if .PackageDescriptor.Metadata.LongDescription}} + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}} + {{else if .PackageDescriptor.Metadata.Description}} + {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}} + {{end}} + </div> + {{end}} + {{if .PackageDescriptor.Metadata.RequiresPython}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{ctx.Locale.Tr "packages.pypi.requires"}}: {{.PackageDescriptor.Metadata.RequiresPython}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/rpm.tmpl b/templates/package/content/rpm.tmpl new file mode 100644 index 00000000..f5d56623 --- /dev/null +++ b/templates/package/content/rpm.tmpl @@ -0,0 +1,56 @@ +{{if eq .PackageDescriptor.Package.Type "rpm"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rpm.registry"}}</label> + <div class="markup"><pre class="code-block"><code>{{- if gt (len .Groups) 1 -}} +# {{ctx.Locale.Tr "packages.rpm.repository.multiple_groups"}} + +{{end -}} +# {{ctx.Locale.Tr "packages.rpm.distros.redhat"}} +{{- range $group := .Groups}} + {{- if $group}}{{$group = print "/" $group}}{{end}} +dnf config-manager --add-repo <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/rpm{{$group}}.repo"></origin-url> +{{- end}} + +# {{ctx.Locale.Tr "packages.rpm.distros.suse"}} +{{- range $group := .Groups}} + {{- if $group}}{{$group = print "/" $group}}{{end}} +zypper addrepo <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/rpm{{$group}}.repo"></origin-url> +{{- end}}</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rpm.install"}}</label> + <div class="markup"> + <pre class="code-block"><code># {{ctx.Locale.Tr "packages.rpm.distros.redhat"}} +dnf install {{$.PackageDescriptor.Package.Name}} + +# {{ctx.Locale.Tr "packages.rpm.distros.suse"}} +zypper install {{$.PackageDescriptor.Package.Name}}</code></pre> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "RPM" "https://forgejo.org/docs/latest/user/packages/rpm/"}}</label> + </div> + </div> + </div> + + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.rpm.repository"}}</h4> + <div class="ui attached segment"> + <table class="ui single line very basic table"> + <tbody> + <tr> + <td class="collapsing"><h5>{{ctx.Locale.Tr "packages.rpm.repository.architectures"}}</h5></td> + <td>{{StringUtils.Join .Architectures ", "}}</td> + </tr> + </tbody> + </table> + </div> + + {{if or .PackageDescriptor.Metadata.Summary .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + {{if .PackageDescriptor.Metadata.Summary}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Summary}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Description}}<div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/content/rubygems.tmpl b/templates/package/content/rubygems.tmpl new file mode 100644 index 00000000..009fd703 --- /dev/null +++ b/templates/package/content/rubygems.tmpl @@ -0,0 +1,40 @@ +{{if eq .PackageDescriptor.Package.Type "rubygems"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.rubygems.install"}}:</label> + <div class="markup"><pre class="code-block"><code>gem install {{.PackageDescriptor.Package.Name}} --version "{{.PackageDescriptor.Version.Version}}" --source "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems"></origin-url>"</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.rubygems.install2"}}:</label> + <div class="markup"><pre class="code-block"><code>source "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/rubygems"></origin-url>" do + gem "{{.PackageDescriptor.Package.Name}}", "{{.PackageDescriptor.Version.Version}}" +end</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "RubyGems" "https://forgejo.org/docs/latest/user/packages/rubygems/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div> + {{end}} + {{if or .PackageDescriptor.Metadata.RequiredRubyVersion .PackageDescriptor.Metadata.RequiredRubygemsVersion}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.requirements"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.RequiredRubyVersion}}<p>{{ctx.Locale.Tr "packages.rubygems.required.ruby"}}: {{range $i, $v := .PackageDescriptor.Metadata.RequiredRubyVersion}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</p>{{end}} + {{if .PackageDescriptor.Metadata.RequiredRubygemsVersion}}<p>{{ctx.Locale.Tr "packages.rubygems.required.rubygems"}}: {{range $i, $v := .PackageDescriptor.Metadata.RequiredRubygemsVersion}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</p>{{end}} + </div> + {{end}} + {{if or .PackageDescriptor.Metadata.RuntimeDependencies .PackageDescriptor.Metadata.DevelopmentDependencies}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4> + <div class="ui attached segment"> + <div class="ui list"> + {{template "package/content/rubygems_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.RuntimeDependencies "title" (ctx.Locale.Tr "packages.rubygems.dependencies.runtime")}} + {{template "package/content/rubygems_dependencies" dict "root" $ "dependencies" .PackageDescriptor.Metadata.DevelopmentDependencies "title" (ctx.Locale.Tr "packages.rubygems.dependencies.development")}} + </div> + </div> + {{end}} +{{end}} diff --git a/templates/package/content/rubygems_dependencies.tmpl b/templates/package/content/rubygems_dependencies.tmpl new file mode 100644 index 00000000..2c42dcea --- /dev/null +++ b/templates/package/content/rubygems_dependencies.tmpl @@ -0,0 +1,19 @@ +{{if .dependencies}} +<p><strong>{{.title}}</strong></p> +<table class="ui single line very basic table"> + <thead> + <tr> + <th class="eleven wide">{{ctx.Locale.Tr "packages.dependency.id"}}</th> + <th class="five wide">{{ctx.Locale.Tr "packages.dependency.version"}}</th> + </tr> + </thead> + <tbody> + {{range .dependencies}} + <tr> + <td>{{.Name}}</td> + <td>{{range $i, $v := .Version}}{{if gt $i 0}}, {{end}}{{$v.Restriction}}{{$v.Version}}{{end}}</td> + </tr> + {{end}} + </tbody> +</table> +{{end}} diff --git a/templates/package/content/swift.tmpl b/templates/package/content/swift.tmpl new file mode 100644 index 00000000..68db4448 --- /dev/null +++ b/templates/package/content/swift.tmpl @@ -0,0 +1,40 @@ +{{if eq .PackageDescriptor.Package.Type "swift"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.swift.registry"}}</label> + <div class="markup"><pre class="code-block"><code>swift package-registry set <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/swift"></origin-url></code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.swift.install"}}</label> + <div class="markup"><pre class="code-block"><code>dependencies: [ + .package(id: "{{.PackageDescriptor.Package.Name}}", from:"{{.PackageDescriptor.Version.Version}}") +]</code></pre></div> + </div> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.swift.install2"}}</label> + <div class="markup"><pre class="code-block"><code>swift package resolve</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Swift" "https://forgejo.org/docs/latest/user/packages/swift/"}}</label> + </div> + </div> + </div> + + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment"> + {{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}{{end}} + </div> + {{end}} + + {{if .PackageDescriptor.Metadata.Keywords}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.keywords"}}</h4> + <div class="ui attached segment"> + {{range .PackageDescriptor.Metadata.Keywords}} + {{.}} + {{end}} + </div> + {{end}} +{{end}} diff --git a/templates/package/content/vagrant.tmpl b/templates/package/content/vagrant.tmpl new file mode 100644 index 00000000..4dc3e62a --- /dev/null +++ b/templates/package/content/vagrant.tmpl @@ -0,0 +1,18 @@ +{{if eq .PackageDescriptor.Package.Type "vagrant"}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.vagrant.install"}}</label> + <div class="markup"><pre class="code-block"><code>vagrant box add --box-version {{.PackageDescriptor.Version.Version}} "<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/vagrant/{{.PackageDescriptor.Package.Name}}"></origin-url>"</code></pre></div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Vagrant" "https://forgejo.org/docs/latest/user/packages/vagrant/"}}</label> + </div> + </div> + </div> + {{if .PackageDescriptor.Metadata.Description}} + <h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4> + <div class="ui attached segment">{{.PackageDescriptor.Metadata.Description}}</div> + {{end}} +{{end}} diff --git a/templates/package/metadata/alpine.tmpl b/templates/package/metadata/alpine.tmpl new file mode 100644 index 00000000..3e7f10f6 --- /dev/null +++ b/templates/package/metadata/alpine.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "alpine"}} + {{if .PackageDescriptor.Metadata.Maintainer}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.PackageDescriptor.Metadata.Maintainer}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/cargo.tmpl b/templates/package/metadata/cargo.tmpl new file mode 100644 index 00000000..5ad3c20a --- /dev/null +++ b/templates/package/metadata/cargo.tmpl @@ -0,0 +1,7 @@ +{{if eq .PackageDescriptor.Package.Type "cargo"}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/chef.tmpl b/templates/package/metadata/chef.tmpl new file mode 100644 index 00000000..23a9ce3e --- /dev/null +++ b/templates/package/metadata/chef.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "chef"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/composer.tmpl b/templates/package/metadata/composer.tmpl new file mode 100644 index 00000000..0f6ff9d6 --- /dev/null +++ b/templates/package/metadata/composer.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "composer"}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.Name}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Homepage}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.Homepage}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{range .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/conan.tmpl b/templates/package/metadata/conan.tmpl new file mode 100644 index 00000000..4e05ec25 --- /dev/null +++ b/templates/package/metadata/conan.tmpl @@ -0,0 +1,6 @@ +{{if eq .PackageDescriptor.Package.Type "conan"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/conda.tmpl b/templates/package/metadata/conda.tmpl new file mode 100644 index 00000000..3628686e --- /dev/null +++ b/templates/package/metadata/conda.tmpl @@ -0,0 +1,6 @@ +{{if eq .PackageDescriptor.Package.Type "conda"}} + {{if .PackageDescriptor.Metadata.License}}<div class="item">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/container.tmpl b/templates/package/metadata/container.tmpl new file mode 100644 index 00000000..f5abb7ef --- /dev/null +++ b/templates/package/metadata/container.tmpl @@ -0,0 +1,9 @@ +{{if eq .PackageDescriptor.Package.Type "container"}} + <div class="item" title="{{ctx.Locale.Tr "packages.container.details.type"}}">{{svg "octicon-package" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Type.Name}}</div> + {{if .PackageDescriptor.Metadata.Platform}}<div class="item" title="{{ctx.Locale.Tr "packages.container.details.platform"}}">{{svg "octicon-cpu" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Platform}}</div>{{end}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Licenses}}<div class="item">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Licenses}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/cran.tmpl b/templates/package/metadata/cran.tmpl new file mode 100644 index 00000000..1d5a11e1 --- /dev/null +++ b/templates/package/metadata/cran.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "cran"}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "mr-3"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.}}</div>{{end}} + {{range .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/debian.tmpl b/templates/package/metadata/debian.tmpl new file mode 100644 index 00000000..3cd845c9 --- /dev/null +++ b/templates/package/metadata/debian.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "debian"}} + {{if .PackageDescriptor.Metadata.Maintainer}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.PackageDescriptor.Metadata.Maintainer}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "mr-3"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/generic.tmpl b/templates/package/metadata/generic.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/package/metadata/generic.tmpl diff --git a/templates/package/metadata/helm.tmpl b/templates/package/metadata/helm.tmpl new file mode 100644 index 00000000..50ea4849 --- /dev/null +++ b/templates/package/metadata/helm.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "helm"}} + {{range .PackageDescriptor.Metadata.Maintainers}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.Name}}</div>{{end}} + {{if .PackageDescriptor.Metadata.Home}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.Home}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/maven.tmpl b/templates/package/metadata/maven.tmpl new file mode 100644 index 00000000..62573a14 --- /dev/null +++ b/templates/package/metadata/maven.tmpl @@ -0,0 +1,5 @@ +{{if and (eq .PackageDescriptor.Package.Type "maven") .PackageDescriptor.Metadata}} + {{if .PackageDescriptor.Metadata.Name}}<div class="item">{{svg "octicon-note" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Name}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{range .PackageDescriptor.Metadata.Licenses}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/npm.tmpl b/templates/package/metadata/npm.tmpl new file mode 100644 index 00000000..df37504e --- /dev/null +++ b/templates/package/metadata/npm.tmpl @@ -0,0 +1,8 @@ +{{if eq .PackageDescriptor.Package.Type "npm"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} + {{range .PackageDescriptor.VersionProperties}} + {{if eq .Name "npm.tag"}}<div class="item" title="{{ctx.Locale.Tr "packages.npm.details.tag"}}">{{svg "octicon-versions" 16 "tw-mr-2"}} {{.Value}}</div>{{end}} + {{end}} +{{end}} diff --git a/templates/package/metadata/nuget.tmpl b/templates/package/metadata/nuget.tmpl new file mode 100644 index 00000000..5534577b --- /dev/null +++ b/templates/package/metadata/nuget.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "nuget"}} + {{if .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Authors}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/pub.tmpl b/templates/package/metadata/pub.tmpl new file mode 100644 index 00000000..16f7cec3 --- /dev/null +++ b/templates/package/metadata/pub.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "pub"}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.DocumentationURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.DocumentationURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.documentation_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/pypi.tmpl b/templates/package/metadata/pypi.tmpl new file mode 100644 index 00000000..3d9b2139 --- /dev/null +++ b/templates/package/metadata/pypi.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "pypi"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/rpm.tmpl b/templates/package/metadata/rpm.tmpl new file mode 100644 index 00000000..eda8a489 --- /dev/null +++ b/templates/package/metadata/rpm.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "rpm"}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.License}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.License}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/rubygems.tmpl b/templates/package/metadata/rubygems.tmpl new file mode 100644 index 00000000..9b112876 --- /dev/null +++ b/templates/package/metadata/rubygems.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "rubygems"}} + {{range .PackageDescriptor.Metadata.Authors}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div> {{end}} + {{range .PackageDescriptor.Metadata.Licenses}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}} +{{end}} diff --git a/templates/package/metadata/swift.tmpl b/templates/package/metadata/swift.tmpl new file mode 100644 index 00000000..fdffb6de --- /dev/null +++ b/templates/package/metadata/swift.tmpl @@ -0,0 +1,4 @@ +{{if eq .PackageDescriptor.Package.Type "swift"}} + {{if .PackageDescriptor.Metadata.Author.String}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "mr-3"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/metadata/vagrant.tmpl b/templates/package/metadata/vagrant.tmpl new file mode 100644 index 00000000..4628a2dc --- /dev/null +++ b/templates/package/metadata/vagrant.tmpl @@ -0,0 +1,5 @@ +{{if eq .PackageDescriptor.Package.Type "vagrant"}} + {{if .PackageDescriptor.Metadata.Author}}<div class="item" title="{{ctx.Locale.Tr "packages.details.author"}}">{{svg "octicon-person" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Author}}</div>{{end}} + {{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}} + {{if .PackageDescriptor.Metadata.RepositoryURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.RepositoryURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.repository_site"}}</a></div>{{end}} +{{end}} diff --git a/templates/package/settings.tmpl b/templates/package/settings.tmpl new file mode 100644 index 00000000..4b877347 --- /dev/null +++ b/templates/package/settings.tmpl @@ -0,0 +1,77 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository settings options{{if .ContextUser.IsOrganization}} organization{{end}}"> + {{if .ContextUser.IsOrganization}} + {{template "org/header" .}} + {{else}} + {{template "shared/user/org_profile_avatar" .}} + {{end}} + <div class="ui container"> + {{if not .ContextUser.IsOrganization}} + {{template "user/overview/header" .}} + {{end}} + {{template "base/alert" .}} + <p><a href="{{.PackageDescriptor.VersionWebLink}}">{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</a> / <strong>{{ctx.Locale.Tr "repo.settings"}}</strong></p> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.settings.link"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "packages.settings.link.description"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="link"> + <div class="field"> + <div class="ui clearable selection dropdown"> + {{$repoID := 0}} + {{if .PackageDescriptor.Repository}} + {{$repoID = .PackageDescriptor.Repository.ID}} + {{end}} + <input type="hidden" name="repo_id" value="{{$repoID}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="default text">{{ctx.Locale.Tr "packages.settings.link.select"}}</div> + <div class="menu"> + {{range .Repos}} + <div class="item" data-value="{{.ID}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "packages.settings.link.button"}}</button> + </div> + </form> + </div> + <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"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "packages.settings.delete"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "packages.settings.delete.description"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#delete-package-modal">{{ctx.Locale.Tr "packages.settings.delete"}}</button> + </div> + <div class="ui tiny modal" id="delete-package-modal"> + <div class="header"> + {{ctx.Locale.Tr "packages.settings.delete"}} + </div> + <div class="content"> + <div class="ui warning message tw-break-anywhere"> + {{ctx.Locale.Tr "packages.settings.delete.notice" .PackageDescriptor.Package.Name .PackageDescriptor.Version.Version}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="delete"> + {{template "base/modal_actions_confirm" .}} + </form> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/package/shared/cargo.tmpl b/templates/package/shared/cargo.tmpl new file mode 100644 index 00000000..5b0f6396 --- /dev/null +++ b/templates/package/shared/cargo.tmpl @@ -0,0 +1,27 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.owner.settings.cargo.title"}} +</h4> +<div class="ui attached segment"> + <div class="ui form"> + {{if .CargoIndexExists}} + <div class="field"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cargo.rebuild.description"}}</label> + </div> + <form class="field" action="{{.Link}}/cargo/rebuild" method="post"> + {{.CsrfTokenHtml}} + <button class="ui primary button">{{ctx.Locale.Tr "packages.owner.settings.cargo.rebuild"}}</button> + </form> + {{else}} + <div class="field"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cargo.initialize.description"}}</label> + </div> + <form class="field" action="{{.Link}}/cargo/initialize" method="post"> + {{.CsrfTokenHtml}} + <button class="ui primary button">{{ctx.Locale.Tr "packages.owner.settings.cargo.initialize"}}</button> + </form> + {{end}} + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Cargo" "https://forgejo.org/docs/latest/user/packages/cargo/"}}</label> + </div> + </div> +</div> diff --git a/templates/package/shared/cleanup_rules/edit.tmpl b/templates/package/shared/cleanup_rules/edit.tmpl new file mode 100644 index 00000000..138a9079 --- /dev/null +++ b/templates/package/shared/cleanup_rules/edit.tmpl @@ -0,0 +1,73 @@ +<h4 class="ui top attached header">{{if .IsEditRule}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.edit"}}{{else}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.add"}}{{end}}</h4> +<div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input name="id" type="hidden" value="{{.CleanupRule.ID}}"> + <div class="field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "enabled"}}</label> + <input type="checkbox" name="enabled" {{if .CleanupRule.Enabled}}checked{{end}}> + </div> + </div> + <div class="{{if .IsEditRule}}disabled {{end}}field {{if .Err_Type}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.filter.type"}}</label> + <select class="ui selection dropdown" name="type"> + {{range $type := .AvailableTypes}} + <option{{if eq $.CleanupRule.Type $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option> + {{end}} + </select> + </div> + <div class="field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.pattern_full_match"}}</label> + <input type="checkbox" name="match_full_name" {{if .CleanupRule.MatchFullName}}checked{{end}}> + </div> + </div> + <div class="divider"></div> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.title"}}</p> + <div class="field {{if .Err_KeepCount}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}:</label> + <select class="ui selection dropdown" name="keep_count"> + <option{{if eq .CleanupRule.KeepCount 0}} selected="selected"{{end}} value="0"></option> + <option{{if eq .CleanupRule.KeepCount 1}} selected="selected"{{end}} value="1">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}</option> + <option{{if eq .CleanupRule.KeepCount 5}} selected="selected"{{end}} value="5">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 5}}</option> + <option{{if eq .CleanupRule.KeepCount 10}} selected="selected"{{end}} value="10">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 10}}</option> + <option{{if eq .CleanupRule.KeepCount 25}} selected="selected"{{end}} value="25">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 25}}</option> + <option{{if eq .CleanupRule.KeepCount 50}} selected="selected"{{end}} value="50">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 50}}</option> + <option{{if eq .CleanupRule.KeepCount 100}} selected="selected"{{end}} value="100">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" 100}}</option> + </select> + </div> + <div class="field {{if .Err_KeepPattern}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}:</label> + <input name="keep_pattern" type="text" value="{{.CleanupRule.KeepPattern}}"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.pattern.container"}}</p> + </div> + <div class="divider"></div> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.title"}}</p> + <div class="field {{if .Err_RemoveDays}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}:</label> + <select class="ui selection dropdown" name="remove_days"> + <option{{if eq .CleanupRule.RemoveDays 0}} selected="selected"{{end}} value="0"></option> + <option{{if eq .CleanupRule.RemoveDays 7}} selected="selected"{{end}} value="7">{{ctx.Locale.Tr "tool.days" 7}}</option> + <option{{if eq .CleanupRule.RemoveDays 14}} selected="selected"{{end}} value="14">{{ctx.Locale.Tr "tool.days" 14}}</option> + <option{{if eq .CleanupRule.RemoveDays 30}} selected="selected"{{end}} value="30">{{ctx.Locale.Tr "tool.days" 30}}</option> + <option{{if eq .CleanupRule.RemoveDays 60}} selected="selected"{{end}} value="60">{{ctx.Locale.Tr "tool.days" 60}}</option> + <option{{if eq .CleanupRule.RemoveDays 90}} selected="selected"{{end}} value="90">{{ctx.Locale.Tr "tool.days" 90}}</option> + <option{{if eq .CleanupRule.RemoveDays 180}} selected="selected"{{end}} value="180">{{ctx.Locale.Tr "tool.days" 180}}</option> + </select> + </div> + <div class="field {{if .Err_RemovePattern}}error{{end}}"> + <label>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}:</label> + <input name="remove_pattern" type="text" value="{{.CleanupRule.RemovePattern}}"> + </div> + <div class="field"> + {{if .IsEditRule}} + <button class="ui primary button" name="action" value="save">{{ctx.Locale.Tr "save"}}</button> + <button class="ui red button" name="action" value="remove">{{ctx.Locale.Tr "remove"}}</button> + <a class="ui button" href="{{.Link}}/preview">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview"}}</a> + {{else}} + <button class="ui primary button" name="action" value="save">{{ctx.Locale.Tr "add"}}</button> + {{end}} + </div> + </form> +</div> diff --git a/templates/package/shared/cleanup_rules/list.tmpl b/templates/package/shared/cleanup_rules/list.tmpl new file mode 100644 index 00000000..ba1683b9 --- /dev/null +++ b/templates/package/shared/cleanup_rules/list.tmpl @@ -0,0 +1,56 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.owner.settings.cleanuprules.title"}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{.Link}}/rules/add">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.add"}}</a> + </div> +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + {{range .CleanupRules}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg .Type.SVGName 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + <a class="item" href="{{$.Link}}/rules/{{.ID}}">{{.Type.Name}}</a> + </div> + <div class="flex-item-body"> + <p>{{if .Enabled}}{{ctx.Locale.Tr "enabled"}}{{else}}{{ctx.Locale.Tr "disabled"}}{{end}}</p> + </div> + {{if .KeepCount}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}:</p> {{if eq .KeepCount 1}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}{{else}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" .KeepCount}}{{end}} + </div> + {{end}} + {{if .KeepPattern}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}:</p> {{StringUtils.EllipsisString .KeepPattern 100}} + </div> + {{end}} + {{if .RemoveDays}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}:</p> {{ctx.Locale.Tr "tool.days" .RemoveDays}} + </div> + {{end}} + {{if .RemovePattern}} + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}:</p> {{StringUtils.EllipsisString .RemovePattern 100}} + </div> + {{end}} + </div> + <div class="flex-item-trailing"> + <div class="ui dropdown tiny basic button"> + {{svg "octicon-kebab-horizontal"}} + <div class="menu"> + <a class="item" href="{{$.Link}}/rules/{{.ID}}">{{ctx.Locale.Tr "edit"}}</a> + <a class="item" href="{{$.Link}}/rules/{{.ID}}/preview">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview"}}</a> + </div> + </div> + </div> + </div> + {{else}} + <div class="item">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.none"}}</div> + {{end}} + </div> +</div> diff --git a/templates/package/shared/cleanup_rules/preview.tmpl b/templates/package/shared/cleanup_rules/preview.tmpl new file mode 100644 index 00000000..0d9c4b0d --- /dev/null +++ b/templates/package/shared/cleanup_rules/preview.tmpl @@ -0,0 +1,34 @@ +<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview"}}</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview.overview" (len .VersionsToRemove)}}</p> +</div> +<div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "admin.packages.type"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.name"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.version"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.creator"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.size"}}</th> + <th>{{ctx.Locale.Tr "admin.packages.published"}}</th> + </tr> + </thead> + <tbody> + {{range .VersionsToRemove}} + <tr> + <td>{{.Package.Type.Name}}</td> + <td>{{.Package.Name}}</td> + <td><a href="{{.VersionWebLink}}">{{.Version.Version}}</a></td> + <td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td> + <td>{{ctx.Locale.TrSize .CalculateBlobSize}}</td> + <td>{{DateTime "short" .Version.CreatedUnix}}</td> + </tr> + {{else}} + <tr> + <td colspan="6">{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.preview.none"}}</td> + </tr> + {{end}} + </tbody> + </table> +</div> diff --git a/templates/package/shared/list.tmpl b/templates/package/shared/list.tmpl new file mode 100644 index 00000000..36f8bc15 --- /dev/null +++ b/templates/package/shared/list.tmpl @@ -0,0 +1,57 @@ +{{template "base/alert" .}} +{{if .HasPackages}} +<form class="ui form ignore-dirty"> + <div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Query "Placeholder" (ctx.Locale.Tr "search.package_kind")}} + <select class="ui small dropdown" name="type"> + <option value="">{{ctx.Locale.Tr "packages.filter.type"}}</option> + <option value="all">{{ctx.Locale.Tr "packages.filter.type.all"}}</option> + {{range $type := .AvailableTypes}} + <option{{if eq $.PackageType $type}} selected="selected"{{end}} value="{{$type}}">{{$type.Name}}</option> + {{end}} + </select> + {{template "shared/search/button"}} + </div> +</form> +{{end}} +<div> + {{range .PackageDescriptors}} + <div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title"> + <a href="{{.VersionWebLink}}">{{.Package.Name}}</a> + <span class="ui label">{{svg .Package.Type.SVGName 16}} {{.Package.Type.Name}}</span> + </div> + <div class="flex-item-body"> + {{$timeStr := TimeSinceUnix .Version.CreatedUnix ctx.Locale}} + {{$hasRepositoryAccess := false}} + {{if .Repository}} + {{$hasRepositoryAccess = index $.RepositoryAccessMap .Repository.ID}} + {{end}} + {{if $hasRepositoryAccess}} + {{ctx.Locale.Tr "packages.published_by_in" $timeStr .Creator.HomeLink .Creator.GetDisplayName .Repository.Link .Repository.FullName}} + {{else}} + {{ctx.Locale.Tr "packages.published_by" $timeStr .Creator.HomeLink .Creator.GetDisplayName}} + {{end}} + </div> + </div> + </div> + </div> + {{else}} + {{if not .HasPackages}} + <div class="empty-placeholder"> + {{svg "octicon-package" 48}} + <h2>{{ctx.Locale.Tr "packages.empty"}}</h2> + {{if and .Repository .CanWritePackages}} + {{$packagesUrl := URLJoin .Owner.HomeLink "-" "packages"}} + <p>{{ctx.Locale.Tr "packages.empty.repo" $packagesUrl}}</p> + {{end}} + <p>{{ctx.Locale.Tr "packages.empty.documentation" "https://forgejo.org/docs/latest/user/packages/"}}</p> + </div> + {{else}} + <p class="tw-py-4">{{ctx.Locale.Tr "packages.filter.no_result"}}</p> + {{end}} + {{end}} + {{template "base/paginate" .}} +</div> diff --git a/templates/package/shared/versionlist.tmpl b/templates/package/shared/versionlist.tmpl new file mode 100644 index 00000000..e5c568e0 --- /dev/null +++ b/templates/package/shared/versionlist.tmpl @@ -0,0 +1,37 @@ +<p><a href="{{.PackageDescriptor.PackageWebLink}}">{{.PackageDescriptor.Package.Name}}</a> / <strong>{{ctx.Locale.Tr "packages.versions"}}</strong></p> +<form class="ui form ignore-dirty"> + <div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Query "Placeholder" (ctx.Locale.Tr "search.package_kind")}} + <select class="ui small dropdown" name="sort"> + <option value="version_asc"{{if eq .Sort "version_asc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "filter.string.asc"}}</option> + <option value="version_desc"{{if eq .Sort "version_desc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "filter.string.desc"}}</option> + <option value="created_asc"{{if eq .Sort "created_asc"}} selected="selected"{{end}}>{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</option> + <option value="created_desc"{{if or (eq .Sort "") (eq .Sort "created_desc")}} selected="selected"{{end}}>{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</option> + </select> + {{if eq .PackageDescriptor.Package.Type "container"}} + <select class="ui small dropdown" name="tagged"> + {{$isTagged := or (eq .Tagged "") (eq .Tagged "tagged")}} + <option value="tagged"{{if $isTagged}} selected="selected"{{end}}>{{ctx.Locale.Tr "packages.filter.container.tagged"}}</option> + <option value="untagged"{{if not $isTagged}} selected="selected"{{end}}>{{ctx.Locale.Tr "packages.filter.container.untagged"}}</option> + </select> + {{end}} + {{template "shared/search/button"}} + </div> +</form> +<div> + {{range .PackageDescriptors}} + <div class="flex-list"> + <div class="flex-item"> + <div class="flex-item-main"> + <a class="flex-item-title" href="{{.VersionWebLink}}">{{.Version.LowerVersion}}</a> + <div class="flex-item-body"> + {{ctx.Locale.Tr "packages.published_by" (TimeSinceUnix .Version.CreatedUnix ctx.Locale) .Creator.HomeLink .Creator.GetDisplayName}} + </div> + </div> + </div> + </div> + {{else}} + <p class="tw-py-4">{{ctx.Locale.Tr "packages.filter.no_result"}}</p> + {{end}} + {{template "base/paginate" .}} +</div> diff --git a/templates/package/view.tmpl b/templates/package/view.tmpl new file mode 100644 index 00000000..1d87f4d3 --- /dev/null +++ b/templates/package/view.tmpl @@ -0,0 +1,114 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository view issue packages"> + {{template "shared/user/org_profile_avatar" .}} + <div class="ui container"> + {{template "user/overview/header" .}} + <div class="issue-title-header"> + <div class="issue-title"> + <h1>{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}})</h1> + </div> + <div> + {{$timeStr := TimeSinceUnix .PackageDescriptor.Version.CreatedUnix ctx.Locale}} + {{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/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="issue-content-right ui segment"> + <strong>{{ctx.Locale.Tr "packages.details"}}</strong> + <div class="ui relaxed list"> + <div class="item">{{svg .PackageDescriptor.Package.Type.SVGName 16 "tw-mr-2"}} {{.PackageDescriptor.Package.Type.Name}}</div> + {{if .HasRepositoryAccess}} + <div class="item">{{svg "octicon-repo" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Repository.Link}}">{{.PackageDescriptor.Repository.FullName}}</a></div> + {{end}} + <div class="item">{{svg "octicon-calendar" 16 "tw-mr-2"}} {{TimeSinceUnix .PackageDescriptor.Version.CreatedUnix ctx.Locale}}</div> + <div class="item">{{svg "octicon-download" 16 "tw-mr-2"}} {{.PackageDescriptor.Version.DownloadCount}}</div> + {{template "package/metadata/alpine" .}} + {{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" 16 "tw-mr-2"}} {{ctx.Locale.TrSize .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">{{ctx.Locale.TrSize .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">{{DateTime "short" .CreatedUnix}}</span> + </div> + {{end}} + </div> + {{if or .CanWritePackages .HasRepositoryAccess}} + <div class="divider"></div> + <div class="ui relaxed list"> + {{if .HasRepositoryAccess}} + <div class="item">{{svg "octicon-issue-opened" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Repository.Link}}/issues">{{ctx.Locale.Tr "repo.issues"}}</a></div> + {{end}} + {{if .CanWritePackages}} + <div class="item">{{svg "octicon-tools" 16 "tw-mr-2"}} <a href="{{.Link}}/settings">{{ctx.Locale.Tr "repo.settings"}}</a></div> + {{end}} + </div> + {{end}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/post-install.tmpl b/templates/post-install.tmpl new file mode 100644 index 00000000..0dbfbdc3 --- /dev/null +++ b/templates/post-install.tmpl @@ -0,0 +1,24 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content install post-install"> + <div class="ui container"> + <div class="ui grid"> + <div class="sixteen wide column content"> + <div class="home"> + <div class="ui stackable middle very relaxed page grid"> + <div class="sixteen wide center aligned centered column"> + <div> + <img src="{{AssetUrlPrefix}}/img/forgejo-loading.svg" alt="{{ctx.Locale.Tr "loading"}}" width="256" height="256"> + </div> + </div> + </div> + <div class="ui stackable middle very relaxed page grid"> + <div class="sixteen wide center aligned centered column"> + <p><a id="goto-user-login" href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "loading"}}</a></p> + </div> + </div> + </div> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl new file mode 100644 index 00000000..b892cff9 --- /dev/null +++ b/templates/projects/list.tmpl @@ -0,0 +1,93 @@ +{{if and $.CanWriteProjects (not $.Repository.IsArchived)}} + <div class="tw-flex 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"}} + {{ctx.Locale.PrettyNumber .OpenCount}} {{ctx.Locale.Tr "repo.issues.open_title"}} + </a> + <a class="item{{if .IsShowClosed}} active{{end}}" href="?state=closed&q={{$.Keyword}}"> + {{svg "octicon-check" 16 "tw-mr-2"}} + {{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> + </div> +{{end}} + +{{template "base/alert" .}} + +<div class="list-header"> + <!-- Search --> + <form class="list-header-search ui form ignore-dirty"> + <input type="hidden" name="state" value="{{$.State}}"> + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.project_kind")}} + </form> + <!-- Sort --> + <div class="list-header-sort ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{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 "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> + </div> +</div> + +<div class="milestone-list"> + {{range .Projects}} + <li class="milestone-card"> + <h3 class="flex-text-block tw-m-0 tw-gap-3"> + {{svg .IconName 16}} + <a class="muted tw-break-anywhere" href="{{.Link ctx}}">{{.Title}}</a> + </h3> + <div class="milestone-toolbar"> + <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"}} + </div> + <div class="flex-text-block"> + {{svg "octicon-check" 14}} + {{ctx.Locale.PrettyNumber (.NumClosedIssues ctx)}} {{ctx.Locale.Tr "repo.issues.closed_title"}} + </div> + </div> + {{if and $.CanWriteProjects (not $.Repository.IsArchived)}} + <div class="group"> + <a class="flex-text-inline" href="{{.Link ctx}}/edit">{{svg "octicon-pencil" 14}}{{ctx.Locale.Tr "repo.issues.label_edit"}}</a> + {{if .IsClosed}} + <a class="link-action flex-text-inline" href data-url="{{.Link ctx}}/open">{{svg "octicon-check" 14}}{{ctx.Locale.Tr "repo.projects.open"}}</a> + {{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> + </div> + {{end}} + </div> + {{if .Description}} + <div class="content"> + {{.RenderedContent}} + </div> + {{end}} + </li> + {{end}} + + {{template "base/paginate" .}} +</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> + {{template "base/modal_actions_confirm" .}} +</div> +{{end}} diff --git a/templates/projects/new.tmpl b/templates/projects/new.tmpl new file mode 100644 index 00000000..bd173b54 --- /dev/null +++ b/templates/projects/new.tmpl @@ -0,0 +1,66 @@ +<h2 class="ui dividing header"> + {{if .PageIsEditProjects}} + {{ctx.Locale.Tr "repo.projects.edit"}} + <div class="sub header">{{ctx.Locale.Tr "repo.projects.edit_subheader"}}</div> + {{else}} + {{ctx.Locale.Tr "repo.projects.new"}} + <div class="sub header">{{ctx.Locale.Tr "repo.projects.new_subheader"}}</div> + {{end}} +</h2> +{{template "base/alert" .}} +<form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div> + <input type="hidden" id="redirect" name="redirect" value="{{.redirect}}"> + <div class="field {{if .Err_Title}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.projects.title"}}</label> + <input name="title" placeholder="{{ctx.Locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.projects.description"}}</label> + <textarea name="content" placeholder="{{ctx.Locale.Tr "repo.projects.description_placeholder"}}">{{.content}}</textarea> + </div> + + {{if not .PageIsEditProjects}} + <div class="field"> + <label>{{ctx.Locale.Tr "repo.projects.template.desc"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" name="template_type" value="{{.type}}"> + <div class="default text">{{ctx.Locale.Tr "repo.projects.template.desc_helper"}}</div> + <div class="menu"> + {{range $element := .TemplateConfigs}} + <div class="item" data-id="{{$element.TemplateType}}" data-value="{{$element.TemplateType}}">{{ctx.Locale.Tr $element.Translation}}</div> + {{end}} + </div> + </div> + </div> + {{end}} + + <div class="field"> + <label>{{ctx.Locale.Tr "repo.projects.card_type.desc"}}</label> + <div class="ui selection dropdown"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{range $element := .CardTypes}} + {{if or (eq $.card_type $element.CardType) (and (not $.PageIsEditProjects) (eq $element.CardType 1))}} + <input type="hidden" name="card_type" value="{{$element.CardType}}"> + <div class="default text">{{ctx.Locale.Tr $element.Translation}}</div> + {{end}} + {{end}} + <div class="menu"> + {{range $element := .CardTypes}} + <div class="item" data-id="{{$element.CardType}}" data-value="{{$element.CardType}}">{{ctx.Locale.Tr $element.Translation}}</div> + {{end}} + </div> + </div> + </div> + </div> + <div class="divider"></div> + <div class="tw-text-right"> + <a class="ui cancel button" href="{{$.CancelLink}}"> + {{ctx.Locale.Tr "repo.milestones.cancel"}} + </a> + <button class="ui primary button"> + {{if .PageIsEditProjects}}{{ctx.Locale.Tr "repo.projects.modify"}}{{else}}{{ctx.Locale.Tr "repo.projects.create"}}{{end}} + </button> + </div> +</form> diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl new file mode 100644 index 00000000..564ec1b1 --- /dev/null +++ b/templates/projects/view.tmpl @@ -0,0 +1,180 @@ +{{$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> + {{if $canWriteProject}} + <div class="ui compact mini menu"> + <a class="item" href="{{.Link}}/edit?redirect=project"> + {{svg "octicon-pencil"}} + {{ctx.Locale.Tr "repo.issues.label_edit"}} + </a> + {{if .Project.IsClosed}} + <button class="item btn link-action" data-url="{{.Link}}/open"> + {{svg "octicon-check"}} + {{ctx.Locale.Tr "repo.projects.open"}} + </button> + {{else}} + <button class="item btn link-action" data-url="{{.Link}}/close"> + {{svg "octicon-skip"}} + {{ctx.Locale.Tr "repo.projects.close"}} + </button> + {{end}} + <button class="item btn delete-button" data-url="{{.Link}}/delete" data-id="{{.Project.ID}}"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.issues.label_delete"}} + </button> + <button class="item btn show-modal" data-modal="#new-project-column-item"> + {{svg "octicon-plus"}} + {{ctx.Locale.Tr "new_project_column"}} + </button> + </div> + <div class="ui small modal new-project-column-modal" id="new-project-column-item"> + <div class="header"> + {{ctx.Locale.Tr "repo.projects.column.new"}} + </div> + <div class="content"> + <form class="ui form"> + <div class="required field"> + <label for="new_project_column">{{ctx.Locale.Tr "repo.projects.column.new_title"}}</label> + <input class="new-project-column" id="new_project_column" name="title" required> + </div> + + <div class="field color-field"> + <label for="new_project_column_color_picker">{{ctx.Locale.Tr "repo.projects.column.color"}}</label> + <div class="js-color-picker-input column"> + <input maxlength="7" placeholder="#c320f6" id="new_project_column_color_picker" name="color"> + {{template "repo/issue/label_precolors"}} + </div> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button data-url="{{$.Link}}" class="ui primary button" id="new_project_column_submit">{{ctx.Locale.Tr "repo.projects.column.new_submit"}}</button> + </div> + </form> + </div> + </div> + {{end}} + </div> + + <div class="content">{{$.Project.RenderedContent}}</div> + + <div class="divider"></div> +</div> + +<div id="project-board"> + <div class="board {{if .CanWriteProjects}}sortable{{end}}"{{if .CanWriteProjects}} 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 large label project-column-title tw-py-1"> + <div class="ui small circular grey label project-column-issue-count"> + {{.NumIssues ctx}} + </div> + <span class="project-column-title-label">{{.Title}}</span> + </div> + {{if $canWriteProject}} + <div class="ui dropdown jump item"> + <div class="tw-px-2"> + {{svg "octicon-kebab-horizontal"}} + </div> + <div class="menu user-menu"> + <a class="item show-modal button" data-modal="#edit-project-column-modal-{{.ID}}"> + {{svg "octicon-pencil"}} + {{ctx.Locale.Tr "repo.projects.column.edit"}} + </a> + {{if not .Default}} + <a class="item show-modal button default-project-column-show" + data-modal="#default-project-column-modal-{{.ID}}" + data-modal-default-project-column-header="{{ctx.Locale.Tr "repo.projects.column.set_default"}}" + data-modal-default-project-column-content="{{ctx.Locale.Tr "repo.projects.column.set_default_desc"}}" + data-url="{{$.Link}}/{{.ID}}/default"> + {{svg "octicon-pin"}} + {{ctx.Locale.Tr "repo.projects.column.set_default"}} + </a> + <a class="item show-modal button show-delete-project-column-modal" + data-modal="#delete-project-column-modal-{{.ID}}" + data-url="{{$.Link}}/{{.ID}}"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.projects.column.delete"}} + </a> + {{end}} + + <div class="ui small modal edit-project-column-modal" id="edit-project-column-modal-{{.ID}}"> + <div class="header"> + {{ctx.Locale.Tr "repo.projects.column.edit"}} + </div> + <div class="content"> + <form class="ui form"> + <div class="required field"> + <label for="new_project_column_title">{{ctx.Locale.Tr "repo.projects.column.edit_title"}}</label> + <input class="project-column-title-input" id="new_project_column_title" name="title" value="{{.Title}}" required> + </div> + + <div class="field color-field"> + <label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label> + <div class="js-color-picker-input column"> + <input maxlength="7" placeholder="#c320f6" id="new_project_column_color" name="color" value="{{.Color}}"> + {{template "repo/issue/label_precolors"}} + </div> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-project-column-button">{{ctx.Locale.Tr "repo.projects.column.edit"}}</button> + </div> + </form> + </div> + </div> + + <div class="ui g-modal-confirm modal default-project-column-modal" id="default-project-column-modal-{{.ID}}"> + <div class="header"> + <span id="default-project-column-header"></span> + </div> + <div class="content"> + <label id="default-project-column-content"></label> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </div> + + <div class="ui g-modal-confirm modal" id="delete-project-column-modal-{{.ID}}"> + <div class="header"> + {{ctx.Locale.Tr "repo.projects.column.delete"}} + </div> + <div class="content"> + <label> + {{ctx.Locale.Tr "repo.projects.column.deletion_desc"}} + </label> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </div> + </div> + </div> + {{end}} + </div> + <div class="divider"{{if .Color}} style="color: {{ContrastColor .Color}} !important"{{end}}></div> + <div class="ui cards" data-url="{{$.Link}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}"> + {{range (index $.IssuesMap .ID)}} + <div class="issue-card tw-break-anywhere {{if $canWriteProject}}tw-cursor-grab{{end}}" data-issue="{{.ID}}"> + {{template "repo/issue/card" (dict "Issue" . "Page" $)}} + </div> + {{end}} + </div> + </div> + {{end}} + </div> +</div> + +{{if .CanWriteProjects}} + <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> + {{template "base/modal_actions_confirm" .}} + </div> +{{end}} diff --git a/templates/repo/actions/dispatch.tmpl b/templates/repo/actions/dispatch.tmpl new file mode 100644 index 00000000..520a9b50 --- /dev/null +++ b/templates/repo/actions/dispatch.tmpl @@ -0,0 +1,99 @@ +<div class="ui info message tw-flex tw-items-center"> + <span> + {{ctx.Locale.Tr "actions.workflow.dispatch.trigger_found"}} + </span> + <div class="ui dropdown custom tw-ml-4" id="workflow_dispatch_dropdown"> + <button class="ui compact small basic button tw-flex"> + <span class="text">{{ctx.Locale.Tr "actions.workflow.dispatch.run"}}</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </button> + <div class="menu"> + <div class="message ui form"> + <div class="field"> + <label>{{ctx.Locale.Tr "actions.workflow.dispatch.use_from"}}</label> + {{template "repo/branch_dropdown" dict + "root" (dict + "IsViewBranch" true + "BranchName" .Repo.BranchName + "CommitID" .Repo.CommitID + "RepoLink" .Repo.RepoLink + "Repository" .Repo.Repository + ) + "disableCreateBranch" true + "branchForm" "branch-dropdown-form" + "setAction" false + "submitForm" false + }} + </div> + + <form method="post" action="{{.Repo.RepoLink}}/actions/manual" id="branch-dropdown-form"> + {{range $i, $key := .CurWorkflowDispatchInputKeys}} + {{$val := index $.CurWorkflowDispatch.Inputs $key}} + <div class="{{if $val.Required}}required {{end}}field"> + {{if eq $val.Type "boolean"}} + <div class="ui checkbox"> + <label><strong>{{if $val.Description}}{{$val.Description}}{{else}}{{$key}}{{end}}</strong></label> + <input {{if $val.Required}}required{{end}} type="checkbox" name="inputs[{{$key}}]" {{if eq $val.Default "true"}}checked{{end}}> + </div> + {{else}} + <label>{{if $val.Description}}{{$val.Description}}{{else}}{{$key}}{{end}}</label> + {{if eq $val.Type "number"}} + <input {{if $val.Required}}required{{end}} type="number" name="inputs[{{$key}}]" {{if $val.Default}}value="{{$val.Default}}"{{end}}> + {{else if eq $val.Type "string"}} + <input {{if $val.Required}}required{{end}} type="text" name="inputs[{{$key}}]" {{if $val.Default}}value="{{$val.Default}}"{{end}}> + {{else if eq $val.Type "choice"}} + <div class="ui selection dropdown"> + <input name="inputs[{{$key}}]" type="hidden" value="{{$val.Default}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text"></div> + <div class="menu"> + {{range $opt := $val.Options}} + <div data-value="{{$opt}}" class="{{if eq $val.Default $opt}}active selected {{end}}item">{{$opt}}</div> + {{end}} + </div> + </div> + {{else}} + <strong>{{ctx.Locale.Tr "actions.workflow.dispatch.invalid_input_type" $val.Type}}</strong> + {{end}} + {{end}} + </div> + {{end}} + + {{if .WarnDispatchInputsLimit}} + <div class="text yellow tw-mb-4"> + {{svg "octicon-alert"}} {{ctx.Locale.Tr "actions.workflow.dispatch.warn_input_limit" .DispatchInputsLimit}} + </div> + {{end}} + + {{.CsrfTokenHtml}} + <input type="hidden" name="ref" value="{{if $.Repo.BranchName}}{{$.Repo.BranchName}}{{else}}{{$.Repo.Repository.DefaultBranch}}{{end}}"> + <input type="hidden" name="workflow" value="{{$.CurWorkflow}}"> + <input type="hidden" name="actor" value="{{$.CurActor}}"> + <input type="hidden" name="status" value="{{$.CurStatus}}"> + <button type="submit" id="workflow-dispatch-submit" class="ui primary small compact button">{{ctx.Locale.Tr "actions.workflow.dispatch.run"}}</button> + </form> + </div> + </div> + </div> + <script> + window.addEventListener('load', () => { + const dropdown = $('#workflow_dispatch_dropdown'); + const menu = dropdown.find('> .menu'); + $(document.body).on('click', (ev) => { + if (!dropdown[0].contains(ev.target) && menu.hasClass('visible')) { + menu.transition({ animation: 'slide down out', duration: 200, queue: false }); + } + }); + dropdown.on('click', (ev) => { + const inMenu = $(ev.target).closest(menu).length !== 0; + if (inMenu) return; + ev.stopPropagation(); + if (menu.hasClass('visible')) { + menu.transition({ animation: 'slide down out', duration: 200, queue: false }); + } else { + menu.transition({ animation: 'slide down in', duration: 200, queue: true }); + } + }); + }); + </script> +</div>
\ No newline at end of file diff --git a/templates/repo/actions/list.tmpl b/templates/repo/actions/list.tmpl new file mode 100644 index 00000000..263530f9 --- /dev/null +++ b/templates/repo/actions/list.tmpl @@ -0,0 +1,92 @@ +{{template "base/head" .}} +<div class="page-content repository actions"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + + {{if .HasWorkflowsOrRuns}} + <div class="ui stackable grid"> + <div class="four wide column"> + <div class="ui fluid vertical menu"> + <a class="item{{if not $.CurWorkflow}} active{{end}}" href="?actor={{$.CurActor}}&status={{$.CurStatus}}">{{ctx.Locale.Tr "actions.runs.all_workflows"}}</a> + {{range .workflows}} + <a class="item{{if eq .Entry.Name $.CurWorkflow}} active{{end}}" href="?workflow={{.Entry.Name}}&actor={{$.CurActor}}&status={{$.CurStatus}}">{{.Entry.Name}} + {{if .ErrMsg}} + <span data-tooltip-content="{{.ErrMsg}}"> + {{svg "octicon-alert" 16 "text red"}} + </span> + {{end}} + + {{if $.ActionsConfig.IsWorkflowDisabled .Entry.Name}} + <div class="ui red label">{{ctx.Locale.Tr "disabled"}}</div> + {{end}} + </a> + {{end}} + </div> + </div> + <div class="twelve wide column content"> + <div class="ui secondary filter menu tw-justify-end tw-flex tw-items-center"> + <!-- Actor --> + <div class="ui{{if not .Actors}} disabled{{end}} dropdown jump item"> + <span class="text">{{ctx.Locale.Tr "actions.runs.actor"}}</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search"}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "actions.runs.actor"}}"> + </div> + <a class="item{{if not $.CurActor}} active{{end}}" href="?workflow={{$.CurWorkflow}}&status={{$.CurStatus}}&actor=0"> + {{ctx.Locale.Tr "actions.runs.actors_no_select"}} + </a> + {{range .Actors}} + <a class="item{{if eq .ID $.CurActor}} active{{end}}" href="?workflow={{$.CurWorkflow}}&actor={{.ID}}&status={{$.CurStatus}}"> + {{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}} + </a> + {{end}} + </div> + </div> + <!-- Status --> + <div class="ui dropdown jump item"> + <span class="text">{{ctx.Locale.Tr "actions.runs.status"}}</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search"}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "actions.runs.status"}}"> + </div> + <a class="item{{if not $.CurStatus}} active{{end}}" href="?workflow={{$.CurWorkflow}}&actor={{$.CurActor}}&status=0"> + {{ctx.Locale.Tr "actions.runs.status_no_select"}} + </a> + {{range .StatusInfoList}} + <a class="item{{if eq .Status $.CurStatus}} active{{end}}" href="?workflow={{$.CurWorkflow}}&actor={{$.CurActor}}&status={{.Status}}"> + {{.DisplayedStatus}} + </a> + {{end}} + </div> + </div> + + {{if .AllowDisableOrEnableWorkflow}} + <button class="ui jump dropdown btn interact-bg tw-p-2"> + {{svg "octicon-kebab-horizontal"}} + <div class="menu"> + <a class="item link-action" data-url="{{$.Link}}/{{if .CurWorkflowDisabled}}enable{{else}}disable{{end}}?workflow={{$.CurWorkflow}}&actor={{.CurActor}}&status={{$.CurStatus}}"> + {{if .CurWorkflowDisabled}}{{ctx.Locale.Tr "actions.workflow.enable"}}{{else}}{{ctx.Locale.Tr "actions.workflow.disable"}}{{end}} + </a> + </div> + </button> + {{end}} + </div> + + {{if $.CurWorkflowDispatch}} + {{template "repo/actions/dispatch" .}} + {{end}} + + {{template "repo/actions/runs_list" .}} + </div> + </div> + {{else}} + {{template "repo/actions/no_workflows" .}} + {{end}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/actions/no_workflows.tmpl b/templates/repo/actions/no_workflows.tmpl new file mode 100644 index 00000000..88d6e513 --- /dev/null +++ b/templates/repo/actions/no_workflows.tmpl @@ -0,0 +1,8 @@ +<div class="empty-placeholder"> + {{svg "octicon-no-entry" 48}} + <h2>{{ctx.Locale.Tr "actions.runs.no_workflows"}}</h2> + {{if and .CanWriteCode .CanWriteActions}} + <p>{{ctx.Locale.Tr "actions.runs.no_workflows.quick_start" "https://forgejo.org/docs/latest/admin/actions/"}}</p> + {{end}} + <p>{{ctx.Locale.Tr "actions.runs.no_workflows.documentation" "https://forgejo.org/docs/latest/admin/actions/"}}</p> +</div> diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl new file mode 100644 index 00000000..e37f3d7d --- /dev/null +++ b/templates/repo/actions/runs_list.tmpl @@ -0,0 +1,43 @@ +<div class="flex-list run-list"> + {{if not .Runs}} + <div class="empty-placeholder"> + {{svg "octicon-no-entry" 48}} + <h2>{{if $.IsFiltered}}{{ctx.Locale.Tr "actions.runs.no_results"}}{{else}}{{ctx.Locale.Tr "actions.runs.no_runs"}}{{end}}</h2> + </div> + {{end}} + {{range .Runs}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{template "repo/actions/status" (dict "status" .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> + <div class="flex-item-body"> + <b>{{if not $.CurWorkflow}}{{.WorkflowID}} {{end}}#{{.Index}}</b> - + {{- if .ScheduleID -}} + {{ctx.Locale.Tr "actions.runs.scheduled"}} + {{- else -}} + {{ctx.Locale.Tr "actions.runs.commit"}} + <a href="{{$.RepoLink}}/commit/{{.CommitSHA}}">{{ShortSha .CommitSHA}}</a> + {{ctx.Locale.Tr "actions.runs.pushed_by"}} + <a href="{{.TriggerUser.HomeLink}}">{{.TriggerUser.GetDisplayName}}</a> + {{- end -}} + </div> + </div> + <div class="flex-item-trailing"> + {{if .RefLink}} + <a class="ui label run-list-ref gt-ellipsis" href="{{.RefLink}}">{{.PrettyRef}}</a> + {{else}} + <span class="ui label run-list-ref gt-ellipsis">{{.PrettyRef}}</span> + {{end}} + <div class="run-list-item-right"> + <div class="run-list-meta">{{svg "octicon-calendar" 16}}{{TimeSinceUnix .Updated ctx.Locale}}</div> + <div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{.Duration}}</div> + </div> + </div> + </div> + {{end}} +</div> +{{template "base/paginate" .}} diff --git a/templates/repo/actions/status.tmpl b/templates/repo/actions/status.tmpl new file mode 100644 index 00000000..a0e02cf8 --- /dev/null +++ b/templates/repo/actions/status.tmpl @@ -0,0 +1,29 @@ +<!-- This template should be kept the same as web_src/js/components/ActionRunStatus.vue + Please also update the vue file above if this template is modified. + action status accepted: success, skipped, waiting, blocked, running, failure, cancelled, unknown +--> +{{- $size := 16 -}} +{{- if .size -}} +{{- $size = .size -}} +{{- end -}} + +{{- $className := "" -}} +{{- if .className -}} +{{- $className = .className -}} +{{- end -}} + +<span class="tw-flex tw-items-center" data-tooltip-content="{{ctx.Locale.Tr (printf "actions.status.%s" .status)}}"> +{{if eq .status "success"}} + {{svg "octicon-check-circle-fill" $size (printf "text green %s" $className)}} +{{else if eq .status "skipped"}} + {{svg "octicon-skip" $size (printf "text grey %s" $className)}} +{{else if eq .status "waiting"}} + {{svg "octicon-clock" $size (printf "text yellow %s" $className)}} +{{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)}} +{{else if or (eq .status "failure") or (eq .status "cancelled") or (eq .status "unknown")}} + {{svg "octicon-x-circle-fill" $size (printf "text red %s" $className)}} +{{end}} +</span> diff --git a/templates/repo/actions/view.tmpl b/templates/repo/actions/view.tmpl new file mode 100644 index 00000000..b7877627 --- /dev/null +++ b/templates/repo/actions/view.tmpl @@ -0,0 +1,33 @@ +{{template "base/head" .}} + +<div class="page-content repository"> + {{template "repo/header" .}} + <div id="repo-action-view" + data-run-index="{{.RunIndex}}" + data-job-index="{{.JobIndex}}" + data-actions-url="{{.ActionsURL}}" + data-workflow-name="{{.WorkflowName}}" + data-workflow-url="{{.WorkflowURL}}" + data-locale-approve="{{ctx.Locale.Tr "repo.diff.review.approve"}}" + data-locale-cancel="{{ctx.Locale.Tr "cancel"}}" + data-locale-rerun="{{ctx.Locale.Tr "rerun"}}" + data-locale-rerun-all="{{ctx.Locale.Tr "rerun_all"}}" + data-locale-status-unknown="{{ctx.Locale.Tr "actions.status.unknown"}}" + data-locale-status-waiting="{{ctx.Locale.Tr "actions.status.waiting"}}" + data-locale-status-running="{{ctx.Locale.Tr "actions.status.running"}}" + data-locale-status-success="{{ctx.Locale.Tr "actions.status.success"}}" + data-locale-status-failure="{{ctx.Locale.Tr "actions.status.failure"}}" + data-locale-status-cancelled="{{ctx.Locale.Tr "actions.status.cancelled"}}" + 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-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"}}" + data-locale-show-full-screen="{{ctx.Locale.Tr "show_full_screen"}}" + data-locale-download-logs="{{ctx.Locale.Tr "download_logs"}}" + > + </div> +</div> + +{{template "base/footer" .}} diff --git a/templates/repo/activity.tmpl b/templates/repo/activity.tmpl new file mode 100644 index 00000000..19a09b99 --- /dev/null +++ b/templates/repo/activity.tmpl @@ -0,0 +1,19 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository commits"> + {{template "repo/header" .}} + <div class="ui container flex-container"> + {{if and (not .IsEmptyRepo) (.Permission.CanRead $.UnitTypeCode)}} + <div class="flex-container-nav"> + {{template "repo/navbar" .}} + </div> + {{end}} + <div class="flex-container-main"> + {{if .PageIsPulse}}{{template "repo/pulse" .}}{{end}} + {{if .PageIsContributors}}{{template "repo/contributors" .}}{{end}} + {{if .PageIsCodeFrequency}}{{template "repo/code_frequency" .}}{{end}} + {{if .PageIsRecentCommits}}{{template "repo/recent_commits" .}}{{end}} + </div> + </div> +</div> +{{template "base/footer" .}} + diff --git a/templates/repo/admin_flags.tmpl b/templates/repo/admin_flags.tmpl new file mode 100644 index 00000000..2a65c9c6 --- /dev/null +++ b/templates/repo/admin_flags.tmpl @@ -0,0 +1,8 @@ +{{if .Repository.IsFlagged $.Context}} + <div class="ui info message" style="text-align: left"> + <strong>{{ctx.Locale.Tr "repo.admin.enabled_flags"}}</strong> + {{range .Repository.ListFlags $.Context}} + <span class="ui label">{{.Name}}</span> + {{end}} + </div> +{{end}} diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl new file mode 100644 index 00000000..58be0b17 --- /dev/null +++ b/templates/repo/blame.tmpl @@ -0,0 +1,96 @@ +{{if or .UsesIgnoreRevs .FaultyIgnoreRevsFile}} + {{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.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> + </div> + {{else}} + <div class="ui error message"> + <p>{{ctx.Locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink}}</p> + </div> + {{end}} +{{end}} +<div class="{{TabSizeClass .Editorconfig .FileName}} 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" .}} + </div> + <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}} + <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> + <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> + </div> + </h4> + <div class="ui bottom attached table unstackable segment"> + <div class="file-view code-view unicode-escaped"> + {{if .IsFileTooLarge}} + <table> + <tbody> + <tr> + <td class="gt-text-center tw-p-0.5"><strong>{{ctx.Locale.Tr "repo.file_too_large"}}</strong></td> + </tr> + </tbody> + </table> + {{else}} + <table> + <tbody> + {{range $row := .BlameRows}} + <tr class="{{if and (gt $.CommitCnt 1) ($row.CommitMessage)}}top-line-blame{{end}}"> + <td class="lines-commit"> + <div class="blame-info"> + <div class="blame-data"> + <div class="blame-avatar"> + {{$row.Avatar}} + </div> + <div class="blame-message"> + <a class="suppressed tw-text-text" href="{{$row.CommitURL}}" title="{{$row.CommitMessage}}"> + {{$row.CommitMessage}} + </a> + </div> + <div class="blame-time not-mobile"> + {{$row.CommitSince}} + </div> + </div> + </div> + </td> + <td class="lines-blame-btn"> + {{if $row.PreviousSha}} + <a role="button" class="muted" href="{{$row.PreviousShaURL}}" data-tooltip-content='{{ctx.Locale.Tr "repo.blame_prior"}}'> + {{svg "octicon-versions"}} + </a> + {{end}} + </td> + <td class="lines-num"> + <span id="L{{$row.RowNumber}}" data-line-number="{{$row.RowNumber}}"></span> + </td> + {{if $.EscapeStatus.Escaped}} + <td class="lines-escape"> + {{if $row.EscapeStatus.Escaped}} + <button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $row}}"></button> + {{end}} + </td> + {{end}} + <td rel="L{{$row.RowNumber}}" class="lines-code blame-code chroma"> + <code class="code-inner">{{$row.Code}}</code> + </td> + </tr> + {{end}} + </tbody> + </table> + <div class="code-line-menu tippy-target"> + {{if $.Permission.CanRead $.UnitTypeIssues}} + <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 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> +</div> diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl new file mode 100644 index 00000000..6a0b726b --- /dev/null +++ b/templates/repo/branch/list.tmpl @@ -0,0 +1,256 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content ui repository branches"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{template "repo/sub_menu" .}} + {{if .DefaultBranchBranch}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.default_branch"}} + {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}} + <a role="button" class="right" href="{{.RepoLink}}/settings/branches" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.branches.switch_default_branch"}}"> + {{svg "octicon-arrow-switch"}} + </a> + {{end}} + </h4> + + <div class="ui attached table segment"> + <table class="ui very basic striped fixed table single line"> + <tbody> + <tr> + <td> + <div class="flex-text-block"> + {{if .DefaultBranchBranch.IsProtected}}{{svg "octicon-shield-lock"}}{{end}} + <a class="gt-ellipsis" href="{{.RepoLink}}/src/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{.DefaultBranchBranch.DBBranch.Name}}</a> + <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}">{{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">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage (.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime ctx.Locale)}} {{if .DefaultBranchBranch.DBBranch.Pusher}} {{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p> + </td> + <td class="right aligned middle aligned 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" + data-branch-from="{{$.DefaultBranchBranch.DBBranch.Name}}" + data-branch-from-urlcomponent="{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}" + data-tooltip-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" ($.DefaultBranchBranch.DBBranch.Name)}}" + > + {{svg "octicon-git-branch"}} + </button> + {{end}} + {{if .EnableFeed}} + <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DefaultBranchBranch.DBBranch.Name}}">{{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)}}"> + {{svg "octicon-download"}} + <div class="menu"> + <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} ZIP</a> + <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} TAR.GZ</a> + </div> + </div> + {{end}} + {{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted) (not $.IsMirror)}} + <button class="btn interact-bg tw-p-2 show-modal show-rename-branch-modal" + data-is-default-branch="true" + data-modal="#rename-branch-modal" + data-old-branch-name="{{$.DefaultBranchBranch.DBBranch.Name}}" + data-tooltip-content="{{ctx.Locale.Tr "repo.branch.rename" ($.DefaultBranchBranch.DBBranch.Name)}}" + > + {{svg "octicon-pencil"}} + </button> + {{end}} + </td> + </tr> + </tbody> + </table> + </div> + {{end}} + + <h4 class="ui top attached header tw-flex tw-items-center tw-justify-between"> + <div class="tw-flex tw-items-center"> + {{ctx.Locale.Tr "repo.branches"}} + </div> + </h4> + + <div class="ui attached segment"> + <form class="ignore-dirty" method="get"> + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.branch_kind")}} + </form> + </div> + + <div class="ui attached table segment"> + <table class="ui very basic striped fixed table single line"> + <tbody> + {{range .Branches}} + <tr> + <td class="eight wide"> + {{if .DBBranch.IsDeleted}} + <div class="flex-text-block"> + <span class="gt-ellipsis">{{.DBBranch.Name}}</span> + <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button> + </div> + <p class="info">{{ctx.Locale.Tr "repo.branch.deleted_by" .DBBranch.DeletedBy.Name}} {{TimeSinceUnix .DBBranch.DeletedUnix ctx.Locale}}</p> + {{else}} + <div class="flex-text-block"> + {{if .IsProtected}}{{svg "octicon-shield-lock"}}{{end}} + <a class="gt-ellipsis" href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments .DBBranch.Name}}">{{.DBBranch.Name}}</a> + <button class="btn interact-fg tw-px-1" data-clipboard-text="{{.DBBranch.Name}}">{{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">{{RenderCommitMessage $.Context .DBBranch.CommitMessage ($.Repository.ComposeMetas ctx)}}</span> · {{ctx.Locale.Tr "org.repo_updated" (TimeSince .DBBranch.CommitTime.AsTime ctx.Locale)}} {{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"> + <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 cause any problem. */}} + <div class="bar bar-behind" style="width: {{Eval 100 "*" .CommitsBehind "/" "(" .CommitsBehind "+" .CommitsAhead "+" 0.0 ")"}}%"></div> + </div> + <div class="bar-group"> + <div class="count count-ahead">{{.CommitsAhead}}</div> + <div class="bar bar-ahead" style="width: {{Eval 100 "*" .CommitsAhead "/" "(" .CommitsBehind "+" .CommitsAhead "+" 0.0 ")"}}%"></div> + </div> + </div> + {{end}} + </td> + <td class="two wide right aligned"> + {{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}}"> + <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}}"> + <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}} + <a href="{{.LatestPullRequest.Issue.Link}}" class="tw-align-middle ref-issue">{{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}}</a> + {{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> + {{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> + <td class="three wide right aligned 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}}" + data-branch-from-urlcomponent="{{PathEscapeSegments .DBBranch.Name}}" + data-tooltip-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" .DBBranch.Name}}" + data-modal="#create-branch-modal" data-name="{{.DBBranch.Name}}" + > + {{svg "octicon-git-branch"}} + </button> + {{end}} + {{if $.EnableFeed}} + <a role="button" class="btn interact-bg tw-p-2" href="{{$.FeedURL}}/rss/branch/{{PathEscapeSegments .DBBranch.Name}}">{{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)}}"> + {{svg "octicon-download"}} + <div class="menu"> + <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} ZIP</a> + <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} TAR.GZ</a> + </div> + </div> + {{end}} + {{if and $.IsWriter (not $.Repository.IsArchived) (not .DBBranch.IsDeleted) (not $.IsMirror)}} + <button class="btn interact-bg tw-p-2 show-modal show-rename-branch-modal" + data-is-default-branch="false" + data-old-branch-name="{{.DBBranch.Name}}" + data-modal="#rename-branch-modal" + data-tooltip-content="{{ctx.Locale.Tr "repo.branch.rename" (.DBBranch.Name)}}" + > + {{svg "octicon-pencil"}} + </button> + {{end}} + {{if and $.IsWriter (not $.IsMirror) (not $.Repository.IsArchived) (not .IsProtected)}} + {{if .DBBranch.IsDeleted}} + <button class="btn interact-bg tw-p-2 link-action restore-branch-button" data-url="{{$.Link}}/restore?branch_id={{.DBBranch.ID}}&name={{.DBBranch.Name}}&page={{$.Page.Paginater.Current}}" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.restore" (.DBBranch.Name)}}"> + <span class="text blue"> + {{svg "octicon-reply"}} + </span> + </button> + {{else}} + <button class="btn interact-bg tw-p-2 delete-button delete-branch-button" data-url="{{$.Link}}/delete?name={{.DBBranch.Name}}&page={{$.Page.Paginater.Current}}" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.delete" (.DBBranch.Name)}}" data-name="{{.DBBranch.Name}}"> + {{svg "octicon-trash"}} + </button> + {{end}} + {{end}} + </td> + </tr> + {{end}} + </tbody> + </table> + </div> + {{template "base/paginate" .}} + </div> +</div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.branch.delete_html"}} <span class="name"></span> + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.branch.delete_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +<div class="ui mini modal" id="create-branch-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.branch.new_branch"}} + </div> + + <form class="ui form" id="create-branch-form" action="" data-base-action="{{.Link}}/_new/branch/" method="post"> + <div class="content"> + {{.CsrfTokenHtml}} + <div class="field"> + {{ctx.Locale.Tr "repo.branch.create_new_branch"}} + <span id="modal-create-branch-from-span"></span> + </div> + <div class="required field"> + <label for="new_branch_name">{{ctx.Locale.Tr "repo.branch.name"}}</label> + <input id="new_branch_name" name="new_branch_name" required> + </div> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> +</div> + +<div class="ui mini modal" id="rename-branch-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.rename_branch"}} + </div> + <form class="ui form" action="{{$.Repository.Link}}/settings/rename_branch" method="post"> + <div class="content"> + {{.CsrfTokenHtml}} + <div class="field default-branch-warning"> + <span class="text red">{{ctx.Locale.Tr "repo.branch.warning_rename_default_branch"}}</span> + </div> + <div class="field"> + <span class="text" data-rename-branch-to="{{ctx.Locale.Tr "repo.branch.rename_branch_to"}}"></span> + </div> + <input name="from" type="hidden" required> + <div class="required field"> + <input name="to" required> + </div> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl new file mode 100644 index 00000000..dcb17924 --- /dev/null +++ b/templates/repo/branch_dropdown.tmpl @@ -0,0 +1,89 @@ +{{/* Attributes: +* root +* ContainerClasses +* (TODO: search "branch_dropdown" in the template directory) +*/}} +{{$defaultSelectedRefName := $.root.BranchName}} +{{if and .root.IsViewTag (not .noTag)}} + {{$defaultSelectedRefName = .root.TagName}} +{{end}} +{{if eq $defaultSelectedRefName ""}} + {{$defaultSelectedRefName = $.root.Repository.DefaultBranch}} +{{end}} + +{{$type := ""}} +{{if and .root.IsViewTag (not .noTag)}} + {{$type = "tag"}} +{{else if .root.IsViewBranch}} + {{$type = "branch"}} +{{else}} + {{$type = "tree"}} +{{end}} + +{{$showBranchesInDropdown := not .root.HideBranchesInDropdown}} + +<script type="module"> + const data = { + 'textReleaseCompare': {{ctx.Locale.Tr "repo.release.compare"}}, + 'textCreateTag': {{ctx.Locale.Tr "repo.tag.create_tag"}}, + 'textCreateBranch': {{ctx.Locale.Tr "repo.branch.create_branch"}}, + 'textCreateBranchFrom': {{ctx.Locale.Tr "repo.branch.create_from"}}, + 'textBranches': {{ctx.Locale.Tr "repo.branches"}}, + 'textTags': {{ctx.Locale.Tr "repo.tags"}}, + 'textDefaultBranchLabel': {{ctx.Locale.Tr "repo.default_branch_label"}}, + + 'mode': '{{if or .root.IsViewTag .isTag}}tags{{else}}branches{{end}}', + 'showBranchesInDropdown': {{$showBranchesInDropdown}}, + 'searchFieldPlaceholder': '{{if $.noTag}}{{ctx.Locale.Tr "repo.pulls.filter_branch"}}{{else if $showBranchesInDropdown}}{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}{{else}}{{ctx.Locale.Tr "repo.find_tag"}}{{end}}...', + 'branchForm': {{$.branchForm}}, + 'disableCreateBranch': {{if .disableCreateBranch}}{{.disableCreateBranch}}{{else}}{{not .root.CanCreateBranch}}{{end}}, + 'setAction': {{.setAction}}, + 'submitForm': {{.submitForm}}, + 'viewType': {{$type}}, + 'refName': {{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}, + 'commitIdShort': {{ShortSha .root.CommitID}}, + 'tagName': {{.root.TagName}}, + 'branchName': {{.root.BranchName}}, + 'noTag': {{.noTag}}, + 'defaultSelectedRefName': {{$defaultSelectedRefName}}, + 'repoDefaultBranch': {{.root.Repository.DefaultBranch}}, + 'enableFeed': {{.root.EnableFeed}}, + 'rssURLPrefix': '{{$.root.RepoLink}}/rss/branch/', + 'branchURLPrefix': '{{if .branchURLPrefix}}{{.branchURLPrefix}}{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/branch/{{end}}', + 'branchURLSuffix': '{{if .branchURLSuffix}}{{.branchURLSuffix}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}', + 'tagURLPrefix': '{{if .tagURLPrefix}}{{.tagURLPrefix}}{{else if .release}}{{$.root.RepoLink}}/compare/{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{end}}', + 'tagURLSuffix': '{{if .tagURLSuffix}}{{.tagURLSuffix}}{{else if .release}}...{{if .release.IsDraft}}{{PathEscapeSegments .release.Target}}{{else}}{{if .release.TagName}}{{PathEscapeSegments .release.TagName}}{{else}}{{PathEscapeSegments .release.Sha1}}{{end}}{{end}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}', + 'repoLink': {{.root.RepoLink}}, + 'treePath': {{.root.TreePath}}, + 'branchNameSubURL': {{.root.BranchNameSubURL}}, + 'noResults': {{ctx.Locale.Tr "repo.pulls.no_results"}}, + }; + {{if .release}} + data.release = { + 'tagName': {{.release.TagName}}, + }; + {{end}} + window.config.pageData.branchDropdownDataList = window.config.pageData.branchDropdownDataList || []; + window.config.pageData.branchDropdownDataList.push(data); +</script> + +<div class="js-branch-tag-selector {{if .ContainerClasses}}{{.ContainerClasses}}{{end}}"> + {{/* show dummy elements before Vue componment is mounted, this code must match the code in BranchTagSelector.vue */}} + <div class="ui dropdown custom"> + <button class="branch-dropdown-button gt-ellipsis ui basic small compact button tw-flex tw-m-0"> + <span class="text tw-flex tw-items-center tw-mr-1 gt-ellipsis"> + {{if .release}} + {{ctx.Locale.Tr "repo.release.compare"}} + {{else}} + {{if eq $type "tag"}} + {{svg "octicon-tag"}} + {{else}} + {{svg "octicon-git-branch"}} + {{end}} + <strong ref="dropdownRefName" class="tw-ml-2 tw-inline-block gt-ellipsis">{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}</strong> + {{end}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </button> + </div> +</div> diff --git a/templates/repo/cite/cite_buttons.tmpl b/templates/repo/cite/cite_buttons.tmpl new file mode 100644 index 00000000..5a6de23c --- /dev/null +++ b/templates/repo/cite/cite_buttons.tmpl @@ -0,0 +1,8 @@ +<span class="ui citation label primary" id="citation-copy-bibtex" data-text=""> +BibTeX +</span> +<!-- the value will be updated by initCitationFileCopyContent, the code below is used to avoid UI flicking --> +<input id="citation-copy-content" value="" size="1" readonly> +<button class="ui icon button" id="citation-clipboard-btn" data-tooltip-content="{{ctx.Locale.Tr "copy"}}" data-clipboard-target="#citation-copy-content"> + {{svg "octicon-copy"}} +</button> diff --git a/templates/repo/cite/cite_modal.tmpl b/templates/repo/cite/cite_modal.tmpl new file mode 100644 index 00000000..fb251442 --- /dev/null +++ b/templates/repo/cite/cite_modal.tmpl @@ -0,0 +1,20 @@ +<div class="ui small modal" id="cite-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.cite_this_repo"}} + </div> + <div class="content"> + <div class="ui stackable secondary menu"> + <div class="ui action input" id="citation-panel"> + {{template "repo/cite/cite_buttons" .}} + <a id="goto-citation-btn" class="ui basic jump icon button" href="{{$.RepoLink}}/src/{{$.BranchName}}/CITATION.cff" data-tooltip-content="{{ctx.Locale.Tr "repo.find_file.go_to_file"}}"> + {{svg "octicon-file-moved"}} + </a> + </div> + </div> + </div> + <div class="actions"> + <button class="ui cancel button"> + {{ctx.Locale.Tr "cancel"}} + </button> + </div> +</div> diff --git a/templates/repo/clone_buttons.tmpl b/templates/repo/clone_buttons.tmpl new file mode 100644 index 00000000..89daba9d --- /dev/null +++ b/templates/repo/clone_buttons.tmpl @@ -0,0 +1,15 @@ +<!-- there is always at least one button (by context/repo.go) --> +{{if $.CloneButtonShowHTTPS}} + <button class="ui small button" id="repo-clone-https" data-link="{{$.CloneButtonOriginLink.HTTPS}}"> + HTTPS + </button> +{{end}} +{{if $.CloneButtonShowSSH}} + <button class="ui small button" id="repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}"> + SSH + </button> +{{end}} +<input id="repo-clone-url" size="20" class="js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly> +<button class="ui small icon button" id="clipboard-btn" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" data-clipboard-target="#repo-clone-url" aria-label="{{ctx.Locale.Tr "copy_url"}}"> + {{svg "octicon-copy" 14}} +</button> diff --git a/templates/repo/clone_script.tmpl b/templates/repo/clone_script.tmpl new file mode 100644 index 00000000..40dae76d --- /dev/null +++ b/templates/repo/clone_script.tmpl @@ -0,0 +1,50 @@ +<script> + // synchronously set clone button states and urls here to avoid flickering + // on page load. initRepoCloneLink calls this when proto changes. + // this applies the protocol-dependant clone url to all elements with the + // `js-clone-url` and `js-clone-url-vsc` classes. + // TODO: This localStorage setting should be moved to backend user config + // so it's available during rendering, then this inline script can be removed. + (window.updateCloneStates = function() { + const httpsBtn = document.getElementById('repo-clone-https'); + const sshBtn = document.getElementById('repo-clone-ssh'); + const value = localStorage.getItem('repo-clone-protocol') || 'https'; + const isSSH = value === 'ssh' && sshBtn || value !== 'ssh' && !httpsBtn; + + if (httpsBtn) { + httpsBtn.textContent = window.origin.split(':')[0].toUpperCase(); + httpsBtn.classList.toggle('primary', !isSSH); + httpsBtn.classList.toggle('basic', isSSH); + } + if (sshBtn) { + sshBtn.classList.toggle('primary', isSSH); + sshBtn.classList.toggle('basic', !isSSH); + } + + const btn = isSSH ? sshBtn : httpsBtn; + if (!btn) return; + + // NOTE: Keep this function in sync with the one in the js folder + function toOriginUrl(urlStr) { + try { + if (urlStr.startsWith('http://') || urlStr.startsWith('https://') || urlStr.startsWith('/')) { + const {origin, protocol, hostname, port} = window.location; + const url = new URL(urlStr, origin); + url.protocol = protocol; + url.hostname = hostname; + url.port = port || (protocol === 'https:' ? '443' : '80'); + return url.toString(); + } + } catch {} + return urlStr; + } + const link = toOriginUrl(btn.getAttribute('data-link')); + + for (const el of document.getElementsByClassName('js-clone-url')) { + el[el.nodeName === 'INPUT' ? 'value' : 'textContent'] = link; + } + for (const el of document.getElementsByClassName('js-clone-url-editor')) { + el.href = el.getAttribute('data-href-template').replace('{url}', encodeURIComponent(link)); + } + })(); +</script> diff --git a/templates/repo/code/recently_pushed_new_branches.tmpl b/templates/repo/code/recently_pushed_new_branches.tmpl new file mode 100644 index 00000000..d996acc5 --- /dev/null +++ b/templates/repo/code/recently_pushed_new_branches.tmpl @@ -0,0 +1,17 @@ +{{range .RecentlyPushedNewBranches}} + <div class="ui positive message tw-flex tw-items-center tw-gap-2"> + <div class="tw-flex-1 tw-break-anywhere"> + {{$timeSince := TimeSince .CommitTime.AsTime ctx.Locale}} + {{$repo := .GetRepo $.Context}} + {{$name := .Name}} + {{if ne $repo.ID $.Repository.ID}} + {{$name = (print $repo.FullName ":" .Name)}} + {{end}} + {{$branchLink := (print ($repo.Link) "/src/branch/" (PathEscapeSegments .Name))}} + {{ctx.Locale.Tr "repo.pulls.recently_pushed_new_branches" $name $timeSince $branchLink}} + </div> + <a role="button" class="ui compact positive button tw-m-0" href="{{$.Repository.ComposeBranchCompareURL $.Repository.BaseRepo $name}}"> + {{ctx.Locale.Tr "repo.pulls.compare_changes"}} + </a> + </div> +{{end}} diff --git a/templates/repo/code_frequency.tmpl b/templates/repo/code_frequency.tmpl new file mode 100644 index 00000000..50ec1beb --- /dev/null +++ b/templates/repo/code_frequency.tmpl @@ -0,0 +1,9 @@ +{{if .Permission.CanRead $.UnitTypeCode}} + <div id="repo-code-frequency-chart" + data-locale-loading-title="{{ctx.Locale.Tr "graphs.component_loading" (ctx.Locale.Tr "graphs.code_frequency.what")}}" + data-locale-loading-title-failed="{{ctx.Locale.Tr "graphs.component_loading_failed" (ctx.Locale.Tr "graphs.code_frequency.what")}}" + data-locale-loading-info="{{ctx.Locale.Tr "graphs.component_loading_info"}}" + data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}" + > + </div> +{{end}} diff --git a/templates/repo/commit_load_branches_and_tags.tmpl b/templates/repo/commit_load_branches_and_tags.tmpl new file mode 100644 index 00000000..ffa0e530 --- /dev/null +++ b/templates/repo/commit_load_branches_and_tags.tmpl @@ -0,0 +1,20 @@ +{{if not .PageIsWiki}} +<div class="branch-and-tag-area" data-text-default-branch-tooltip="{{ctx.Locale.Tr "repo.commit.contained_in_default_branch"}}"> + <button class="ui button ellipsis-button load-branches-and-tags tw-mt-2" aria-expanded="false" + data-fetch-url="{{.RepoLink}}/commit/{{.CommitID}}/load-branches-and-tags" + data-tooltip-content="{{ctx.Locale.Tr "repo.commit.load_referencing_branches_and_tags"}}" + >...</button> + <div class="branch-and-tag-detail tw-hidden"> + <div class="divider"></div> + <div>{{ctx.Locale.Tr "repo.commit.contained_in"}}</div> + <div class="tw-flex tw-mt-2"> + <div class="tw-p-1">{{svg "octicon-git-branch"}}</div> + <div class="branch-area flex-text-block tw-flex-wrap tw-flex-1"></div> + </div> + <div class="tw-flex tw-mt-2"> + <div class="tw-p-1">{{svg "octicon-tag"}}</div> + <div class="tag-area flex-text-block tw-flex-wrap tw-flex-1"></div> + </div> + </div> +</div> +{{end}} diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl new file mode 100644 index 00000000..7fec88cb --- /dev/null +++ b/templates/repo/commit_page.tmpl @@ -0,0 +1,285 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository diff"> + {{template "repo/header" .}} + <div class="ui container fluid padded"> + {{$class := ""}} + {{if .Commit.Signature}} + {{$class = (print $class " isSigned")}} + {{if .Verification.Verified}} + {{if eq .Verification.TrustStatus "trusted"}} + {{$class = (print $class " isVerified")}} + {{else if eq .Verification.TrustStatus "untrusted"}} + {{$class = (print $class " isVerifiedUntrusted")}} + {{else}} + {{$class = (print $class " isVerifiedUnmatched")}} + {{end}} + {{else if .Verification.Warning}} + {{$class = (print $class " isWarning")}} + {{end}} + {{end}} + <div class="ui top attached header clearing segment tw-relative commit-header {{$class}}"> + <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}}">{{RenderCommitMessage $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3> + {{if not $.PageIsWiki}} + <div class="commit-header-buttons"> + <a class="ui primary tiny button" href="{{.SourcePath}}"> + {{ctx.Locale.Tr "repo.diff.browse_source"}} + </a> + {{if and ($.Permission.CanWrite $.UnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}{{- /* */ -}} + <div class="ui dropdown primary tiny button"> + {{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="divider"></div> + <div class="item show-create-branch-modal" + data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}} + data-branch-from="{{ShortSha .CommitID}}" + data-branch-from-urlcomponent="{{.CommitID}}" + data-modal="#create-branch-modal"> + {{ctx.Locale.Tr "repo.branch.create_branch_operation"}} + </div> + <div class="item show-create-branch-modal" + data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}} + data-branch-from="{{ShortSha .CommitID}}" + data-branch-from-urlcomponent="{{.CommitID}}" + data-modal="#create-tag-modal" + data-modal-from-span="#modal-create-tag-from-span" + data-modal-form="#create-tag-form"> + {{ctx.Locale.Tr "repo.tag.create_tag_operation"}} + </div> + <div class="item show-modal revert-button" + data-modal="#cherry-pick-modal" + data-modal-cherry-pick-type="revert" + data-modal-cherry-pick-header="{{ctx.Locale.Tr "repo.commit.revert-header" (ShortSha .CommitID)}}" + data-modal-cherry-pick-content="{{ctx.Locale.Tr "repo.commit.revert-content"}}" + data-modal-cherry-pick-submit="{{ctx.Locale.Tr "repo.commit.revert"}}">{{ctx.Locale.Tr "repo.commit.revert"}}</div> + <div class="item cherry-pick-button show-modal" + data-modal="#cherry-pick-modal" + data-modal-cherry-pick-type="cherry-pick" + data-modal-cherry-pick-header="{{ctx.Locale.Tr "repo.commit.cherry-pick-header" (ShortSha .CommitID)}}" + data-modal-cherry-pick-content="{{ctx.Locale.Tr "repo.commit.cherry-pick-content"}}" + data-modal-cherry-pick-submit="{{ctx.Locale.Tr "repo.commit.cherry-pick"}}">{{ctx.Locale.Tr "repo.commit.cherry-pick"}}</div> + <div class="ui g-modal-confirm modal" id="cherry-pick-modal"> + <div class="header"> + <span id="cherry-pick-header"></span> + </div> + <div class="content"> + <p id="cherry-pick-content" class="branch-dropdown"></p> + {{template "repo/branch_dropdown" dict "root" . + "noTag" true "disableCreateBranch" true + "branchForm" "branch-dropdown-form" + "branchURLPrefix" (printf "%s/_cherrypick/%s/" $.RepoLink .CommitID) "branchURLSuffix" "" + "setAction" true "submitForm" true}} + <form method="get" action="{{$.RepoLink}}/_cherrypick/{{.CommitID}}/{{if $.BranchName}}{{PathEscapeSegments $.BranchName}}{{else}}{{PathEscapeSegments $.Repository.DefaultBranch}}{{end}}" id="branch-dropdown-form"> + <input type="hidden" name="ref" value="{{if $.BranchName}}{{$.BranchName}}{{else}}{{$.Repository.DefaultBranch}}{{end}}"> + <input type="hidden" name="refType" value="branch"> + <input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br> + <button type="submit" id="cherry-pick-submit" class="ui primary button"></button> + </form> + </div> + </div> + <div class="ui small modal" id="create-branch-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.branch.new_branch"}} + </div> + <div class="content"> + <form class="ui form" id="create-branch-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.branch.new_branch_from" (`<span class="text" id="modal-create-branch-from-span"></span>`|SafeHTML)}} + </label> + </div> + <div class="required field"> + <label for="new_branch_name">{{ctx.Locale.Tr "repo.branch.name"}}</label> + <input id="new_branch_name" name="new_branch_name" required> + </div> + + <div class="text right 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> + </form> + </div> + </div> + <div class="ui small modal" id="create-tag-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.tag.create_tag_operation"}} + </div> + <div class="content"> + <form class="ui form" id="create-tag-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post"> + {{.CsrfTokenHtml}} + <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)}} + </label> + </div> + <div class="required field"> + <label for="new_branch_name">{{ctx.Locale.Tr "repo.release.tag_name"}}</label> + <input id="new_branch_name" name="new_branch_name" required> + </div> + + <div class="text right 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> + </form> + </div> + </div> + </div> + </div> + {{end}} + </div> + {{end}} + </div> + {{if IsMultilineCommitMessage .Commit.Message}} + <pre class="commit-body">{{RenderCommitBody $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}</pre> + {{end}} + {{template "repo/commit_load_branches_and_tags" .}} + </div> + <div class="ui attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap {{$class}}"> + <div class="tw-flex tw-items-center author"> + {{if .Author}} + {{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}} + {{if .Author.FullName}} + <a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a> + {{else}} + <a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a> + {{end}} + {{else}} + {{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "tw-mr-2"}} + <strong>{{.Commit.Author.Name}}</strong> + {{end}} + <span class="text grey tw-ml-2" id="authored-time">{{TimeSince .Commit.Author.When ctx.Locale}}</span> + {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} + <span class="text grey tw-mx-2">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span> + {{if ne .Verification.CommittingUser.ID 0}} + {{ctx.AvatarUtils.Avatar .Verification.CommittingUser 28 "tw-mx-2"}} + <a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a> + {{else}} + {{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "tw-mr-2"}} + <strong>{{.Commit.Committer.Name}}</strong> + {{end}} + {{end}} + </div> + <div class="tw-flex tw-items-center"> + {{if .Parents}} + <div> + <span>{{ctx.Locale.Tr "repo.diff.parent"}}</span> + {{range .Parents}} + {{if $.PageIsWiki}} + <a class="ui primary sha label" href="{{$.RepoLink}}/wiki/commit/{{PathEscape .}}">{{ShortSha .}}</a> + {{else}} + <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{PathEscape .}}">{{ShortSha .}}</a> + {{end}} + {{end}} + </div> + {{end}} + <div class="item"> + <span>{{ctx.Locale.Tr "repo.diff.commit"}}</span> + <span class="ui primary sha label">{{ShortSha .CommitID}}</span> + </div> + </div> + </div> + {{if .Commit.Signature}} + <div class="ui bottom attached message tw-text-left tw-flex tw-items-center tw-justify-between commit-header-row tw-flex-wrap tw-mb-0 {{$class}}"> + <div class="tw-flex tw-items-center"> + {{if .Verification.Verified}} + {{if ne .Verification.SigningUser.ID 0}} + {{svg "gitea-lock" 16 "tw-mr-2"}} + {{if eq .Verification.TrustStatus "trusted"}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span> + {{else if eq .Verification.TrustStatus "untrusted"}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}:</span> + {{else}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span> + {{end}} + {{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}} + <a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a> + {{else}} + <span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "tw-mr-2"}}</span> + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span> + {{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}} + <strong>{{.Verification.SigningUser.GetDisplayName}}</strong> + {{end}} + {{else}} + {{svg "gitea-unlock" 16 "tw-mr-2"}} + <span class="ui text">{{ctx.Locale.Tr .Verification.Reason}}</span> + {{end}} + </div> + <div class="tw-flex tw-items-center"> + {{if .Verification.Verified}} + {{if ne .Verification.SigningUser.ID 0}} + {{svg "octicon-verified" 16 "tw-mr-2"}} + {{if .Verification.SigningSSHKey}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{.Verification.SigningSSHKey.Fingerprint}} + {{else}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{else}} + {{svg "octicon-unverified" 16 "tw-mr-2"}} + {{if .Verification.SigningSSHKey}} + <span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{.Verification.SigningSSHKey.Fingerprint}} + {{else}} + <span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{end}} + {{else if .Verification.Warning}} + {{svg "octicon-unverified" 16 "tw-mr-2"}} + {{if .Verification.SigningSSHKey}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{.Verification.SigningSSHKey.Fingerprint}} + {{else}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{else}} + {{if .Verification.SigningKey}} + {{if ne .Verification.SigningKey.KeyID ""}} + {{svg "octicon-verified" 16 "tw-mr-2"}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{.Verification.SigningKey.PaddedKeyID}} + {{end}} + {{end}} + {{if .Verification.SigningSSHKey}} + {{if ne .Verification.SigningSSHKey.Fingerprint ""}} + {{svg "octicon-verified" 16 "tw-mr-2"}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{.Verification.SigningSSHKey.Fingerprint}} + {{end}} + {{end}} + {{end}} + </div> + </div> + {{end}} + {{if .NoteRendered}} + <div class="ui top attached header segment git-notes"> + {{svg "octicon-note" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.diff.git-notes"}}: + {{if .NoteAuthor}} + <a href="{{.NoteAuthor.HomeLink}}"> + {{if .NoteAuthor.FullName}} + <strong>{{.NoteAuthor.FullName}}</strong> + {{else}} + <strong>{{.NoteCommit.Author.Name}}</strong> + {{end}} + </a> + {{else}} + <strong>{{.NoteCommit.Author.Name}}</strong> + {{end}} + <span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When ctx.Locale}}</span> + </div> + <div class="ui bottom attached info segment git-notes"> + <pre class="commit-body">{{.NoteRendered | SanitizeHTML}}</pre> + </div> + {{end}} + {{template "repo/diff/box" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl new file mode 100644 index 00000000..eb700ab2 --- /dev/null +++ b/templates/repo/commit_status.tmpl @@ -0,0 +1,16 @@ +<!-- make sure this matches the color logic in web_src/js/components/DashboardRepoList.vue --> +{{if eq .State "pending"}} + {{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}} +{{end}} +{{if eq .State "success"}} + {{svg "octicon-check" 18 "commit-status icon text green"}} +{{end}} +{{if eq .State "error"}} + {{svg "gitea-exclamation" 18 "commit-status icon text red"}} +{{end}} +{{if eq .State "failure"}} + {{svg "octicon-x" 18 "commit-status icon text red"}} +{{end}} +{{if eq .State "warning"}} + {{svg "gitea-exclamation" 18 "commit-status icon text yellow"}} +{{end}} diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl new file mode 100644 index 00000000..f451ac06 --- /dev/null +++ b/templates/repo/commit_statuses.tmpl @@ -0,0 +1,14 @@ +{{if .Statuses}} + {{if and (eq (len .Statuses) 1) .Status.TargetURL}} + <a class="tw-align-middle {{.AdditionalClasses}} tw-no-underline" data-tippy="commit-statuses" href="{{.Status.TargetURL}}"> + {{template "repo/commit_status" .Status}} + </a> + {{else}} + <span class="tw-align-middle {{.AdditionalClasses}}" data-tippy="commit-statuses" tabindex="0"> + {{template "repo/commit_status" .Status}} + </span> + {{end}} + <div class="tippy-target"> + {{template "repo/pulls/status" (dict "CommitStatuses" .Statuses "CommitStatus" .Status)}} + </div> +{{end}} diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl new file mode 100644 index 00000000..86df88f6 --- /dev/null +++ b/templates/repo/commits.tmpl @@ -0,0 +1,23 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository commits"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "repo/sub_menu" .}} + <div class="repo-button-row"> + <div class="tw-flex tw-items-center"> + {{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mr-1"}} + <a href="{{.RepoLink}}/graph" class="ui basic small compact button"> + {{svg "octicon-git-branch"}} + {{ctx.Locale.Tr "repo.commit_graph"}} + </a> + </div> + </div> + {{template "repo/commits_table" .}} + {{if .OldFilename}} + <div class="ui bottom attached header"> + <span>{{ctx.Locale.Tr "repo.commits.renamed_from" .OldFilename}} (<a href="{{.OldFilenameHistory}}">{{ctx.Locale.Tr "repo.commits.browse_further"}}</a>)</span> + </div> + {{end}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl new file mode 100644 index 00000000..c8c695e3 --- /dev/null +++ b/templates/repo/commits_list.tmpl @@ -0,0 +1,96 @@ +<div class="ui attached table segment commit-table"> + <table class="ui very basic striped table unstackable" id="commits-table"> + <thead> + <tr> + <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="one wide"></th> + </tr> + </thead> + <tbody class="commit-list"> + {{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}} + {{range .Commits}} + <tr> + <td class="author"> + <div class="tw-flex"> + {{$userName := .Author.Name}} + {{if .User}} + {{if and .User.FullName DefaultShowFullName}} + {{$userName = .User.FullName}} + {{end}} + {{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}<a class="muted author-wrapper" href="{{.User.HomeLink}}">{{$userName}}</a> + {{else}} + {{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 28 "tw-mr-2"}} + <span class="author-wrapper">{{$userName}}</span> + {{end}} + </div> + </td> + <td class="sha"> + {{$class := "ui sha label"}} + {{if .Signature}} + {{$class = (print $class " isSigned")}} + {{if .Verification.Verified}} + {{if eq .Verification.TrustStatus "trusted"}} + {{$class = (print $class " isVerified")}} + {{else if eq .Verification.TrustStatus "untrusted"}} + {{$class = (print $class " isVerifiedUntrusted")}} + {{else}} + {{$class = (print $class " isVerifiedUnmatched")}} + {{end}} + {{else if .Verification.Warning}} + {{$class = (print $class " isWarning")}} + {{end}} + {{end}} + {{$commitShaLink := ""}} + {{if $.PageIsWiki}} + {{$commitShaLink = (printf "%s/wiki/commit/%s" $commitRepoLink (PathEscape .ID.String))}} + {{else if $.PageIsPullCommits}} + {{$commitShaLink = (printf "%s/pulls/%d/commits/%s" $commitRepoLink $.Issue.Index (PathEscape .ID.String))}} + {{else if $.Reponame}} + {{$commitShaLink = (printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String))}} + {{end}} + <a {{if $commitShaLink}}href="{{$commitShaLink}}"{{end}} class="{{$class}}"> + <span class="shortsha">{{ShortSha .ID.String}}</span> + {{if .Signature}}{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}{{end}} + </a> + </td> + <td class="message"> + <span class="message-wrapper"> + {{if $.PageIsWiki}} + <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | RenderEmoji $.Context}}</span> + {{else}} + {{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}} + <span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject $.Context .Message $commitLink ($.Repository.ComposeMetas ctx)}}</span> + {{end}} + </span> + {{if IsMultilineCommitMessage .Message}} + <button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button> + {{end}} + {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}} + {{if IsMultilineCommitMessage .Message}} + <pre class="commit-body tw-hidden">{{RenderCommitBody $.Context .Message ($.Repository.ComposeMetas ctx)}}</pre> + {{end}} + </td> + {{if .Committer}} + <td class="text right aligned">{{TimeSince .Committer.When ctx.Locale}}</td> + {{else}} + <td class="text right aligned">{{TimeSince .Author.When ctx.Locale}}</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}} + <a + class="btn interact-bg tw-p-2" + data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" + href="{{if $.FileName}}{{printf "%s/src/commit/%s/%s" $commitRepoLink (PathEscape .ID.String) (PathEscapeSegments $.FileName)}}{{else}}{{printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}}{{end}}"> + {{svg "octicon-file-code"}} + </a> + {{end}} + </td> + </tr> + {{end}} + </tbody> + </table> + </div> diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl new file mode 100644 index 00000000..4c67319b --- /dev/null +++ b/templates/repo/commits_list_small.tmpl @@ -0,0 +1,55 @@ +{{$index := 0}} +<div class="timeline-item commits-list"> +{{range .comment.Commits}} + {{$tag := printf "%s-%d" $.comment.HashTag $index}} + {{$index = Eval $index "+" 1}} + <div class="singular-commit" id="{{$tag}}"> + <span class="badge badge-commit">{{svg "octicon-git-commit"}}</span> + {{if .User}} + <a class="avatar" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}}</a> + {{else}} + {{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 20}} + {{end}} + + {{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}} + + <span class="tw-flex-1 tw-font-mono gt-ellipsis" title="{{.Summary}}"> + {{- RenderCommitMessageLinkSubject $.root.Context .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}} + </span> + + {{if IsMultilineCommitMessage .Message}} + <button class="ui button ellipsis-button show-panel toggle" data-panel="[data-singular-commit-body-for='{{$tag}}']">...</button> + {{end}} + + <span class="shabox tw-flex tw-items-center"> + {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}} + {{$class := "ui sha label"}} + {{if .Signature}} + {{$class = (print $class " isSigned")}} + {{if .Verification.Verified}} + {{if eq .Verification.TrustStatus "trusted"}} + {{$class = (print $class " isVerified")}} + {{else if eq .Verification.TrustStatus "untrusted"}} + {{$class = (print $class " isVerifiedUntrusted")}} + {{else}} + {{$class = (print $class " isVerifiedUnmatched")}} + {{end}} + {{else if .Verification.Warning}} + {{$class = (print $class " isWarning")}} + {{end}} + {{end}} + <a href="{{$commitLink}}" rel="nofollow" class="tw-ml-2 {{$class}}"> + <span class="shortsha">{{ShortSha .ID.String}}</span> + {{if .Signature}} + {{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}} + {{end}} + </a> + </span> + </div> + {{if IsMultilineCommitMessage .Message}} + <pre class="commit-body tw-ml-[33px] tw-hidden" data-singular-commit-body-for="{{$tag}}"> + {{- RenderCommitBody $.root.Context .Message ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}} + </pre> + {{end}} +{{end}} +</div> diff --git a/templates/repo/commits_search_dropdown.tmpl b/templates/repo/commits_search_dropdown.tmpl new file mode 100644 index 00000000..5aa3f4f3 --- /dev/null +++ b/templates/repo/commits_search_dropdown.tmpl @@ -0,0 +1,8 @@ +<div class="ui small dropdown selection"> + <input name="all" type="hidden" value="{{.All}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{if .All}}{{ctx.Locale.Tr "repo.commits.search_all"}}{{else}}{{ctx.Locale.Tr "repo.commits.search_branch"}}{{end}}</div> + <div class="menu"> + <div class="item" data-value="false">{{ctx.Locale.Tr "repo.commits.search_branch"}}</div> + <div class="item" data-value="true">{{ctx.Locale.Tr "repo.commits.search_all"}}</div> + </div> +</div> diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl new file mode 100644 index 00000000..7249becb --- /dev/null +++ b/templates/repo/commits_table.tmpl @@ -0,0 +1,36 @@ +<h4 class="ui top attached header commits-table tw-flex tw-items-center tw-justify-between"> + <div class="commits-table-left tw-flex tw-items-center"> + {{if or .PageIsCommits (gt .CommitCount 0)}} + {{ctx.Locale.TrN .CommitCount "repo.n_commit_one" "repo.n_commit_few" (StringUtils.ToString .CommitCount)}} + {{else if .IsNothingToCompare}} + {{ctx.Locale.Tr "repo.commits.nothing_to_compare"}} + {{else}} + {{ctx.Locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}} + {{end}} + </div> + {{if .IsDiffCompare}} + <div class="commits-table-right tw-whitespace-nowrap"> + <a href="{{$.CommitRepoLink}}/commit/{{.BeforeCommitID | PathEscape}}" class="ui green sha label tw-mx-0">{{if not .BaseIsCommit}}{{if .BaseIsBranch}}{{svg "octicon-git-branch"}}{{else if .BaseIsTag}}{{svg "octicon-tag"}}{{end}}{{.BaseBranch}}{{else}}{{ShortSha .BaseBranch}}{{end}}</a> + ... + <a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID | PathEscape}}" class="ui green sha label tw-mx-0">{{if not .HeadIsCommit}}{{if .HeadIsBranch}}{{svg "octicon-git-branch"}}{{else if .HeadIsTag}}{{svg "octicon-tag"}}{{end}}{{.HeadBranch}}{{else}}{{ShortSha .HeadBranch}}{{end}}</a> + </div> + {{end}} +</h4> + +{{if .PageIsCommits}} + <div class="ui attached segment"> + <form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/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" .}} + {{template "shared/search/button" dict "Tooltip" (ctx.Locale.Tr "repo.commits.search.tooltip")}} + </div> + </form> + </div> +{{end}} + +{{if and .Commits (gt .CommitCount 0)}} + {{template "repo/commits_list" .}} +{{end}} + +{{template "base/paginate" .}} diff --git a/templates/repo/contributors.tmpl b/templates/repo/contributors.tmpl new file mode 100644 index 00000000..f7f5d796 --- /dev/null +++ b/templates/repo/contributors.tmpl @@ -0,0 +1,14 @@ +{{if .Permission.CanRead $.UnitTypeCode}} + <div id="repo-contributors-chart" + data-repo-link="{{.RepoLink}}" + data-locale-filter-label="{{ctx.Locale.Tr "repo.contributors.contribution_type.filter_label"}}" + data-locale-contribution-type-commits="{{ctx.Locale.Tr "repo.contributors.contribution_type.commits"}}" + data-locale-contribution-type-additions="{{ctx.Locale.Tr "repo.contributors.contribution_type.additions"}}" + data-locale-contribution-type-deletions="{{ctx.Locale.Tr "repo.contributors.contribution_type.deletions"}}" + data-locale-loading-title="{{ctx.Locale.Tr "graphs.component_loading" (ctx.Locale.Tr "graphs.contributors.what")}}" + data-locale-loading-title-failed="{{ctx.Locale.Tr "graphs.component_loading_failed" (ctx.Locale.Tr "graphs.contributors.what")}}" + data-locale-loading-info="{{ctx.Locale.Tr "graphs.component_loading_info"}}" + data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}" + > + </div> +{{end}} diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl new file mode 100644 index 00000000..3afd978e --- /dev/null +++ b/templates/repo/create.tmpl @@ -0,0 +1,224 @@ +{{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" 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> + {{end}} + </div> + </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">{{ctx.Locale.Tr "repo.repo_name_helper"}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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> + </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> + <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="ui checkbox"> + <input name="labels" type="checkbox" {{if .labels}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template.issue_labels"}}</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><p>({{.Description}})</p></div> + {{end}} + </div> + </div> + </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> + <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> + <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> + </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> + </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> + </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> + </div> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/create_helper.tmpl b/templates/repo/create_helper.tmpl new file mode 100644 index 00000000..70c28b72 --- /dev/null +++ b/templates/repo/create_helper.tmpl @@ -0,0 +1,3 @@ +{{if not $.DisableMigrations}} + <p class="ui center">{{ctx.Locale.Tr "repo.new_repo_helper" (print AppSubUrl "/repo/migrate")}}</p> +{{end}} diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl new file mode 100644 index 00000000..d6ab87fd --- /dev/null +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -0,0 +1,80 @@ +{{if $.IsSplitStyle}} + {{range $k, $line := $.section.Lines}} + <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}"> + {{if eq .GetType 4}} + <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"> + <div class="tw-flex"> + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=down&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}"> + {{svg "octicon-fold-down"}} + </button> + {{end}} + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=up&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}"> + {{svg "octicon-fold-up"}} + </button> + {{end}} + {{if eq $line.GetExpandDirection 2}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}"> + {{svg "octicon-fold"}} + </button> + {{end}} + </div> + </td> + <td colspan="7" class="lines-code lines-code-old ">{{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}}{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}</td> + {{else}} + {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}} + <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$.FileNameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> + <td class="blob-excerpt lines-escape lines-escape-old">{{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td> + <td class="blob-excerpt lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td> + <td class="blob-excerpt lines-code lines-code-old">{{/* + */}}{{if $line.LeftIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/* + */}}<code class="code-inner"></code>{{/* + */}}{{end}}{{/* + */}}</td> + <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$.FileNameHash}}R{{$line.RightIdx}}{{end}}"></span></td> + <td class="blob-excerpt lines-escape lines-escape-new">{{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td> + <td class="blob-excerpt lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td> + <td class="blob-excerpt lines-code lines-code-new">{{/* + */}}{{if $line.RightIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/* + */}}<code class="code-inner"></code>{{/* + */}}{{end}}{{/* + */}}</td> + {{end}} + </tr> + {{end}} +{{else}} + {{range $k, $line := $.section.Lines}} + <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}"> + {{if eq .GetType 4}} + <td colspan="2" class="lines-num"> + <div class="tw-flex"> + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}"> + {{svg "octicon-fold-down"}} + </button> + {{end}} + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}"> + {{svg "octicon-fold-up"}} + </button> + {{end}} + {{if eq $line.GetExpandDirection 2}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}"> + {{svg "octicon-fold"}} + </button> + {{end}} + </div> + </td> + {{else}} + <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$.FileNameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> + <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$.FileNameHash}}R{{$line.RightIdx}}{{end}}"></span></td> + {{end}} + {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}} + <td class="blob-excerpt lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td> + <td class="blob-excerpt lines-type-marker"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> + <td class="blob-excerpt lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"><code {{if $inlineDiff.EscapeStatus.Escaped}}class="code-inner has-escaped" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"{{else}}class="code-inner"{{end}}>{{$inlineDiff.Content}}</code></td> + </tr> + {{end}} +{{end}} diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl new file mode 100644 index 00000000..230e4975 --- /dev/null +++ b/templates/repo/diff/box.tmpl @@ -0,0 +1,260 @@ +{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}} +<div> + <div class="diff-detail-box diff-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"}}"> + {{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}} + {{svg "octicon-sidebar-collapse" 20 "icon tw-hidden"}} + {{svg "octicon-sidebar-expand" 20 "icon tw-hidden"}} + </button> + <script> + // Default to true if unset + const diffTreeVisible = localStorage?.getItem('diff_file_tree_visible') !== 'false'; + const diffTreeBtn = document.querySelector('.diff-toggle-file-tree-button'); + const diffTreeIcon = `.octicon-sidebar-${diffTreeVisible ? 'expand' : 'collapse'}`; + diffTreeBtn.querySelector(diffTreeIcon).classList.remove('tw-hidden'); + diffTreeBtn.setAttribute('data-tooltip-content', diffTreeBtn.getAttribute(diffTreeVisible ? 'data-hide-text' : 'data-show-text')); + </script> + {{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}} + </div> + {{end}} + </div> + <div class="diff-detail-actions button-row"> + {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (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}} + </label> + <progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.Diff.NumFiles}}"></progress> + </div> + {{end}} + {{template "repo/diff/whitespace_dropdown" .}} + {{template "repo/diff/options_dropdown" .}} + {{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"> + {{svg "octicon-git-commit"}} + </div> + </div> + {{end}} + {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}} + {{template "repo/diff/new_review" .}} + {{end}} + </div> + </div> + {{if not .DiffNotAvailable}} + {{if and .IsShowingOnlySingleCommit .PageIsPullFiles}} + <div class="ui info message"> + <div>{{ctx.Locale.Tr "repo.pulls.showing_only_single_commit" (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> + {{else if and (not .IsShowingAllCommits) .PageIsPullFiles}} + <div class="ui info message"> + <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}} + <div id="diff-file-tree" class="tw-hidden not-mobile"></div> + <script> + if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('tw-hidden'); + </script> + {{end}} + {{if .DiffNotAvailable}} + <h4>{{ctx.Locale.Tr "repo.diff.data_not_available"}}</h4> + {{else}} + <div id="diff-file-boxes" class="sixteen wide column"> + {{range $i, $file := .Diff.Files}} + {{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}} + {{$blobBase := call $.GetBlobByPathForCommit $.BeforeCommit $file.OldName}} + {{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}} + {{$sniffedTypeBase := call $.GetSniffedTypeForBlob $blobBase}} + {{$sniffedTypeHead := call $.GetSniffedTypeForBlob $blobHead}} + {{$isImage:= or (call $.IsSniffedTypeAnImage $sniffedTypeBase) (call $.IsSniffedTypeAnImage $sniffedTypeHead)}} + {{$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}}> + <h4 class="diff-file-header sticky-2nd-row ui top attached header tw-font-normal tw-flex tw-items-center tw-justify-between tw-flex-wrap"> + <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}}"> + {{if $file.ShouldBeHidden}} + {{svg "octicon-chevron-right" 18}} + {{else}} + {{svg "octicon-chevron-down" 18}} + {{end}} + </button> + <div class="tw-font-semibold tw-flex tw-items-center tw-font-mono"> + {{if $file.IsBin}} + <span class="tw-ml-0.5 tw-mr-2"> + {{ctx.Locale.Tr "repo.diff.bin"}} + </span> + {{else}} + {{template "repo/diff/stats" dict "file" . "root" $}} + {{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_generic"}}" aria-label="{{ctx.Locale.Tr "copy_generic"}}">{{svg "octicon-copy" 14}}</button> + {{if $file.IsGenerated}} + <span class="ui label">{{ctx.Locale.Tr "repo.diff.generated"}}</span> + {{end}} + {{if $file.IsVendored}} + <span class="ui label">{{ctx.Locale.Tr "repo.diff.vendored"}}</span> + {{end}} + {{if and $file.Mode $file.OldMode}} + {{$old := ctx.Locale.Tr ($file.ModeTranslationKey $file.OldMode)}} + {{$new := ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}} + <span class="tw-mx-2 tw-font-mono tw-whitespace-nowrap">{{ctx.Locale.Tr "git.filemode.changed_filemode" $old $new}}</span> + {{else if $file.Mode}} + <span class="tw-mx-2 tw-font-mono tw-whitespace-nowrap">{{ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}}</span> + {{end}} + </span> + </div> + <div class="diff-file-header-actions tw-flex tw-items-center button-row tw-flex-wrap"> + {{if $showFileViewToggle}} + <div class="ui compact icon buttons"> + <button class="ui tiny basic button file-view-toggle" data-toggle-selector="#diff-source-{{$file.NameHash}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_source"}}">{{svg "octicon-code"}}</button> + <button class="ui tiny basic button file-view-toggle active" data-toggle-selector="#diff-rendered-{{$file.NameHash}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_rendered"}}">{{svg "octicon-file"}}</button> + </div> + {{end}} + {{if $file.IsProtected}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.diff.protected"}}</span> + {{end}} + {{if and $isReviewFile $file.HasChangedSinceLastReview}} + <span class="changed-since-last-review unselectable not-mobile">{{ctx.Locale.Tr "repo.pulls.has_changed_since_last_review"}}</span> + {{end}} + {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} + <button class="ui basic tiny button unescape-button not-mobile">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> + <button class="ui basic tiny button escape-button tw-hidden">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button> + {{end}} + {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} + {{if $file.IsDeleted}} + <a class="ui basic tiny button" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + {{else}} + <a class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + {{if and $.HeadBranchIsEditable (not $file.IsLFSFile)}} + <a class="ui basic tiny button" rel="nofollow" href="{{$.SourceRepoLink}}/_edit/{{PathEscapeSegments $.HeadBranch}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.editor.edit_this_file"}}</a> + {{end}} + {{end}} + {{end}} + {{if $isReviewFile}} + <label data-link="{{$.Issue.Link}}/viewed-files" data-headcommit="{{$.AfterCommitID}}" class="viewed-file-form unselectable{{if $file.IsViewed}} viewed-file-checked-form{{end}}"> + <input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{ctx.Locale.Tr "repo.pulls.has_viewed_file"}} + </label> + {{end}} + </div> + </h4> + <div class="diff-file-body ui attached unstackable table segment" {{if and $file.IsViewed $.IsShowingAllCommits}}data-folded="true"{{end}}> + <div id="diff-source-{{$file.NameHash}}" class="file-body file-code unicode-escaped code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $showFileViewToggle}} tw-hidden{{end}}"> + {{if or $file.IsIncomplete $file.IsBin}} + <div class="diff-file-body binary"> + {{if $file.IsIncomplete}} + {{if $file.IsIncompleteLineTooLong}} + {{ctx.Locale.Tr "repo.diff.file_suppressed_line_too_long"}} + {{else}} + {{ctx.Locale.Tr "repo.diff.file_suppressed"}} + <a class="ui basic tiny button diff-load-button" data-href="?file-only=true&files={{$file.Name}}&files={{$file.OldName}}">{{ctx.Locale.Tr "repo.diff.load"}}</a> + {{end}} + {{else}} + {{ctx.Locale.Tr "repo.diff.bin_not_shown"}} + {{end}} + </div> + {{else}} + <table class="chroma" data-new-comment-url="{{$.Issue.Link}}/files/reviews/new_comment" data-path="{{$file.Name}}"> + {{if $.IsSplitStyle}} + {{template "repo/diff/section_split" dict "file" . "root" $}} + {{else}} + {{template "repo/diff/section_unified" dict "file" . "root" $}} + {{end}} + </table> + {{end}} + </div> + {{if $showFileViewToggle}} + {{/* for image or CSV, it can have a horizontal scroll bar, there won't be review comment context menu (position absolute) which would be clipped by "overflow" */}} + <div id="diff-rendered-{{$file.NameHash}}" class="file-body file-code {{if $.IsSplitStyle}}code-diff-split{{else}}code-diff-unified{{end}} tw-overflow-x-scroll"> + <table class="chroma tw-w-full"> + {{if $isImage}} + {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead "sniffedTypeBase" $sniffedTypeBase "sniffedTypeHead" $sniffedTypeHead}} + {{else}} + {{template "repo/diff/csv_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead "sniffedTypeBase" $sniffedTypeBase "sniffedTypeHead" $sniffedTypeHead}} + {{end}} + </table> + </div> + {{end}} + </div> + </div> + {{end}} + + {{if .Diff.IsIncomplete}} + <div class="diff-file-box diff-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> + </h4> + </div> + {{end}} + </div> + {{end}} + </div> + + {{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}} + <template id="issue-comment-editor-template"> + <div class="ui comment form"> + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewUrl" (print $.Repository.Link "/markup") + "MarkdownPreviewContext" $.RepoLink + "TextareaName" "content" + "DropzoneParentContainer" ".ui.form" + )}} + {{if .IsAttachmentEnabled}} + <div class="field"> + {{template "repo/upload" .}} + </div> + {{end}} + <div class="text right edit buttons"> + <button class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> + <button class="ui primary save button">{{ctx.Locale.Tr "repo.issues.save"}}</button> + </div> + </div> + </template> + {{end}} + {{if (not .DiffNotAvailable)}} + {{template "repo/issue/view_content/reference_issue_dialog" .}} + {{end}} +</div> diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl new file mode 100644 index 00000000..856b3da0 --- /dev/null +++ b/templates/repo/diff/comment_form.tmpl @@ -0,0 +1,49 @@ +{{if and $.root.SignedUserID (not $.Repository.IsArchived)}} + <form class="ui form {{if $.hidden}}tw-hidden comment-form{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post"> + {{$.root.CsrfTokenHtml}} + <input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}"> + <input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}"> + <input type="hidden" name="side" value="{{if $.Side}}{{$.Side}}{{end}}"> + <input type="hidden" name="line" value="{{if $.Line}}{{$.Line}}{{end}}"> + <input type="hidden" name="path" value="{{if $.File}}{{$.File}}{{end}}"> + <input type="hidden" name="diff_start_cid"> + <input type="hidden" name="diff_end_cid"> + <input type="hidden" name="diff_base_cid"> + + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewUrl" (print $.root.Repository.Link "/markup") + "MarkdownPreviewContext" $.root.RepoLink + "TextareaName" "content" + "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder") + "DropzoneParentContainer" "form" + "DisableAutosize" "true" + )}} + + {{if $.root.IsAttachmentEnabled}} + <div class="field"> + {{template "repo/upload" $.root}} + </div> + {{end}} + + <div class="field footer tw-mx-2"> + <span class="markup-info">{{svg "octicon-markdown"}} {{ctx.Locale.Tr "repo.diff.comment.markdown_info"}}</span> + <div class="tw-text-right"> + {{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}}"> + <input type="hidden" name="single_review" value="true"> + {{else}} + {{if $.root.CurrentReview}} + <button name="pending_review" type="submit" class="ui submit primary tiny button btn-add-comment">{{ctx.Locale.Tr "repo.diff.comment.add_review_comment"}}</button> + {{else}} + <button name="pending_review" type="submit" class="ui submit primary tiny button btn-start-review">{{ctx.Locale.Tr "repo.diff.comment.start_review"}}</button> + <button name="single_review" value="true" type="submit" class="ui submit tiny basic button btn-add-single">{{ctx.Locale.Tr "repo.diff.comment.add_single_comment"}}</button> + {{end}} + {{end}} + {{if or (not $.HasComments) $.hidden}} + <button type="button" class="ui submit tiny basic button btn-cancel cancel-code-comment">{{ctx.Locale.Tr "cancel"}}</button> + {{end}} + </div> + </div> + </form> +{{end}} diff --git a/templates/repo/diff/comment_form_datahandler.tmpl b/templates/repo/diff/comment_form_datahandler.tmpl new file mode 100644 index 00000000..d0e49348 --- /dev/null +++ b/templates/repo/diff/comment_form_datahandler.tmpl @@ -0,0 +1,7 @@ +{{if $.comment}} + {{template "repo/diff/comment_form" dict "root" $.root "hidden" $.hidden "reply" $.reply "Line" $.comment.UnsignedLine "File" $.comment.TreePath "Side" $.comment.DiffSide "HasComments" true}} +{{else if $.root}} + {{template "repo/diff/comment_form" $}} +{{else}} + {{template "repo/diff/comment_form" dict "root" $}} +{{end}} diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl new file mode 100644 index 00000000..2e0c85d0 --- /dev/null +++ b/templates/repo/diff/comments.tmpl @@ -0,0 +1,75 @@ +{{range .comments}} + +{{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} +<div class="comment" id="{{.HashTag}}"> + {{if .OriginalAuthor}} + <span class="avatar">{{ctx.AvatarUtils.Avatar nil}}</span> + {{else}} + {{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-left tw-flex tw-items-center"> + {{if .OriginalAuthor}} + <span class="text black tw-font-semibold tw-mr-1"> + {{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}} + {{.OriginalAuthor}} + </span> + <span class="text grey muted-links"> + {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}} + </span> + <span class="text migrate"> + {{if $.root.Repository.OriginalURL}} + ({{ctx.Locale.Tr "repo.migrated_from" $.root.Repository.OriginalURL $.root.Repository.GetOriginalURLHostname}}) + {{end}} + </span> + {{else}} + <span class="text grey muted-links"> + {{template "shared/user/namelink" .Poster}} + {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}} + </span> + {{end}} + </div> + <div class="comment-header-right actions tw-flex tw-items-center"> + {{if .Invalidated}} + {{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}} + <a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> + {{ctx.Locale.Tr "repo.issues.review.outdated"}} + </a> + {{end}} + {{if and .Review}} + {{if eq .Review.Type 0}} + <div class="ui label basic small yellow pending-label" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.pending.tooltip" (ctx.Locale.Tr "repo.diff.review") (ctx.Locale.Tr "repo.diff.review.approve") (ctx.Locale.Tr "repo.diff.review.comment") (ctx.Locale.Tr "repo.diff.review.reject")}}"> + {{ctx.Locale.Tr "repo.issues.review.pending"}} + </div> + {{else}} + <div class="ui label basic small"> + {{ctx.Locale.Tr "repo.issues.review.review"}} + </div> + {{end}} + {{end}} + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $.root "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" dict "ctxData" $.root "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}} + </div> + </div> + <div class="ui attached segment comment-body"> + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> + {{if .RenderedContent}} + {{.RenderedContent}} + {{else}} + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div> + <div class="edit-content-zone tw-hidden" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.root.RepoLink}}" data-attachment-url="{{$.root.RepoLink}}/comments/{{.ID}}/attachments"></div> + {{if .Attachments}} + {{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}} + {{end}} + </div> + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + {{template "repo/issue/view_content/reactions" dict "ctxData" $.root "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}} + {{end}} + </div> +</div> +{{end}} diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl new file mode 100644 index 00000000..110f8ac6 --- /dev/null +++ b/templates/repo/diff/compare.tmpl @@ -0,0 +1,238 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository diff {{if .PageIsComparePull}}compare pull{{end}}"> + {{template "repo/header" .}} + {{$showDiffBox := false}} + <div class="ui container fluid padded"> + <h2 class="ui header"> + {{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}} + {{ctx.Locale.Tr "repo.pulls.compare_changes"}} + <div class="sub header">{{ctx.Locale.Tr "repo.pulls.compare_changes_desc"}}</div> + {{else}} + {{ctx.Locale.Tr "action.compare_commits_general"}} + {{end}} + </h2> + {{$BaseCompareName := $.BaseName -}} + {{- $HeadCompareName := $.HeadRepo.OwnerName -}} + {{- if and (eq $.BaseName $.HeadRepo.OwnerName) (ne $.Repository.Name $.HeadRepo.Name) -}} + {{- $HeadCompareName = printf "%s/%s" $.HeadRepo.OwnerName $.HeadRepo.Name -}} + {{- end -}} + {{- $OwnForkCompareName := "" -}} + {{- if .OwnForkRepo -}} + {{- $OwnForkCompareName = .OwnForkRepo.OwnerName -}} + {{- end -}} + {{- $RootRepoCompareName := "" -}} + {{- if .RootRepo -}} + {{- $RootRepoCompareName = .RootRepo.OwnerName -}} + {{- if eq $.HeadRepo.OwnerName .RootRepo.OwnerName -}} + {{- $HeadCompareName = printf "%s/%s" $.HeadRepo.OwnerName $.HeadRepo.Name -}} + {{- end -}} + {{- end -}} + <div class="ui segment choose branch"> + <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 floating filter dropdown" data-no-results="{{ctx.Locale.Tr "repo.pulls.no_results"}}"> + <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> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-filter" 16}}</i> + <input name="search" placeholder="{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}..."> + </div> + <div class="header"> + <div class="ui grid"> + <div class="two column row"> + <a class="reference column" href="#" data-target=".base-branch-list"> + <span class="text black"> + {{svg "octicon-git-branch" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.branches"}} + </span> + </a> + <a class="reference column" href="#" data-target=".base-tag-list"> + <span class="text black"> + {{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.tags"}} + </span> + </a> + </div> + </div> + </div> + <div class="scrolling menu reference-list-menu base-branch-list"> + {{range .Branches}} + <div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments $.HeadBranch}}">{{$BaseCompareName}}:{{.}}</div> + {{end}} + {{if and (not .PullRequestCtx.SameRepo) ($.HeadRepo.AllowsPulls ctx)}} + {{range .HeadBranches}} + <div class="item" data-url="{{$.HeadRepo.Link}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{PathEscapeSegments $.HeadBranch}}">{{$HeadCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if and .OwnForkRepo (.OwnForkRepo.AllowsPulls ctx)}} + {{range .OwnForkRepoBranches}} + <div class="item" data-url="{{$.OwnForkRepo.Link}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{PathEscapeSegments $.HeadBranch}}">{{$OwnForkCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if and .RootRepo (.RootRepo.AllowsPulls ctx)}} + {{range .RootRepoBranches}} + <div class="item" data-url="{{$.RootRepo.Link}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{PathEscapeSegments $.HeadBranch}}">{{$RootRepoCompareName}}:{{.}}</div> + {{end}} + {{end}} + </div> + <div class="scrolling menu reference-list-menu base-tag-list tw-hidden"> + {{range .Tags}} + <div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments $.HeadBranch}}">{{$BaseCompareName}}:{{.}}</div> + {{end}} + {{if and (not .PullRequestCtx.SameRepo) ($.HeadRepo.AllowsPulls ctx)}} + {{range .HeadTags}} + <div class="item" data-url="{{$.HeadRepo.Link}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{PathEscapeSegments $.HeadBranch}}">{{$HeadCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if and .OwnForkRepo (.OwnForkRepo.AllowsPulls ctx)}} + {{range .OwnForkRepoTags}} + <div class="item" data-url="{{$.OwnForkRepo.Link}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{PathEscapeSegments $.HeadBranch}}">{{$OwnForkCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if and .RootRepo (.RootRepo.AllowsPulls ctx)}} + {{range .RootRepoTags}} + <div class="item" data-url="{{$.RootRepo.Link}}/compare/{{PathEscapeSegments .}}{{$.CompareSeparator}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{PathEscapeSegments $.HeadBranch}}">{{$RootRepoCompareName}}:{{.}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + <a href="{{.RepoLink}}/compare/{{PathEscapeSegments .BaseBranch}}{{.OtherCompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments $.HeadBranch}}" title="{{ctx.Locale.Tr "repo.pulls.switch_comparison_type"}}">{{svg "octicon-arrow-left" 16}}<div class="compare-separator">{{.CompareSeparator}}</div></a> + <div class="ui floating filter dropdown"> + <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> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-filter" 16}}</i> + <input name="search" placeholder="{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}..."> + </div> + <div class="header"> + <div class="ui grid"> + <div class="two column row"> + <a class="reference column" href="#" data-target=".head-branch-list"> + <span class="text black"> + {{svg "octicon-git-branch" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.branches"}} + </span> + </a> + <a class="reference column" href="#" data-target=".head-tag-list"> + <span class="text black"> + {{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.tags"}} + </span> + </a> + </div> + </div> + </div> + <div class="scrolling menu reference-list-menu head-branch-list"> + {{range .HeadBranches}} + <div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments .}}">{{$HeadCompareName}}:{{.}}</div> + {{end}} + {{if not .PullRequestCtx.SameRepo}} + {{range .Branches}} + <div class="item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{PathEscape $.BaseName}}/{{PathEscape $.Repository.Name}}:{{PathEscapeSegments .}}">{{$BaseCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if .OwnForkRepo}} + {{range .OwnForkRepoBranches}} + <div class="item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{PathEscape $.OwnForkRepo.OwnerName}}/{{PathEscape $.OwnForkRepo.Name}}:{{PathEscapeSegments .}}">{{$OwnForkCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if .RootRepo}} + {{range .RootRepoBranches}} + <div class="item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{PathEscape $.RootRepo.OwnerName}}/{{PathEscape $.RootRepo.Name}}:{{PathEscapeSegments .}}">{{$RootRepoCompareName}}:{{.}}</div> + {{end}} + {{end}} + </div> + <div class="scrolling menu reference-list-menu head-tag-list tw-hidden"> + {{range .HeadTags}} + <div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.HeadUser.Name}}/{{PathEscape $.HeadRepo.Name}}:{{end}}{{PathEscapeSegments .}}">{{$HeadCompareName}}:{{.}}</div> + {{end}} + {{if not .PullRequestCtx.SameRepo}} + {{range .Tags}} + <div class="item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{PathEscape $.BaseName}}/{{PathEscape $.Repository.Name}}:{{PathEscapeSegments .}}">{{$BaseCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if .OwnForkRepo}} + {{range .OwnForkRepoTags}} + <div class="item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{PathEscape $.OwnForkRepo.OwnerName}}/{{PathEscape $.OwnForkRepo.Name}}:{{PathEscapeSegments .}}">{{$OwnForkCompareName}}:{{.}}</div> + {{end}} + {{end}} + {{if .RootRepo}} + {{range .RootRepoTags}} + <div class="item" data-url="{{$.RepoLink}}/compare/{{PathEscapeSegments $.BaseBranch}}{{$.CompareSeparator}}{{PathEscape $.RootRepo.OwnerName}}/{{PathEscape $.RootRepo.Name}}:{{PathEscapeSegments .}}">{{$RootRepoCompareName}}:{{.}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + </div> + + {{if .IsNothingToCompare}} + {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived) .PageIsComparePull}} + <div class="ui segment">{{ctx.Locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}</div> + <div class="ui info message show-form-container {{if .Flash}}tw-hidden{{end}}"> + <button class="ui button primary show-form">{{ctx.Locale.Tr "repo.pulls.new"}}</button> + </div> + <div class="pullrequest-form {{if not .Flash}}tw-hidden{{end}}"> + {{template "repo/issue/new_form" .}} + </div> + {{else if and .HeadIsBranch .BaseIsBranch}} + <div class="ui segment">{{ctx.Locale.Tr "repo.pulls.nothing_to_compare"}}</div> + {{else}} + <div class="ui segment">{{ctx.Locale.Tr "repo.pulls.nothing_to_compare_have_tag"}}</div> + {{end}} + {{else if and .PageIsComparePull (gt .CommitCount 0)}} + {{if .HasPullRequest}} + <div class="ui segment grid title"> + <div class="twelve wide column issue-title"> + {{ctx.Locale.Tr "repo.pulls.has_pull_request" (print $.RepoLink "/pulls/" .PullRequest.Issue.Index) $.RepoRelPath .PullRequest.Index}} + <h1> + <span id="issue-title">{{RenderIssueTitle $.Context .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx)}}</span> + <span class="index">#{{.PullRequest.Issue.Index}}</span> + </h1> + </div> + <div class="four wide column middle aligned text right"> + {{- if .PullRequest.HasMerged -}} + <a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button purple show-form">{{svg "octicon-git-merge" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a> + {{else if .Issue.IsClosed}} + <a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button red show-form">{{svg "octicon-issue-closed" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a> + {{else}} + <a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button primary show-form">{{svg "octicon-git-pull-request" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a> + {{end}} + </div> + </div> + {{else}} + {{if and $.IsSigned (not .Repository.IsArchived)}} + <div class="ui info message show-form-container {{if .Flash}}tw-hidden{{end}}"> + <button class="ui button primary show-form">{{ctx.Locale.Tr "repo.pulls.new"}}</button> + </div> + {{else 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" (DateTime "long" .Repository.ArchivedUnix)}} + {{end}} + </div> + {{end}} + {{if $.IsSigned}} + <div class="pullrequest-form {{if not .Flash}}tw-hidden{{end}}"> + {{template "repo/issue/new_form" .}} + </div> + {{end}} + {{$showDiffBox = true}} + {{end}} + {{else if not .IsNothingToCompare}} + {{$showDiffBox = true}} + {{end}} + </div> + + {{if $showDiffBox}} + <div class="ui container fluid padded"> + {{template "repo/commits_table" .}} + {{template "repo/diff/box" .}} + </div> + {{end}} +</div> +{{template "base/footer" .}} diff --git a/templates/repo/diff/conversation.tmpl b/templates/repo/diff/conversation.tmpl new file mode 100644 index 00000000..c80d999f --- /dev/null +++ b/templates/repo/diff/conversation.tmpl @@ -0,0 +1,66 @@ +{{$resolved := (index .comments 0).IsResolved}} +{{$invalid := (index .comments 0).Invalidated}} +{{$resolveDoer := (index .comments 0).ResolveDoer}} +{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}} +{{$referenceUrl := printf "%s#%s" $.Issue.Link (index .comments 0).HashTag}} +<div class="conversation-holder" data-path="{{(index .comments 0).TreePath}}" data-side="{{if lt (index .comments 0).Line 0}}left{{else}}right{{end}}" data-idx="{{(index .comments 0).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"}} + <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} + {{if $invalid}} + <!-- + We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above). + The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl + --> + <a href="{{AppSubUrl}}{{$referenceUrl}}" class="ui label basic small tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> + {{ctx.Locale.Tr "repo.issues.review.outdated"}} + </a> + {{end}} + </div> + <div class="tw-flex tw-items-center tw-gap-2"> + <button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).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"}} + </button> + <button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).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> + </div> + </div> + {{end}} + <div id="code-comments-{{(index .comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}tw-hidden{{end}}"> + <div class="comment-list"> + <ui class="ui comments"> + {{template "repo/diff/comments" dict "root" $ "comments" .comments}} + </ui> + </div> + <div class="button-row tw-flex tw-justify-end tw-items-center tw-flex-wrap tw-mt-2"> + <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"}} + </button> + <button class="ui icon tiny basic button next-conversation"> + {{svg "octicon-arrow-down" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.next"}} + </button> + </div> + {{if and $.CanMarkConversation $isNotPending}} + <button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index .comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> + {{if $resolved}} + {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.resolve_conversation"}} + {{end}} + </button> + {{end}} + {{if and $.SignedUserID (not $.Repository.IsArchived)}} + <button class="comment-form-reply ui primary tiny labeled icon button"> + {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} + </button> + {{end}} + </div> + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index .comments 0).ReviewID "root" $ "comment" (index .comments 0)}} + </div> +</div> diff --git a/templates/repo/diff/conversations.tmpl b/templates/repo/diff/conversations.tmpl new file mode 100644 index 00000000..5945337c --- /dev/null +++ b/templates/repo/diff/conversations.tmpl @@ -0,0 +1,3 @@ +{{range .conversations}} + {{template "repo/diff/conversation" dict "." $ "comments" .}} +{{end}} diff --git a/templates/repo/diff/csv_diff.tmpl b/templates/repo/diff/csv_diff.tmpl new file mode 100644 index 00000000..0f46da30 --- /dev/null +++ b/templates/repo/diff/csv_diff.tmpl @@ -0,0 +1,58 @@ +<tr> + <td> + {{$result := call .root.CreateCsvDiff .file .blobBase .blobHead}} + {{if $result.Error}} + <div class="ui center">{{$result.Error}}</div> + {{else if $result.Sections}} + <table class="data-table"> + {{range $i, $section := $result.Sections}} + <tbody {{if gt $i 0}}class="section"{{end}}> + {{range $j, $row := $section.Rows}} + <tr> + {{if and (eq $i 0) (eq $j 0)}} + <th class="line-num">{{.RowIdx}}</th> + {{range $j, $cell := $row.Cells}} + {{if not $cell}} + <th></th> + {{else if eq $cell.Type 2}} + <th class="modified"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></th> + {{else if eq $cell.Type 3}} + <th class="added"><span class="added-code">{{.RightCell}}</span></th> + {{else if eq $cell.Type 4}} + <th class="removed"><span class="removed-code">{{.LeftCell}}</span></th> + {{else if eq $cell.Type 5}} + <th class="moved">{{.RightCell}}</th> + {{else if eq $cell.Type 6}} + <th class="moved"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></th> + {{else}} + <th>{{.RightCell}}</th> + {{end}} + {{end}} + {{else}} + <td class="line-num">{{if .RowIdx}}{{.RowIdx}}{{end}}</td> + {{range $j, $cell := $row.Cells}} + {{if not $cell}} + <td></td> + {{else if eq $cell.Type 2}} + <td class="modified"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></td> + {{else if eq $cell.Type 3}} + <td class="added"><span class="added-code">{{.RightCell}}</span></td> + {{else if eq $cell.Type 4}} + <td class="removed"><span class="removed-code">{{.LeftCell}}</span></td> + {{else if eq $cell.Type 5}} + <td class="moved">{{.RightCell}}</td> + {{else if eq $cell.Type 6}} + <td class="moved"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></td> + {{else}} + <td>{{.RightCell}}</td> + {{end}} + {{end}} + {{end}} + </tr> + {{end}} + </tbody> + {{end}} + </table> + {{end}} + </td> +</tr> diff --git a/templates/repo/diff/escape_title.tmpl b/templates/repo/diff/escape_title.tmpl new file mode 100644 index 00000000..e70f4021 --- /dev/null +++ b/templates/repo/diff/escape_title.tmpl @@ -0,0 +1,2 @@ +{{if .diff.EscapeStatus.HasInvisible}}{{ctx.Locale.Tr "repo.invisible_runes_line"}} {{end}}{{/* +*/}}{{if .diff.EscapeStatus.HasAmbiguous}}{{ctx.Locale.Tr "repo.ambiguous_runes_line"}}{{end}} diff --git a/templates/repo/diff/image_diff.tmpl b/templates/repo/diff/image_diff.tmpl new file mode 100644 index 00000000..06128546 --- /dev/null +++ b/templates/repo/diff/image_diff.tmpl @@ -0,0 +1,83 @@ +{{if or .blobBase .blobHead}} +<tr> + <td colspan="2"> + <div class="image-diff" + data-path-before="{{.root.BeforeRawPath}}/{{PathEscapeSegments .file.OldName}}" + data-path-after="{{.root.RawPath}}/{{PathEscapeSegments .file.Name}}" + data-mime-before="{{.sniffedTypeBase.GetMimeType}}" + data-mime-after="{{.sniffedTypeHead.GetMimeType}}" + > + <overflow-menu class="ui secondary pointing tabular top attached borderless menu"> + <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> + {{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> + {{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="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> + <p> + <span class="bounds-info-before"> + {{ctx.Locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span> + | + {{ctx.Locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span> + | + </span> + {{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{ctx.Locale.TrSize .blobBase.Size}}</span> + </p> + </span> + {{end}} + {{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> + <p> + <span class="bounds-info-after"> + {{ctx.Locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span> + | + {{ctx.Locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span> + | + </span> + {{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{ctx.Locale.TrSize .blobHead.Size}}</span> + </p> + </span> + {{end}} + </div> + </div> + {{if and .blobBase .blobHead}} + <div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.Index}}"> + <div class="diff-swipe"> + <div class="swipe-frame"> + <span class="before-container"><img class="image-before"></span> + <span class="swipe-container"> + <span class="after-container"><img class="image-after"></span> + </span> + <span class="swipe-bar"> + <span class="handle top-handle"></span> + <span class="handle bottom-handle"></span> + </span> + </div> + </div> + </div> + <div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{.file.Index}}"> + <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> + </div> + </div> + </div> + {{end}} + </div> + </div> + </td> +</tr> +{{end}} diff --git a/templates/repo/diff/new_comment.tmpl b/templates/repo/diff/new_comment.tmpl new file mode 100644 index 00000000..6a71539a --- /dev/null +++ b/templates/repo/diff/new_comment.tmpl @@ -0,0 +1,5 @@ +<div class="conversation-holder"> + <div class="field comment-code-cloud"> + {{template "repo/diff/comment_form_datahandler" .}} + </div> +</div> diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl new file mode 100644 index 00000000..a2eae007 --- /dev/null +++ b/templates/repo/diff/new_review.tmpl @@ -0,0 +1,52 @@ +<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}}> + {{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 class="field"> + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewUrl" (print .Repository.Link "/markup") + "MarkdownPreviewContext" .RepoLink + "TextareaName" "content" + "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.review.placeholder") + "DropzoneParentContainer" "form" + )}} + </div> + {{if .IsAttachmentEnabled}} + <div class="field"> + {{template "repo/upload" .}} + </div> + {{end}} + <div class="divider"></div> + {{$showSelfTooltip := (and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID))}} + {{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 $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> + </div> + {{end}} +</div> diff --git a/templates/repo/diff/options_dropdown.tmpl b/templates/repo/diff/options_dropdown.tmpl new file mode 100644 index 00000000..09b7b80e --- /dev/null +++ b/templates/repo/diff/options_dropdown.tmpl @@ -0,0 +1,33 @@ +<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> + {{else if $.PageIsWiki}} + <a class="item" href="{{$.RepoLink}}/wiki/commit/{{PathEscape .Commit.ID.String}}.patch" download="{{ShortSha .Commit.ID.String}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a> + <a class="item" href="{{$.RepoLink}}/wiki/commit/{{PathEscape .Commit.ID.String}}.diff" download="{{ShortSha .Commit.ID.String}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a> + {{else if .Commit.ID.String}} + <a class="item" href="{{$.RepoLink}}/commit/{{PathEscape .Commit.ID.String}}.patch" download="{{ShortSha .Commit.ID.String}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a> + <a class="item" href="{{$.RepoLink}}/commit/{{PathEscape .Commit.ID.String}}.diff" download="{{ShortSha .Commit.ID.String}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a> + {{end}} + <a id="expand-files-btn" class="item">{{ctx.Locale.Tr "repo.pulls.expand_files"}}</a> + <a id="collapse-files-btn" class="item">{{ctx.Locale.Tr "repo.pulls.collapse_files"}}</a> + {{if .Issue.Index}} + {{if .ShowOutdatedComments}} + <a class="item" href="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated=false"> + <label class="tw-pointer-events-none"> + {{ctx.Locale.Tr "repo.issues.review.option.hide_outdated_comments"}} + </label> + </a> + {{else}} + <a class="item" href="?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated=true"> + <label class="tw-pointer-events-none"> + {{ctx.Locale.Tr "repo.issues.review.option.show_outdated_comments"}} + </label> + </a> + {{end}} + {{end}} + </div> +</div> diff --git a/templates/repo/diff/section_code.tmpl b/templates/repo/diff/section_code.tmpl new file mode 100644 index 00000000..3e8303ed --- /dev/null +++ b/templates/repo/diff/section_code.tmpl @@ -0,0 +1 @@ +<code class="code-inner{{if .diff.EscapeStatus.Escaped}} has-escaped{{end}}"{{if .diff.EscapeStatus.Escaped}} title="{{template "repo/diff/escape_title" .}}"{{end}}>{{.diff.Content}}</code> diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl new file mode 100644 index 00000000..50522d98 --- /dev/null +++ b/templates/repo/diff/section_split.tmpl @@ -0,0 +1,156 @@ +{{$file := .file}} +{{$blobExcerptRepoLink := or $.root.CommitRepoLink $.root.RepoLink}} +<colgroup> + <col width="50"> + <col width="10"> + <col width="10"> + <col> + <col width="50"> + <col width="10"> + <col width="10"> + <col> +</colgroup> +{{range $j, $section := $file.Sections}} + {{range $k, $line := $section.Lines}} + {{$hasmatch := ne $line.Match -1}} + {{if or (ne .GetType 2) (not $hasmatch)}} + <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{.GetHTMLDiffLineType}}"> + {{if eq .GetType 4}} + <td class="lines-num lines-num-old"> + <div class="tw-flex"> + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=down&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}"> + {{svg "octicon-fold-down"}} + </button> + {{end}} + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=up&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}"> + {{svg "octicon-fold-up"}} + </button> + {{end}} + {{if eq $line.GetExpandDirection 2}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=split&direction=&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}"> + {{svg "octicon-fold"}} + </button> + {{end}} + </div> + </td>{{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale}} + <td class="lines-escape lines-escape-old">{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td> + <td colspan="6" class="lines-code lines-code-old ">{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* + */}}</td> + {{else if and (eq .GetType 3) $hasmatch}}{{/* DEL */}} + {{$match := index $section.Lines $line.Match}} + {{- $leftDiff := ""}}{{if $line.LeftIdx}}{{$leftDiff = $section.GetComputedInlineDiffFor $line ctx.Locale}}{{end}} + {{- $rightDiff := ""}}{{if $match.RightIdx}}{{$rightDiff = $section.GetComputedInlineDiffFor $match ctx.Locale}}{{end}} + <td class="lines-num lines-num-old del-code" data-line-num="{{$line.LeftIdx}}"><span rel="diff-{{$file.NameHash}}L{{$line.LeftIdx}}"></span></td> + <td class="lines-escape del-code lines-escape-old">{{if $line.LeftIdx}}{{if $leftDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $leftDiff}}"></button>{{end}}{{end}}</td> + <td class="lines-type-marker lines-type-marker-old del-code"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> + <td class="lines-code lines-code-old del-code">{{/* + */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* + */}}<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">{{/* + */}}{{svg "octicon-plus"}}{{/* + */}}</button>{{/* + */}}{{end}}{{/* + */}}{{if $line.LeftIdx}}{{/* + */}}{{template "repo/diff/section_code" dict "diff" $leftDiff}}{{/* + */}}{{else}}{{/* + */}}<code class="code-inner"></code>{{/* + */}}{{end}}{{/* + */}}</td> + <td class="lines-num lines-num-new add-code" data-line-num="{{if $match.RightIdx}}{{$match.RightIdx}}{{end}}"><span rel="{{if $match.RightIdx}}diff-{{$file.NameHash}}R{{$match.RightIdx}}{{end}}"></span></td> + <td class="lines-escape add-code lines-escape-new">{{if $match.RightIdx}}{{if $rightDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $rightDiff}}"></button>{{end}}{{end}}</td> + <td class="lines-type-marker lines-type-marker-new add-code">{{if $match.RightIdx}}<span class="tw-font-mono" data-type-marker="{{$match.GetLineTypeMarker}}"></span>{{end}}</td> + <td class="lines-code lines-code-new add-code">{{/* + */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* + */}}<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $match.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$match.RightIdx}}">{{/* + */}}{{svg "octicon-plus"}}{{/* + */}}</button>{{/* + */}}{{end}}{{/* + */}}{{if $match.RightIdx}}{{/* + */}}{{template "repo/diff/section_code" dict "diff" $rightDiff}}{{/* + */}}{{else}}{{/* + */}}<code class="code-inner"></code>{{/* + */}}{{end}}{{/* + */}}</td> + {{else}} + {{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale}} + <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$file.NameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> + <td class="lines-escape lines-escape-old">{{if $line.LeftIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}{{end}}</td> + <td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td> + <td class="lines-code lines-code-old">{{/* + */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2))}}{{/* + */}}<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">{{/* + */}}{{svg "octicon-plus"}}{{/* + */}}</button>{{/* + */}}{{end}}{{/* + */}}{{if $line.LeftIdx}}{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* + */}}{{else}}{{/* + */}}<code class="code-inner"></code>{{/* + */}}{{end}}{{/* + */}}</td> + <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$file.NameHash}}R{{$line.RightIdx}}{{end}}"></span></td> + <td class="lines-escape lines-escape-new">{{if $line.RightIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}{{end}}</td> + <td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td> + <td class="lines-code lines-code-new">{{/* + */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}{{/* + */}}<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">{{/* + */}}{{svg "octicon-plus"}}{{/* + */}}</button>{{/* + */}}{{end}}{{/* + */}}{{if $line.RightIdx}}{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* + */}}{{else}}{{/* + */}}<code class="code-inner"></code>{{/* + */}}{{end}}{{/* + */}}</td> + {{end}} + </tr> + {{if and (eq .GetType 3) $hasmatch}} + {{$match := index $section.Lines $line.Match}} + {{if or $line.Conversations $match.Conversations}} + <tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}"> + <td class="add-comment-left" colspan="4"> + {{if $line.Conversations}} + {{if eq $line.GetCommentSide "previous"}} + {{template "repo/diff/conversations" dict "." $.root "conversations" $line.Conversations}} + {{end}} + {{end}} + {{if $match.Conversations}} + {{if eq $match.GetCommentSide "previous"}} + {{template "repo/diff/conversations" dict "." $.root "conversations" $match.Conversations}} + {{end}} + {{end}} + </td> + <td class="add-comment-right" colspan="4"> + {{if $line.Conversations}} + {{if eq $line.GetCommentSide "proposed"}} + {{template "repo/diff/conversations" dict "." $.root "conversations" $line.Conversations}} + {{end}} + {{end}} + {{if $match.Conversations}} + {{if eq $match.GetCommentSide "proposed"}} + {{template "repo/diff/conversations" dict "." $.root "conversations" $match.Conversations}} + {{end}} + {{end}} + </td> + </tr> + {{end}} + {{else if $line.Conversations}} + <tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}"> + <td class="add-comment-left" colspan="4"> + {{if eq $line.GetCommentSide "previous"}} + {{template "repo/diff/conversations" dict "." $.root "conversations" $line.Conversations}} + {{end}} + </td> + <td class="add-comment-right" colspan="4"> + {{if eq $line.GetCommentSide "proposed"}} + {{template "repo/diff/conversations" dict "." $.root "conversations" $line.Conversations}} + {{end}} + </td> + </tr> + {{end}} + {{end}} + {{end}} +{{end}} diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl new file mode 100644 index 00000000..ab78097f --- /dev/null +++ b/templates/repo/diff/section_unified.tmpl @@ -0,0 +1,72 @@ +{{$file := .file}} +{{$blobExcerptRepoLink := or $.root.CommitRepoLink $.root.RepoLink}} +<colgroup> + <col width="50"> + <col width="50"> + <col width="10"> + <col width="10"> + <col> +</colgroup> +{{range $j, $section := $file.Sections}} + {{range $k, $line := $section.Lines}} + <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{.GetHTMLDiffLineType}}"> + {{if eq .GetType 4}} + {{if $.root.AfterCommitID}} + <td colspan="2" class="lines-num"> + <div class="tw-flex"> + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}"> + {{svg "octicon-fold-down"}} + </button> + {{end}} + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}"> + {{svg "octicon-fold-up"}} + </button> + {{end}} + {{if eq $line.GetExpandDirection 2}} + <button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.root.PageIsWiki}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}"> + {{svg "octicon-fold"}} + </button> + {{end}} + </div> + </td> + {{else}} + {{/* for code file preview page or comment diffs on pull comment pages, do not show the expansion arrows */}} + <td colspan="2" class="lines-num"></td> + {{end}} + {{else}} + <td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{$file.NameHash}}L{{$line.LeftIdx}}{{end}}"></span></td> + <td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{$file.NameHash}}R{{$line.RightIdx}}{{end}}"></span></td> + {{end}} + {{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale -}} + <td class="lines-escape"> + {{- if $inlineDiff.EscapeStatus.Escaped -}} + <button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button> + {{- end -}} + </td> + <td class="lines-type-marker"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> + {{if eq .GetType 4}} + <td class="chroma lines-code blob-hunk">{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* + */}}</td> + {{else}} + <td class="chroma lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">{{/* + */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* + */}}<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">{{/* + */}}{{svg "octicon-plus"}}{{/* + */}}</button>{{/* + */}}{{end}}{{/* + */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* + */}}</td> + {{end}} + </tr> + {{if $line.Conversations}} + <tr class="add-comment" data-line-type="{{.GetHTMLDiffLineType}}"> + <td class="add-comment-left add-comment-right" colspan="5"> + {{template "repo/diff/conversations" dict "." $.root "conversations" $line.Conversations}} + </td> + </tr> + {{end}} + {{end}} +{{end}} diff --git a/templates/repo/diff/stats.tmpl b/templates/repo/diff/stats.tmpl new file mode 100644 index 00000000..d0dff1bd --- /dev/null +++ b/templates/repo/diff/stats.tmpl @@ -0,0 +1,5 @@ +{{Eval .file.Addition "+" .file.Deletion}} +<span class="diff-stats-bar tw-mx-2" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.stats_desc_file" (Eval .file.Addition "+" .file.Deletion) .file.Addition .file.Deletion}}"> + {{/* if the denominator is zero, then the float result is "width: NaNpx", as before, it just works */}} + <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .file.Addition "/" "(" .file.Addition "+" .file.Deletion "+" 0.0 ")"}}%"></div> +</span> diff --git a/templates/repo/diff/whitespace_dropdown.tmpl b/templates/repo/diff/whitespace_dropdown.tmpl new file mode 100644 index 00000000..c54de165 --- /dev/null +++ b/templates/repo/diff/whitespace_dropdown.tmpl @@ -0,0 +1,30 @@ +<div class="ui dropdown tiny basic button" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.whitespace_button"}}"> + {{svg "gitea-whitespace"}} + <div class="menu"> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=show-all&show-outdated={{$.ShowOutdatedComments}}"> + <label class="tw-pointer-events-none"> + <input class="tw-mr-2 tw-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "show-all"}} checked{{end}}> + {{ctx.Locale.Tr "repo.diff.whitespace_show_everything"}} + </label> + </a> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-all&show-outdated={{$.ShowOutdatedComments}}"> + <label class="tw-pointer-events-none"> + <input class="tw-mr-2 tw-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "ignore-all"}} checked{{end}}> + {{ctx.Locale.Tr "repo.diff.whitespace_ignore_all_whitespace"}} + </label> + </a> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-change&show-outdated={{$.ShowOutdatedComments}}"> + <label class="tw-pointer-events-none"> + <input class="tw-mr-2 tw-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "ignore-change"}} checked{{end}}> + {{ctx.Locale.Tr "repo.diff.whitespace_ignore_amount_changes"}} + </label> + </a> + <a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-eol&show-outdated={{$.ShowOutdatedComments}}"> + <label class="tw-pointer-events-none"> + <input class="tw-mr-2 tw-pointer-events-none" type="radio"{{if eq .WhitespaceBehavior "ignore-eol"}} checked{{end}}> + {{ctx.Locale.Tr "repo.diff.whitespace_ignore_at_eol"}} + </label> + </a> + </div> +</div> +<a class="ui tiny basic button" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}" data-tooltip-content="{{if .IsSplitStyle}}{{ctx.Locale.Tr "repo.diff.show_unified_view"}}{{else}}{{ctx.Locale.Tr "repo.diff.show_split_view"}}{{end}}">{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}}</a> diff --git a/templates/repo/editor/cherry_pick.tmpl b/templates/repo/editor/cherry_pick.tmpl new file mode 100644 index 00000000..f9c9eef5 --- /dev/null +++ b/templates/repo/editor/cherry_pick.tmpl @@ -0,0 +1,30 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file editor edit"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <form class="ui edit form" method="post" action="{{.RepoLink}}/_cherrypick/{{.SHA}}/{{.BranchName | PathEscapeSegments}}"> + {{.CsrfTokenHtml}} + <input type="hidden" name="last_commit" value="{{.last_commit}}"> + <input type="hidden" name="page_has_posted" value="true"> + <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)}} + {{if eq .CherryPickType "revert"}} + {{ctx.Locale.Tr "repo.editor.revert" $shalink}} + {{else}} + {{ctx.Locale.Tr "repo.editor.cherry_pick" $shalink}} + {{end}} + <a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a> + <div class="breadcrumb-divider">:</div> + <a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a> + <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{$shaurl}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> + </div> + </div> + {{template "repo/editor/commit_form" .}} + </form> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl new file mode 100644 index 00000000..9f81b1d3 --- /dev/null +++ b/templates/repo/editor/commit_form.tmpl @@ -0,0 +1,82 @@ +<div class="commit-form-wrapper"> + {{ctx.AvatarUtils.Avatar .SignedUser 48 "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> + {{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> + {{ctx.Locale.Tr "repo.editor.commit_changes"}} + {{- end}}</h3> + <div class="field"> + <input name="commit_summary" maxlength="100" placeholder="{{if .PageIsDelete}}{{ctx.Locale.Tr "repo.editor.delete" .TreePath}}{{else if .PageIsUpload}}{{ctx.Locale.Tr "repo.editor.upload_files_to_dir" .TreePath}}{{else if .IsNewFile}}{{ctx.Locale.TrString "repo.editor.add_tmpl"}}{{else if .PageIsPatch}}{{ctx.Locale.Tr "repo.editor.patch"}}{{else}}{{ctx.Locale.Tr "repo.editor.update" .TreePath}}{{end}}" value="{{.commit_summary}}" autofocus> + </div> + <div class="field"> + <textarea name="commit_message" placeholder="{{ctx.Locale.Tr "repo.editor.commit_message_desc"}}" rows="5">{{.commit_message}}</textarea> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="signoff" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.editor.signoff_desc"}}</label> + </div> + </div> + <div class="quick-pull-choice js-quick-pull-choice"> + <div class="field"> + <div class="ui radio checkbox {{if not .CanCommitToBranch.CanCommitToBranch}}disabled{{end}}"> + <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" 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}} + <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}} + </ul> + </div> + {{end}} + </label> + </div> + </div> + {{if not .Repository.IsEmpty}} + <div class="field"> + <div class="ui radio checkbox"> + {{if .CanCreatePullRequest}} + <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" 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" 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}} + {{ctx.Locale.Tr "repo.editor.create_new_branch"}} + {{else}} + {{ctx.Locale.Tr "repo.editor.create_new_branch_np"}} + {{end}} + </label> + </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}}"> + {{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> + </div> + </div> + {{end}} + </div> + <div class="field {{if .Err_CommitMailID}}error{{end}}"> + <label for="commit_mail_id">Commit email</label> + <select class="ui selection dropdown" name="commit_mail_id"> + {{range .CommitMails}} + <option{{if eq $.DefaultCommitMail .Email}} selected="selected"{{end}} value="{{.ID}}">{{.Email}}</option> + {{end}} + </select> + </div> + </div> + <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> + <a class="ui button red" href="{{$.BranchLink}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.editor.cancel"}}</a> +</div> diff --git a/templates/repo/editor/delete.tmpl b/templates/repo/editor/delete.tmpl new file mode 100644 index 00000000..2c0c2fc7 --- /dev/null +++ b/templates/repo/editor/delete.tmpl @@ -0,0 +1,13 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file editor delete"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="last_commit" value="{{.last_commit}}"> + {{template "repo/editor/commit_form" .}} + </form> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/editor/diff_preview.tmpl b/templates/repo/editor/diff_preview.tmpl new file mode 100644 index 00000000..e2e922be --- /dev/null +++ b/templates/repo/editor/diff_preview.tmpl @@ -0,0 +1,11 @@ +<div class="diff-file-box"> + <div class="ui attached table segment"> + <div class="file-body file-code code-diff code-diff-unified unicode-escaped"> + <table> + <tbody> + {{template "repo/diff/section_unified" dict "file" .File "root" $}} + </tbody> + </table> + </div> + </div> +</div> diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl new file mode 100644 index 00000000..71cecf15 --- /dev/null +++ b/templates/repo/editor/edit.tmpl @@ -0,0 +1,74 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file editor edit"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <form class="ui edit form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="last_commit" value="{{.last_commit}}"> + <input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}"> + <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="{{$.BranchLink}}{{if not .IsNewFile}}/{{PathEscapeSegments .TreePath}}{{end}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> + <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required> + </div> + </div> + <div class="field"> + <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff"> + <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-url="{{.Repository.Link}}/markup" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-markup-mode="file">{{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 class="ui bottom attached active tab segment" data-tab="write"> + <textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}" + data-url="{{.Repository.Link}}/markup" + data-context="{{.RepoLink}}" + data-previewable-extensions="{{.PreviewableExtensions}}" + data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea> + <div class="editor-loading is-loading"></div> + </div> + <div class="ui bottom attached tab segment markup" data-tab="preview"> + {{ctx.Locale.Tr "loading"}} + </div> + <div class="ui bottom attached tab segment diff edit-diff" data-tab="diff"> + <div class="tw-p-16"></div> + </div> + </div> + {{template "repo/editor/commit_form" .}} + </form> + </div> + <div class="ui g-modal-confirm modal" id="edit-empty-content-modal"> + <div class="header"> + {{svg "octicon-file"}} + {{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}} + </div> + <div class="center content"> + <p>{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}</p> + </div> + <div class="actions"> + <button class="ui cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.editor.cancel"}} + </button> + <button class="ui primary ok button"> + {{svg "fontawesome-save"}} + {{ctx.Locale.Tr "repo.editor.commit_changes"}} + </button> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/editor/patch.tmpl b/templates/repo/editor/patch.tmpl new file mode 100644 index 00000000..1f046a8d --- /dev/null +++ b/templates/repo/editor/patch.tmpl @@ -0,0 +1,57 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file editor edit"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <form class="ui edit form" method="post" action="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}"> + {{.CsrfTokenHtml}} + <input type="hidden" name="last_commit" value="{{.last_commit}}"> + <input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}"> + <div class="repo-editor-header"> + <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}"> + {{ctx.Locale.Tr "repo.editor.patching"}} + <a class="section" href="{{$.RepoLink}}">{{.Repository.FullName}}</a> + <div class="breadcrumb-divider">:</div> + <a class="section" href="{{$.BranchLink}}">{{.BranchName}}</a> + <span>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}">{{ctx.Locale.Tr "repo.editor.cancel_lower"}}</a></span> + <input type="hidden" id="tree_path" name="tree_path" value="patch" required> + <input id="file-name" maxlength="500" type="hidden" value="diff.patch"> + </div> + </div> + <div class="field"> + <div class="ui top attached tabular menu" data-write="write"> + <a class="active item" data-tab="write">{{svg "octicon-code" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.editor.new_patch"}}</a> + </div> + <div class="ui bottom attached active tab segment" data-tab="write"> + <textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-patch" + data-context="{{.RepoLink}}" + data-line-wrap-extensions="{{.LineWrapExtensions}}"> +{{.FileContent}}</textarea> + <div class="editor-loading is-loading"></div> + </div> + </div> + {{template "repo/editor/commit_form" .}} + </form> + </div> + + <div class="ui g-modal-confirm modal" id="edit-empty-content-modal"> + <div class="header"> + {{svg "octicon-file"}} + {{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}} + </div> + <div class="center content"> + <p>{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}</p> + </div> + <div class="actions"> + <button class="ui cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.editor.cancel"}} + </button> + <button class="ui primary ok button"> + {{svg "fontawesome-save"}} + {{ctx.Locale.Tr "repo.editor.commit_changes"}} + </button> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/editor/upload.tmpl b/templates/repo/editor/upload.tmpl new file mode 100644 index 00000000..57250204 --- /dev/null +++ b/templates/repo/editor/upload.tmpl @@ -0,0 +1,33 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file editor upload"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <form class="ui comment form" method="post"> + {{.CsrfTokenHtml}} + <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> + </div> + <div class="field"> + {{template "repo/upload" .}} + </div> + {{template "repo/editor/commit_form" .}} + </form> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl new file mode 100644 index 00000000..cb2a5ba1 --- /dev/null +++ b/templates/repo/empty.tmpl @@ -0,0 +1,82 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository quickstart"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="ui grid"> + <div class="sixteen wide column content"> + {{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" (DateTime "long" .Repository.ArchivedUnix)}} + {{end}} + </div> + {{end}} + {{if .Repository.IsBroken}} + <div class="ui segment center"> + {{ctx.Locale.Tr "repo.broken_message"}} + </div> + {{else if .CanWriteCode}} + <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/Git-Basics-Getting-a-Git-Repository"}}</small></h3> + + <div class="repo-button-row"> + {{if and .CanWriteCode (not .Repository.IsArchived)}} + <a class="ui small button" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/"> + {{ctx.Locale.Tr "repo.editor.new_file"}} + </a> + {{if .RepositoryUploadEnabled}} + <a class="ui small button" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/"> + {{ctx.Locale.Tr "repo.editor.upload_file"}} + </a> + {{end}} + {{end}} + <div class="clone-panel ui action small input tw-flex-1"> + {{template "repo/clone_buttons" .}} + </div> + </div> + </div> + + {{if not .Repository.IsArchived}} + <div class="divider tw-my-0"></div> + + <div class="item"> + <h3>{{ctx.Locale.Tr "repo.create_new_repo_command"}}</h3> + <div class="markup"> + <pre><code>touch README.md +git init +{{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}} +git add README.md +git commit -m "first commit" +git remote add origin <span class="js-clone-url">{{$.CloneButtonOriginLink.HTTPS}}</span> +git push -u origin {{.Repository.DefaultBranch}}</code></pre> + </div> + </div> + <div class="divider"></div> + + <div class="item"> + <h3>{{ctx.Locale.Tr "repo.push_exist_repo"}}</h3> + <div class="markup"> + <pre><code>git remote add origin <span class="js-clone-url">{{$.CloneButtonOriginLink.HTTPS}}</span> +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}} + {{template "repo/clone_script" .}} + </div> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/file_info.tmpl b/templates/repo/file_info.tmpl new file mode 100644 index 00000000..6ae7c15a --- /dev/null +++ b/templates/repo/file_info.tmpl @@ -0,0 +1,53 @@ +<div class="file-info tw-font-mono"> + {{if .FileIsSymlink}} + <div class="file-info-entry"> + {{ctx.Locale.Tr "repo.symbolic_link"}} + </div> + {{end}} + {{if .NumLinesSet}}{{/* Explicit attribute needed to show 0 line changes */}} + <div class="file-info-entry"> + {{.NumLines}} {{ctx.Locale.TrN .NumLines "repo.line" "repo.lines"}} + </div> + {{end}} + {{if .HasNoTrailingEOL}} + <div class="file-info-entry" data-tooltip-content="{{ctx.Locale.Tr "repo.no_eol.tooltip"}}"> + {{ctx.Locale.Tr "repo.no_eol.text"}} + </div> + {{end}} + {{if .FileSize}} + <div class="file-info-entry"> + {{ctx.Locale.TrSize .FileSize}}{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} + </div> + {{end}} + {{if .LFSLock}} + <div class="file-info-entry ui" data-tooltip-content="{{.LFSLockHint}}"> + {{svg "octicon-lock" 16 "tw-mr-1"}} + <a href="{{.LFSLockOwnerHomeLink}}">{{.LFSLockOwner}}</a> + </div> + {{end}} + {{if .LexerName}} + <div class="file-info-entry"> + {{.LexerName}} + </div> + {{end}} + {{if .IsExecutable}} + <div class="file-info-entry"> + {{ctx.Locale.Tr "repo.executable_file"}} + </div> + {{end}} + {{if .IsVendored}} + <div class="file-info-entry"> + {{ctx.Locale.Tr "repo.vendored"}} + </div> + {{end}} + {{if .IsGenerated}} + <div class="file-info-entry"> + {{ctx.Locale.Tr "repo.generated"}} + </div> + {{end}} + {{if .ImageSize}} + <div class="file-info-entry"> + {{.ImageSize}} + </div> + {{end}} +</div> diff --git a/templates/repo/find/files.tmpl b/templates/repo/find/files.tmpl new file mode 100644 index 00000000..548ce2f0 --- /dev/null +++ b/templates/repo/find/files.tmpl @@ -0,0 +1,21 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="tw-flex tw-items-center"> + <a href="{{$.RepoLink}}">{{.RepoName}}</a> + <span class="tw-mx-2">/</span> + <div class="ui input tw-flex-1"> + <input id="repo-file-find-input" type="text" autofocus data-url-data-link="{{.DataLink}}" data-url-tree-link="{{.TreeLink}}"> + </div> + </div> + <table id="repo-find-file-table" class="ui single line table"> + <tbody> + </tbody> + </table> + <div id="repo-find-file-no-result" class="ui row center tw-mt-8 tw-hidden"> + <h3>{{ctx.Locale.Tr "repo.find_file.no_matching"}}</h3> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/flags.tmpl b/templates/repo/flags.tmpl new file mode 100644 index 00000000..620357bd --- /dev/null +++ b/templates/repo/flags.tmpl @@ -0,0 +1,33 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <div class="user-main-content twelve wide column"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.admin.manage_flags"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <strong>{{ctx.Locale.Tr "repo.admin.enabled_flags"}}</strong> + <div class="ui segment tw-pl-4"> + {{range $flag, $checked := .Flags}} + <div class="field"> + <div class="ui checkbox{{if $checked}} checked{{end}}"> + <input name="flags" type="checkbox" value="{{$flag}}" {{if $checked}}checked{{end}}> + <label>{{$flag}}</label> + </div> + </div> + {{end}} + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.admin.update_flags"}}</button> + </div> + </form> + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/forks.tmpl b/templates/repo/forks.tmpl new file mode 100644 index 00000000..412c59b6 --- /dev/null +++ b/templates/repo/forks.tmpl @@ -0,0 +1,18 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository forks"> + {{template "repo/header" .}} + <div class="ui container"> + <h2 class="ui dividing header"> + {{ctx.Locale.Tr "repo.forks"}} + </h2> + {{range .Forks}} + <div class="tw-flex tw-items-center tw-py-2"> + <span class="tw-mr-1">{{ctx.AvatarUtils.Avatar .Owner}}</span> + <a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="{{.Link}}">{{.Name}}</a> + </div> + {{end}} + </div> + + {{template "base/paginate" .}} +</div> +{{template "base/footer" .}} diff --git a/templates/repo/graph.tmpl b/templates/repo/graph.tmpl new file mode 100644 index 00000000..6e7b6cb2 --- /dev/null +++ b/templates/repo/graph.tmpl @@ -0,0 +1,62 @@ +{{template "base/head" .}} +<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}}"> + <h2 class="ui header dividing"> + {{ctx.Locale.Tr "repo.commit_graph"}} + <div class="ui icon buttons small color-buttons"> + <div class="ui multiple selection search dropdown" id="flow-select-refs-dropdown"> + <input type="hidden" name="flow"> + <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="flex-text-block"> + {{svg "octicon-eye-closed" 16 "tw-mr-1"}}<span class="gt-ellipsis" title="{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}">{{ctx.Locale.Tr "repo.commit_graph.hide_pr_refs"}}</span> + </span> + </div> + {{range .AllRefs}} + {{$refGroup := .RefGroup}} + {{if eq $refGroup "pull"}} + <div class="item" data-value="{{.Name}}"> + <span class="flex-text-block"> + {{svg "octicon-git-pull-request" 16 "tw-mr-1"}}<span class="gt-ellipsis" title="{{.ShortName}}">#{{.ShortName}}</span> + </span> + </div> + {{else if eq $refGroup "tags"}} + <div class="item" data-value="{{.Name}}"> + <span class="flex-text-block"> + {{svg "octicon-tag" 16 "tw-mr-1"}}<span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> + </span> + </div> + {{else if eq $refGroup "remotes"}} + <div class="item" data-value="{{.Name}}"> + <span class="flex-text-block"> + {{svg "octicon-cross-reference" 16 "tw-mr-1"}}<span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> + </span> + </div> + {{else if eq $refGroup "heads"}} + <div class="item" data-value="{{.Name}}"> + <span class="flex-text-block"> + {{svg "octicon-git-branch" 16 "tw-mr-1"}}<span class="gt-ellipsis" title="{{.ShortName}}">{{.ShortName}}</span> + </span> + </div> + {{end}} + {{end}} + </div> + </div> + <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> + </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 new file mode 100644 index 00000000..5c768f32 --- /dev/null +++ b/templates/repo/graph/commits.tmpl @@ -0,0 +1,79 @@ +<div id="rev-container"> + <ul id="rev-list"> + {{range $commitI, $commit := .Graph.Commits}} + <li {{if $commit.Rev}}id="commit-{{$commit.Rev}}"{{end}} data-flow="{{$commit.Flow}}"> + {{if $commit.OnlyRelation}} + <span></span> + {{else}} + <span class="sha" id="{{$commit.ShortRev}}"> + {{$class := "ui sha label"}} + {{if $commit.Commit.Signature}} + {{$class = (print $class " isSigned")}} + {{if $commit.Verification.Verified}} + {{if eq $commit.Verification.TrustStatus "trusted"}} + {{$class = (print $class " isVerified")}} + {{else if eq $commit.Verification.TrustStatus "untrusted"}} + {{$class = (print $class " isVerifiedUntrusted")}} + {{else}} + {{$class = (print $class " isVerifiedUnmatched")}} + {{end}} + {{else if $commit.Verification.Warning}} + {{$class = (print $class " isWarning")}} + {{end}} + {{end}} + <a href="{{$.RepoLink}}/commit/{{$commit.Rev|PathEscape}}" rel="nofollow" class="{{$class}}"> + <span class="shortsha">{{ShortSha $commit.Commit.ID.String}}</span> + {{- if $commit.Commit.Signature -}} + {{template "repo/shabox_badge" dict "root" $ "verification" $commit.Verification}} + {{- end -}} + </a> + </span> + <span class="message tw-inline-block gt-ellipsis tw-mr-2"> + <span>{{RenderCommitMessage $.Context $commit.Subject ($.Repository.ComposeMetas ctx)}}</span> + </span> + <span class="commit-refs tw-flex tw-items-center tw-mr-1"> + {{range $commit.Refs}} + {{$refGroup := .RefGroup}} + {{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 basic button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled $.Context $.UnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}"> + {{svg "octicon-git-pull-request"}} #{{.ShortName}} + </a> + {{end}} + {{else if eq $refGroup "tags"}} + <a class="ui basic button" href="{{$.RepoLink}}/src/tag/{{.ShortName|PathEscape}}"> + {{svg "octicon-tag"}} {{.ShortName}} + </a> + {{else if eq $refGroup "remotes"}} + <a class="ui basic button" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}"> + {{svg "octicon-cross-reference"}} {{.ShortName}} + </a> + {{else if eq $refGroup "heads"}} + <a class="ui basic button" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}"> + {{svg "octicon-git-branch"}} {{.ShortName}} + </a> + {{else}} + <!-- Unknown ref type .Name --> + {{end}} + {{end}} + </span> + <span class="author tw-flex tw-items-center tw-mr-2"> + {{$userName := $commit.Commit.Author.Name}} + {{if $commit.User}} + {{if and $commit.User.FullName DefaultShowFullName}} + {{$userName = $commit.User.FullName}} + {{end}} + <span class="tw-mr-1">{{ctx.AvatarUtils.Avatar $commit.User}}</span> + <a href="{{$commit.User.HomeLink}}">{{$userName}}</a> + {{else}} + <span class="tw-mr-1">{{ctx.AvatarUtils.AvatarByEmail $commit.Commit.Author.Email $userName}}</span> + {{$userName}} + {{end}} + </span> + <span class="time tw-flex tw-items-center">{{DateTime "full" $commit.Date}}</span> + {{end}} + </li> + {{end}} + </ul> +</div> diff --git a/templates/repo/graph/div.tmpl b/templates/repo/graph/div.tmpl new file mode 100644 index 00000000..c0bd4e26 --- /dev/null +++ b/templates/repo/graph/div.tmpl @@ -0,0 +1,7 @@ +<div> + {{template "repo/graph/svgcontainer" .}} + {{template "repo/graph/commits" .}} + <div id="pagination"> + {{template "base/paginate" .}} + </div> +</div> diff --git a/templates/repo/graph/svgcontainer.tmpl b/templates/repo/graph/svgcontainer.tmpl new file mode 100644 index 00000000..99c3c873 --- /dev/null +++ b/templates/repo/graph/svgcontainer.tmpl @@ -0,0 +1,24 @@ +<div id="rel-container"> + <svg viewbox="{{Eval .Graph.MinColumn "*" 5}} {{Eval .Graph.MinRow "*" 12}} {{Eval .Graph.Width "*" 5 "+" 5}} {{Eval .Graph.Height "*" 12}}" width="{{Eval .Graph.Width "*" 10 "+" 10}}px"> + {{range $flowid, $flow := .Graph.Flows}} + <g id="flow-{{$flow.ID}}" class="flow-group flow-color-{{$flow.ColorNumber}} flow-color-16-{{$flow.Color16}}" data-flow="{{$flow.ID}}" data-color="{{$flow.ColorNumber}}"> + <path d="{{range $i, $glyph := $flow.Glyphs -}} + {{- if or (eq $glyph.Glyph '*') (eq $glyph.Glyph '|') -}} + M {{Eval $glyph.Column "*" 5 "+" 5}} {{Eval $glyph.Row "*" 12 "+" 0}} v 12 {{/* */ -}} + {{- else if eq $glyph.Glyph '/' -}} + M {{Eval $glyph.Column "*" 5 "+" 10}} {{Eval $glyph.Row "*" 12 "+" 0}} l -10 12 {{/* */ -}} + {{- else if eq $glyph.Glyph '\\' -}} + M {{Eval $glyph.Column "*" 5 "+" 0}} {{Eval $glyph.Row "*" 12 "+" 0}} l 10 12 {{/* */ -}} + {{- else if or (eq $glyph.Glyph '-') (eq $glyph.Glyph '.') -}} + M {{Eval $glyph.Column "*" 5 "+" 0}} {{Eval $glyph.Row "*" 12 "+" 12}} h 5 {{/* */ -}} + {{- else if eq $glyph.Glyph '_' -}} + M {{Eval $glyph.Column "*" 5 "+" 0}} {{Eval $glyph.Row "*" 12 "+" 12}} h 10 {{/* */ -}} + {{- end -}} + {{- end}}" stroke-width="1" fill="none" id="flow-{{$flow.ID}}-path" stroke-linecap="round"></path> + {{range $flow.Commits}} + <circle class="flow-commit" cx="{{Eval .Column "*" 5 "+" 5}}" cy="{{Eval .Row "*" 12 "+" 6}}" r="2.5" stroke="none" id="flow-commit-{{.Rev}}" data-rev="{{.Rev}}"></circle> + {{end}} + </g> + {{end}} + </svg> +</div> diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl new file mode 100644 index 00000000..e81e65bc --- /dev/null +++ b/templates/repo/header.tmpl @@ -0,0 +1,198 @@ +<div class="secondary-nav"> +{{with .Repository}} + <div class="ui container"> + <div class="repo-header"> + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{template "repo/icon" .}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title gt-font-18"> + <a class="muted gt-font-normal" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/<a class="muted" href="{{$.RepoLink}}">{{.Name}}</a> + </div> + </div> + <div class="flex-item-trailing"> + {{if .IsArchived}} + <span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.archived"}}</span> + <div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.archived"}}">{{svg "octicon-archive" 18}}</div> + {{end}} + {{if .IsPrivate}} + <span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.private"}}</span> + <div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.private"}}">{{svg "octicon-lock" 18}}</div> + {{else}} + {{if .Owner.Visibility.IsPrivate}} + <span class="ui basic label not-mobile">{{ctx.Locale.Tr "repo.desc.internal"}}</span> + <div class="repo-icon only-mobile" data-tooltip-content="{{ctx.Locale.Tr "repo.desc.internal"}}">{{svg "octicon-shield-lock" 18}}</div> + {{end}} + {{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> + {{end}} + {{if eq .ObjectFormatName "sha256"}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span> + {{end}} + </div> + </div> + {{if not (or .IsBeingCreated .IsBroken)}} + <div class="repo-buttons button-row"> + {{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}}> + {{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}}> + {{ctx.Locale.Tr "repo.transfer.reject"}} + </button> + </div> + </form> + {{end}} + {{if $.EnableFeed}} + {{/* An extra div-element is not necessary here, as this button does not secretly contain two buttons. */}} + <a class="ui compact small basic button" href="{{$.RepoLink}}.rss" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}"> + {{svg "octicon-rss" 16}} + </a> + {{end}} + {{template "repo/watch_unwatch" $}} + {{if not $.DisableStars}} + {{template "repo/star_unstar" $}} + {{end}} + {{if not $.DisableForks}} + {{template "repo/header_fork" $}} + {{end}} + </div> + {{end}} + </div> + {{if $.PullMirror}} + <div class="fork-flag"> + {{ctx.Locale.Tr "repo.mirror_from"}} + <a target="_blank" rel="noopener noreferrer" href="{{$.PullMirror.RemoteAddress}}">{{$.PullMirror.RemoteAddress}}</a> + {{if $.PullMirror.UpdatedUnix}}{{ctx.Locale.Tr "repo.mirror_sync"}} {{TimeSinceUnix $.PullMirror.UpdatedUnix ctx.Locale}}{{end}} + </div> + {{end}} + {{if .IsFork}}<div class="fork-flag">{{ctx.Locale.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}} + {{if .IsGenerated}}<div class="fork-flag">{{ctx.Locale.Tr "repo.generated_from"}} <a href="{{(.TemplateRepo ctx).Link}}">{{(.TemplateRepo ctx).FullName}}</a></div>{{end}} + </div> +{{end}} + <overflow-menu class="ui container secondary pointing tabular top attached borderless menu tw-pt-0 tw-my-0"> + {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}} + <div class="overflow-menu-items"> + {{if .Permission.CanRead $.UnitTypeCode}} + <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}"> + {{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}} + </a> + {{end}} + + {{if .Permission.CanRead $.UnitTypeIssues}} + <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues"> + {{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues"}} + {{if .Repository.NumOpenIssues}} + <span class="ui small label">{{CountFmt .Repository.NumOpenIssues}}</span> + {{end}} + </a> + {{end}} + + {{if .Permission.CanRead $.UnitTypeExternalTracker}} + <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer"> + {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues"}} + </a> + {{end}} + + {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}} + <a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls"> + {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.pulls"}} + {{if .Repository.NumOpenPulls}} + <span class="ui small label">{{CountFmt .Repository.NumOpenPulls}}</span> + {{end}} + </a> + {{end}} + + {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}} + <a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item"> + {{svg "octicon-project"}} {{ctx.Locale.Tr "repo.project"}} + {{if .Repository.NumOpenProjects}} + <span class="ui small label">{{CountFmt .Repository.NumOpenProjects}}</span> + {{end}} + </a> + {{end}} + + {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo)}} + <a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases"> + {{svg "octicon-tag"}} {{ctx.Locale.Tr "repo.releases"}} + {{if .NumReleases}} + <span class="ui small label">{{CountFmt .NumReleases}}</span> + {{end}} + </a> + {{end}} + + {{if .Permission.CanRead $.UnitTypePackages}} + <a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item"> + {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} + + {{if .Permission.CanRead $.UnitTypeWiki}} + <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki"> + {{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}} + </a> + {{end}} + + {{if .Permission.CanRead $.UnitTypeExternalWiki}} + <a class="item" href="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer"> + {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.wiki"}} + </a> + {{end}} + + {{if and (.Permission.CanReadAny $.UnitTypeCode $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases)}} + <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity"> + {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}} + </a> + {{end}} + + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} + <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions"> + {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}} + {{if .Repository.NumOpenActionRuns}} + <span class="ui small label">{{CountFmt .Repository.NumOpenActionRuns}}</span> + {{end}} + </a> + {{end}} + + {{template "custom/extra_tabs" .}} + + {{if and RepoFlagsEnabled .SignedUser.IsAdmin}} + <a class="{{if .IsRepoFlagsPage}}active {{end}}item" href="{{.RepoLink}}/flags"> + {{svg "octicon-milestone"}} {{ctx.Locale.Tr "repo.admin.manage_flags"}} + </a> + {{end}} + + {{if .Permission.IsAdmin}} + {{$highlightSettings := true}} + {{if and .SignedUser.EnableRepoUnitHints (not (.Repository.AllUnitsEnabled ctx))}} + {{$highlightSettings = false}} + <a class="{{if .PageIsRepoSettingsUnits}}active {{end}}item" href="{{.RepoLink}}/settings/units"> + {{svg "octicon-plus"}} {{ctx.Locale.Tr "repo.settings.units.add_more"}} + </a> + {{end}} + <a id="settings-btn" class="{{if and .PageIsRepoSettings (or $highlightSettings (not .PageIsRepoSettingsUnits))}}active {{end}}right item" href="{{.RepoLink}}/settings"> + {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} + </a> + {{end}} + </div> + {{else if .Permission.IsAdmin}} + <div class="overflow-menu-items"> + <a id="settings-btn" class="{{if .PageIsRepoSettings}}active {{end}}right item" href="{{.RepoLink}}/settings"> + {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} + </a> + </div> + {{end}} + </overflow-menu> + <div class="ui tabs divider"></div> +</div> diff --git a/templates/repo/header_fork.tmpl b/templates/repo/header_fork.tmpl new file mode 100644 index 00000000..de83000e --- /dev/null +++ b/templates/repo/header_fork.tmpl @@ -0,0 +1,52 @@ +{{with .Repository}} +{{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}} + <div class="ui labeled button + {{if or (not $.IsSigned) (and (not $.CanSignedUserFork) (not $.UserAndOrgForks))}} + disabled + {{end}}" + {{if not $.IsSigned}} + data-tooltip-content="{{ctx.Locale.Tr "repo.fork_guest_user"}}" + {{else if and (not $.CanSignedUserFork) (not $.UserAndOrgForks)}} + data-tooltip-content="{{ctx.Locale.Tr "repo.fork_from_self"}}" + {{end}} + > + <a class="ui compact{{if $.ShowForkModal}} show-modal{{end}} small basic button" + {{if not $.CanSignedUserFork}} + {{if gt (len $.UserAndOrgForks) 1}} + href="#" data-modal="#fork-repo-modal" + {{else if eq (len $.UserAndOrgForks) 1}} + href="{{AppSubUrl}}/{{(index $.UserAndOrgForks 0).FullName}}" + {{/*else is not required here, because the button shouldn't link to any site if you can't create a fork*/}} + {{end}} + {{else if not $.UserAndOrgForks}} + href="{{$.RepoLink}}/fork" + {{else}} + href="#" data-modal="#fork-repo-modal" + {{end}} + > + {{svg "octicon-repo-forked"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.fork"}}</span> + </a> + <div class="ui small modal" id="fork-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.already_forked" .Name}} + </div> + <div class="content tw-text-left"> + <div class="ui list"> + {{range $.UserAndOrgForks}} + <div class="ui item tw-py-2"> + <a href="{{.Link}}">{{svg "octicon-repo-forked" 16 "tw-mr-2"}}{{.FullName}}</a> + </div> + {{end}} + </div> + {{if $.CanSignedUserFork}} + <div class="divider"></div> + <a href="{{$.RepoLink}}/fork">{{ctx.Locale.Tr "repo.fork_to_different_account"}}</a> + {{end}} + </div> + </div> + <a class="ui basic label" href="{{.Link}}/forks"> + {{CountFmt .NumForks}} + </a> + </div> +{{end}} +{{end}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl new file mode 100644 index 00000000..1f531219 --- /dev/null +++ b/templates/repo/home.tmpl @@ -0,0 +1,164 @@ +{{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 .IsBlame}}fluid padded{{end}}"> + {{template "base/alert" .}} + {{template "repo/code/recently_pushed_new_branches" .}} + {{if and (not .HideRepoInfo) (not .IsBlame)}} + <div class="repo-description"> + <div id="repo-desc" class="tw-break-anywhere tw-text-16"> + {{$description := .Repository.DescriptionHTML $.Context}} + {{if $description}}<span class="description">{{$description | RenderCodeBlock}}</span>{{else}}<span class="no-description text-italic">{{ctx.Locale.Tr "repo.no_desc"}}</span>{{end}} + {{if .Repository.Website}}<a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}} + </div> + <form class="ignore-dirty" action="{{.RepoLink}}/search/{{if .CodeIndexerDisabled}}{{.BranchNameSubURL}}{{end}}" method="get" data-test-tag="codesearch"> + <div class="ui small action input"> + <input name="q" value="{{.Keyword}}" placeholder="{{ctx.Locale.Tr "search.code_kind"}}"> + {{template "shared/search/button"}} + </div> + </form> + </div> + <div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics"> + {{/* it should match the code in issue-home.js */}} + {{range .Topics}}<a class="repo-topic ui large label" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}} + {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="btn interact-fg tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>{{end}} + </div> + {{end}} + {{if and .Permission.IsAdmin (not .Repository.IsArchived)}} + <div class="ui form tw-hidden tw-flex tw-gap-2 tw-my-2" id="topic_edit"> + <div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1"> + <input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}"> + {{range .Topics}} + {{/* keep the same layout as Fomantic UI generated labels */}} + <a class="ui label transition visible tw-cursor-default tw-inline-block" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a> + {{end}} + <div class="text"></div> + </div> + <div> + <button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button> + <button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button> + </div> + </div> + {{end}} + + {{if RepoFlagsEnabled}} + {{template "custom/repo_flag_banners" .}} + {{if .SignedUser.IsAdmin}} + {{template "repo/admin_flags" .}} + {{end}} + {{end}} + + {{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" (DateTime "long" .Repository.ArchivedUnix)}} + {{end}} + </div> + {{end}} + {{template "repo/sub_menu" .}} + {{$n := len .TreeNames}} + {{$l := Eval $n "-" 1}} + {{$isHomepage := (eq $n 0)}} + <div class="repo-button-row"> + <div class="tw-flex tw-items-center tw-gap-y-2"> + {{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mr-1"}} + {{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 and breadcrumbs if not on home page --> + {{if $isHomepage}} + <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 tw-mr-1"{{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 $isHomepage (.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 $isHomepage)}} + <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 $l -}} + <span class="active section" title="{{$v}}">{{$v}}</span> + {{- 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="tw-flex tw-items-center"> + <!-- Only show clone panel in repository home page --> + {{if $isHomepage}} + <div class="clone-panel ui action tiny input"> + {{template "repo/clone_buttons" .}} + <button class="ui small jump dropdown icon button" data-tooltip-content="{{ctx.Locale.Tr "repo.more_operations"}}"> + {{svg "octicon-kebab-horizontal"}} + <div class="menu"> + {{if not $.DisableDownloadSourceArchives}} + <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.download_zip"}}</a> + <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.download_tar"}}</a> + <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.download_bundle"}}</a> + {{end}} + {{if .CitiationExist}} + <a class="item" id="cite-repo-button">{{svg "octicon-cross-reference" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.cite_this_repo"}}</a> + {{end}} + {{range .OpenWithEditorApps}} + <a class="item js-clone-url-editor" data-href-template="{{.OpenURL}}">{{.IconHTML}}{{ctx.Locale.Tr "repo.open_with_editor" .DisplayName}}</a> + {{end}} + </div> + </button> + {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}} + </div> + {{template "repo/cite/cite_modal" .}} + {{end}} + {{if and (not $isHomepage) (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 */}} + {{template "repo/view_list" .}} + {{end}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl new file mode 100644 index 00000000..e5e0bd68 --- /dev/null +++ b/templates/repo/icon.tmpl @@ -0,0 +1,10 @@ +{{$avatarLink := (.RelAvatarLink ctx)}} +{{if $avatarLink}} + <img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt="{{.FullName}}"> +{{else if $.IsMirror}} + {{svg "octicon-mirror" 24}} +{{else if $.IsFork}} + {{svg "octicon-repo-forked" 24}} +{{else}} + {{svg "octicon-repo" 24}} +{{end}} diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl new file mode 100644 index 00000000..4c22c283 --- /dev/null +++ b/templates/repo/issue/card.tmpl @@ -0,0 +1,78 @@ +{{with .Issue}} + {{if eq $.Page.Project.CardType 1}}{{/* Images and Text*/}} + {{$attachments := index $.Page.issuesAttachmentMap .ID}} + {{if $attachments}} + <div class="card-attachment-images"> + {{range $attachments}} + <img src="{{.DownloadURL}}" alt="{{.Name}}" /> + {{end}} + </div> + {{end}} + {{end}} + <div class="content tw-w-full"> + <div class="tw-flex tw-items-start tw-gap-[5px]"> + <div class="issue-card-icon"> + {{template "shared/issueicon" .}} + </div> + <a class="issue-card-title muted issue-title tw-break-anywhere" href="{{.Link}}">{{.Title | RenderEmoji ctx | RenderCodeBlock}}</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}}"> + {{svg "octicon-x" 16}} + </a> + {{end}} + </div> + <div class="meta"> + <span class="text light grey muted-links"> + {{if not $.Page.Repository}}{{.Repo.FullName}}{{end}}#{{.Index}} + {{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}} + {{if .OriginalAuthor}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}} + {{else if gt .Poster.ID 0}} + {{ctx.Locale.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.GetDisplayName}} + {{else}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .Poster.GetDisplayName}} + {{end}} + </span> + </div> + {{if .MilestoneID}} + <div class="meta tw-my-1"> + <a class="milestone" href="{{.Repo.Link}}/milestone/{{.MilestoneID}}"> + {{svg "octicon-milestone" 16 "tw-mr-1 tw-align-middle"}} + <span class="tw-align-middle">{{.Milestone.Name}}</span> + </a> + </div> + {{end}} + {{if $.Page.LinkedPRs}} + {{range index $.Page.LinkedPRs .ID}} + <div class="meta tw-my-1"> + <a href="{{$.Issue.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> + </div> + {{end}} + {{end}} + {{$tasks := .GetTasks}} + {{if gt $tasks 0}} + <div class="meta tw-my-1"> + {{svg "octicon-checklist" 16 "tw-mr-1 tw-align-middle"}} + <span class="tw-align-middle">{{.GetTasksDone}} / {{$tasks}}</span> + </div> + {{end}} + </div> + + {{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}}">{{RenderLabel ctx ctx.Locale .}}</a> + {{end}} + </div> + <div class="issue-card-assignees"> + {{range .Assignees}} + <a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{ctx.Locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28}}</a> + {{end}} + </div> + </div> + {{end}} +{{end}} diff --git a/templates/repo/issue/choose.tmpl b/templates/repo/issue/choose.tmpl new file mode 100644 index 00000000..38cf9e48 --- /dev/null +++ b/templates/repo/issue/choose.tmpl @@ -0,0 +1,59 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository new issue"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <div class="issue-navbar"> + {{template "repo/issue/navbar" .}} + </div> + <div class="divider"></div> + {{range .IssueTemplates}} + <div class="ui attached segment"> + <div class="ui two column grid"> + <div class="column left aligned"> + <strong>{{.Name}}</strong> + <br>{{.About}} + </div> + <div class="column right aligned"> + <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> + </div> + {{end}} + {{range .IssueConfig.ContactLinks}} + <div class="ui attached segment"> + <div class="ui two column grid"> + <div class="column left aligned"> + <strong>{{.Name}}</strong> + <br>{{.About}} + </div> + <div class="column right aligned"> + <a href="{{.URL}}" class="ui primary button">{{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues.choose.open_external_link"}}</a> + </div> + </div> + </div> + {{end}} + {{if .IssueConfig.BlankIssuesEnabled}} + <div class="ui attached segment"> + <div class="ui two column grid"> + <div class="column left aligned"> + <strong>{{ctx.Locale.Tr "repo.issues.choose.blank"}}</strong> + <br/>{{ctx.Locale.Tr "repo.issues.choose.blank_about"}} + </div> + <div class="column right aligned"> + <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> + </div> + {{end}} + {{- if .IssueConfigError}}{{/* normal warning flash makes problems here*/}} + <div class="ui warning message"> + <div class="text left"> + <div>{{ctx.Locale.Tr "repo.issues.choose.invalid_config"}}</div> + <div>{{.IssueConfigError}}</div> + </div> + </div> + {{end}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/issue/comment_tab.tmpl b/templates/repo/issue/comment_tab.tmpl new file mode 100644 index 00000000..4197ea4f --- /dev/null +++ b/templates/repo/issue/comment_tab.tmpl @@ -0,0 +1,21 @@ +{{$textareaContent := .BodyQuery}} +{{if not $textareaContent}}{{$textareaContent = .IssueTemplate}}{{end}} +{{if not $textareaContent}}{{$textareaContent = .PullRequestTemplate}}{{end}} +{{if not $textareaContent}}{{$textareaContent = .content}}{{end}} + +<div class="field"> + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewUrl" (print .Repository.Link "/markup") + "MarkdownPreviewContext" .RepoLink + "TextareaName" "content" + "TextareaContent" $textareaContent + "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder") + "DropzoneParentContainer" "form, .ui.form" + )}} +</div> + +{{if .IsAttachmentEnabled}} + <div class="field"> + {{template "repo/upload" .}} + </div> +{{end}} diff --git a/templates/repo/issue/fields/checkboxes.tmpl b/templates/repo/issue/fields/checkboxes.tmpl new file mode 100644 index 00000000..531f401f --- /dev/null +++ b/templates/repo/issue/fields/checkboxes.tmpl @@ -0,0 +1,14 @@ +<div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}}"> + {{template "repo/issue/fields/header" .}} + {{range $i, $opt := .item.Attributes.options}} + <div class="field inline"> + <div class="ui checkbox tw-mr-0 {{if and ($opt.visible) (not (SliceUtils.Contains $opt.visible "form"))}}tw-hidden{{end}}"> + <input type="checkbox" name="form-field-{{$.item.ID}}-{{$i}}" {{if $opt.required}}required{{end}}> + <label>{{RenderMarkdownToHtml $.context $opt.label}}</label> + </div> + {{if $opt.required}} + <label class="required"></label> + {{end}} + </div> + {{end}} +</div> diff --git a/templates/repo/issue/fields/dropdown.tmpl b/templates/repo/issue/fields/dropdown.tmpl new file mode 100644 index 00000000..26505f58 --- /dev/null +++ b/templates/repo/issue/fields/dropdown.tmpl @@ -0,0 +1,17 @@ +<div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}}"> + {{template "repo/issue/fields/header" .}} + {{/* FIXME: required validation */}} + <div class="ui fluid selection dropdown {{if .item.Attributes.multiple}}multiple clearable{{end}}"> + <input type="hidden" name="form-field-{{.item.ID}}" value="{{.item.Attributes.default}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{if not .item.Validations.required}} + {{svg "octicon-x" 14 "remove icon"}} + {{end}} + <div class="default text"></div> + <div class="menu"> + {{range $i, $opt := .item.Attributes.options}} + <div class="item" data-value="{{$i}}">{{$opt}}</div> + {{end}} + </div> + </div> +</div> diff --git a/templates/repo/issue/fields/header.tmpl b/templates/repo/issue/fields/header.tmpl new file mode 100644 index 00000000..6034fed5 --- /dev/null +++ b/templates/repo/issue/fields/header.tmpl @@ -0,0 +1,6 @@ +{{if .item.Attributes.label}} + <h3>{{.item.Attributes.label}}{{if .item.Validations.required}}<label class="required"></label>{{end}}</h3> +{{end}} +{{if .item.Attributes.description}} + <span class="help">{{RenderMarkdownToHtml .Context .item.Attributes.description}}</span> +{{end}} diff --git a/templates/repo/issue/fields/input.tmpl b/templates/repo/issue/fields/input.tmpl new file mode 100644 index 00000000..039f9a9f --- /dev/null +++ b/templates/repo/issue/fields/input.tmpl @@ -0,0 +1,4 @@ +<div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}}"> + {{template "repo/issue/fields/header" .}} + <input type="{{if .item.Validations.is_number}}number{{else}}text{{end}}" name="form-field-{{.item.ID}}" placeholder="{{.item.Attributes.placeholder}}" value="{{.item.Attributes.value}}" {{if .item.Validations.required}}required{{end}} {{if .item.Validations.regex}}pattern="{{.item.Validations.regex}}" title="{{.item.Validations.regex}}"{{end}}> +</div> diff --git a/templates/repo/issue/fields/markdown.tmpl b/templates/repo/issue/fields/markdown.tmpl new file mode 100644 index 00000000..934699ed --- /dev/null +++ b/templates/repo/issue/fields/markdown.tmpl @@ -0,0 +1,3 @@ +<div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}}"> + <div>{{RenderMarkdownToHtml .Context .item.Attributes.value}}</div> +</div> diff --git a/templates/repo/issue/fields/textarea.tmpl b/templates/repo/issue/fields/textarea.tmpl new file mode 100644 index 00000000..3ad69e12 --- /dev/null +++ b/templates/repo/issue/fields/textarea.tmpl @@ -0,0 +1,24 @@ +{{$useMarkdownEditor := not .item.Attributes.render}} +<div class="field {{if not .item.VisibleOnForm}}tw-hidden{{end}} {{if $useMarkdownEditor}}combo-editor-dropzone{{end}}"> + {{template "repo/issue/fields/header" .}} + + {{/* the real form element to provide the value */}} + <textarea class="form-field-real" name="form-field-{{.item.ID}}" placeholder="{{.item.Attributes.placeholder}}" {{if and .item.Validations.required}}required{{end}}>{{.item.Attributes.value}}</textarea> + + {{if $useMarkdownEditor}} + {{template "shared/combomarkdowneditor" (dict + "ContainerClasses" "tw-hidden" + "MarkdownPreviewUrl" (print .root.RepoLink "/markup") + "MarkdownPreviewContext" .root.RepoLink + "TextareaContent" .item.Attributes.value + "TextareaPlaceholder" .item.Attributes.placeholder + "DropzoneParentContainer" ".combo-editor-dropzone" + )}} + + {{if .root.IsAttachmentEnabled}} + <div class="tw-mt-4 form-field-dropzone tw-hidden"> + {{template "repo/upload" .root}} + </div> + {{end}} + {{end}} +</div> diff --git a/templates/repo/issue/filter_actions.tmpl b/templates/repo/issue/filter_actions.tmpl new file mode 100644 index 00000000..a341448b --- /dev/null +++ b/templates/repo/issue/filter_actions.tmpl @@ -0,0 +1,128 @@ +<div class="ui secondary filter menu"> + {{if not .Repository.IsArchived}} + <!-- Action Button --> + {{if .IsShowClosed}} + <button class="ui primary basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_open"}}</button> + {{else}} + <button class="ui red basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status">{{ctx.Locale.Tr "repo.issues.action_close"}}</button> + {{end}} + {{if $.IsRepoAdmin}} + <button class="ui red button issue-action" + data-action="delete" data-url="{{$.RepoLink}}/issues/delete" + data-action-delete-confirm="{{ctx.Locale.Tr "confirm_delete_selected"}}" + >{{ctx.Locale.Tr "repo.issues.delete"}}</button> + {{end}} + <!-- Labels --> + <div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.action_label"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item issue-action" data-action="clear" data-url="{{$.RepoLink}}/issues/labels"> + {{ctx.Locale.Tr "repo.issues.new.clear_labels"}} + </div> + {{$previousExclusiveScope := "_no_scope"}} + {{range .Labels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <div class="item issue-action tw-flex tw-justify-between" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels"> + {{if SliceUtils.Contains $.SelLabelIDs .ID}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context ctx.Locale .}} + {{template "repo/issue/labels/label_archived" .}} + </div> + {{end}} + </div> + </div> + + <!-- Milestone --> + <div class="ui {{if not (or .OpenMilestones .ClosedMilestones)}}disabled{{end}} dropdown jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.action_milestone"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/milestone"> + {{ctx.Locale.Tr "repo.issues.action_milestone_no_select"}} + </div> + {{if .OpenMilestones}} + <div class="divider"></div> + <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_open"}}</div> + {{range .OpenMilestones}} + <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/milestone"> + {{.Name}} + </div> + {{end}} + {{end}} + {{if .ClosedMilestones}} + <div class="divider"></div> + <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_closed"}}</div> + {{range .ClosedMilestones}} + <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/milestone"> + {{.Name}} + </div> + {{end}} + {{end}} + </div> + </div> + + <!-- Projects --> + <div class="ui{{if not (or .OpenProjects .ClosedProjects)}} disabled{{end}} dropdown jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.projects"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/projects"> + {{ctx.Locale.Tr "repo.issues.new.clear_projects"}} + </div> + {{if .OpenProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.open_projects"}} + </div> + {{range .OpenProjects}} + <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </div> + {{end}} + {{end}} + {{if .ClosedProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.closed_projects"}} + </div> + {{range .ClosedProjects}} + <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </div> + {{end}} + {{end}} + </div> + </div> + + <!-- Assignees --> + <div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.action_assignee"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item issue-action" data-action="clear" data-url="{{$.Link}}/assignee"> + {{ctx.Locale.Tr "repo.issues.new.clear_assignees"}} + </div> + <div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/assignee"> + {{ctx.Locale.Tr "repo.issues.action_assignee_no_select"}} + </div> + {{range .Assignees}} + <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/assignee"> + {{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}} + </div> + {{end}} + </div> + </div> + {{end}} +</div> + diff --git a/templates/repo/issue/filter_list.tmpl b/templates/repo/issue/filter_list.tmpl new file mode 100644 index 00000000..09f87b58 --- /dev/null +++ b/templates/repo/issue/filter_list.tmpl @@ -0,0 +1,158 @@ +<!-- Label --> +{{template "shared/label_filter" .}} + +{{if not .Milestone}} +<!-- Milestone --> +<div class="list-header-milestone ui {{if not (or .OpenMilestones .ClosedMilestones)}}disabled{{end}} dropdown jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_milestone"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_milestone"}}"> + </div> + <div class="divider"></div> + <a rel="nofollow" class="{{if not $.MilestoneID}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone=0&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_all"}}</a> + <a rel="nofollow" class="{{if $.MilestoneID}}{{if eq $.MilestoneID -1}}active selected {{end}}{{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone=-1&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_milestone_none"}}</a> + {{if .OpenMilestones}} + <div class="divider"></div> + <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_open"}}</div> + {{range .OpenMilestones}} + <a rel="nofollow" class="{{if $.MilestoneID}}{{if eq $.MilestoneID .ID}}active selected {{end}}{{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.ID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}"> + {{svg "octicon-milestone" 16 "mr-2"}} + {{.Name}} + </a> + {{end}} + {{end}} + {{if .ClosedMilestones}} + <div class="divider"></div> + <div class="header">{{ctx.Locale.Tr "repo.issues.filter_milestone_closed"}}</div> + {{range .ClosedMilestones}} + <a rel="nofollow" class="{{if $.MilestoneID}}{{if eq $.MilestoneID .ID}}active selected {{end}}{{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.ID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}"> + {{svg "octicon-milestone" 16 "mr-2"}} + {{.Name}} + </a> + {{end}} + {{end}} + </div> +</div> +{{end}} + +<!-- Project --> +<div class="list-header-project ui{{if not (or .OpenProjects .ClosedProjects)}} disabled{{end}} dropdown jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_project"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_project"}}"> + </div> + <a rel="nofollow" class="{{if not .ProjectID}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project=&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_project_all"}}</a> + <a rel="nofollow" class="{{if eq .ProjectID -1}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project=-1&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_project_none"}}</a> + {{if .OpenProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.open_projects"}} + </div> + {{range .OpenProjects}} + <a rel="nofollow" class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item tw-flex" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}"> + {{svg .IconName 18 "tw-mr-2 tw-shrink-0"}}<span class="gt-ellipsis">{{.Title}}</span> + </a> + {{end}} + {{end}} + {{if .ClosedProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.closed_projects"}} + </div> + {{range .ClosedProjects}} + <a rel="nofollow" class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </a> + {{end}} + {{end}} + </div> +</div> + +<!-- Author --> +<div class="list-header-author ui dropdown jump item user-remote-search" data-tooltip-content="{{ctx.Locale.Tr "repo.author_search_tooltip"}}" + data-search-url="{{if .Milestone}}{{$.RepoLink}}/issues/posters{{else}}{{$.Link}}/posters{{end}}" + data-selected-user-id="{{$.PosterID}}" + data-action-jump-url="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&fuzzy={{$.IsFuzzy}}&poster={user_id}{{if $.ShowArchivedLabels}}&archived=true{{end}}" +> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_poster"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_poster"}}"> + </div> + <a class="item" data-value="0">{{ctx.Locale.Tr "repo.issues.filter_poster_no_select"}}</a> + </div> +</div> + +<!-- Assignee --> +<div class="list-header-assignee ui {{if not .Assignees}}disabled{{end}} dropdown jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_assignee"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignee"}}"> + </div> + <a rel="nofollow" class="{{if not .AssigneeID}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee=&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_assginee_no_select"}}</a> + <a rel="nofollow" class="{{if eq .AssigneeID -1}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee=-1&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_assginee_no_assignee"}}</a> + <div class="divider"></div> + {{range .Assignees}} + <a rel="nofollow" class="{{if eq $.AssigneeID .ID}}active selected{{end}} item tw-flex" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}"> + {{ctx.AvatarUtils.Avatar . 20}}{{template "repo/search_name" .}} + </a> + {{end}} + </div> +</div> + +{{if .IsSigned}} + <!-- Type --> + <div class="list-header-type ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_type"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a rel="nofollow" class="{{if eq .ViewType "all"}}active {{end}}item" href="?q={{$.Keyword}}&type=all&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.all_issues"}}</a> + <a rel="nofollow" class="{{if eq .ViewType "assigned"}}active {{end}}item" href="?q={{$.Keyword}}&type=assigned&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.assigned_to_you"}}</a> + <a rel="nofollow" class="{{if eq .ViewType "created_by"}}active {{end}}item" href="?q={{$.Keyword}}&type=created_by&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.created_by_you"}}</a> + {{if .PageIsPullList}} + <a rel="nofollow" class="{{if eq .ViewType "review_requested"}}active {{end}}item" href="?q={{$.Keyword}}&type=review_requested&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.review_requested"}}</a> + <a rel="nofollow" class="{{if eq .ViewType "reviewed_by"}}active {{end}}item" href="?q={{$.Keyword}}&type=reviewed_by&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.reviewed_by_you"}}</a> + {{end}} + <a rel="nofollow" class="{{if eq .ViewType "mentioned"}}active {{end}}item" href="?q={{$.Keyword}}&type=mentioned&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.mentioning_you"}}</a> + </div> + </div> +{{end}} + +<!-- Sort --> +<div class="list-header-sort ui dropdown downward type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a rel="nofollow" class="{{if or (eq .SortType "latest") (not .SortType)}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=latest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a rel="nofollow" class="{{if eq .SortType "oldest"}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=oldest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a rel="nofollow" class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=recentupdate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> + <a rel="nofollow" class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=leastupdate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> + <a rel="nofollow" class="{{if eq .SortType "mostcomment"}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=mostcomment&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.mostcomment"}}</a> + <a rel="nofollow" class="{{if eq .SortType "leastcomment"}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=leastcomment&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastcomment"}}</a> + <a rel="nofollow" class="{{if eq .SortType "nearduedate"}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=nearduedate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.nearduedate"}}</a> + <a rel="nofollow" class="{{if eq .SortType "farduedate"}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=farduedate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.farduedate"}}</a> + </div> +</div> diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl new file mode 100644 index 00000000..06e7c1aa --- /dev/null +++ b/templates/repo/issue/filters.tmpl @@ -0,0 +1,26 @@ +<div id="issue-filters" class="issue-list-toolbar"> + <div class="issue-list-toolbar-left"> + {{if and $.CanWriteIssuesOrPulls .Issues}} + <input type="checkbox" autocomplete="off" class="issue-checkbox-all tw-mr-4" title="{{ctx.Locale.Tr "repo.issues.action_check_all"}}"> + {{end}} + {{template "repo/issue/openclose" .}} + <!-- Total Tracked Time --> + {{if .TotalTrackedTime}} + <div class="ui compact tiny secondary menu"> + <span class="item" data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> + {{svg "octicon-clock"}} + {{.TotalTrackedTime | Sec2Time}} + </span> + </div> + {{end}} + </div> + <div class="issue-list-toolbar-right"> + <div class="ui secondary filter menu labels"> + {{if .PageIsMilestones}} + {{template "repo/issue/milestone/filter_list" .}} + {{else}} + {{template "repo/issue/filter_list" .}} + {{end}} + </div> + </div> +</div> diff --git a/templates/repo/issue/label_precolors.tmpl b/templates/repo/issue/label_precolors.tmpl new file mode 100644 index 00000000..80007662 --- /dev/null +++ b/templates/repo/issue/label_precolors.tmpl @@ -0,0 +1,22 @@ +<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> + </div> +</div> diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl new file mode 100644 index 00000000..230777ef --- /dev/null +++ b/templates/repo/issue/labels.tmpl @@ -0,0 +1,22 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository labels"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="issue-navbar tw-mb-4"> + {{template "repo/issue/navbar" .}} + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + <button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button> + {{end}} + </div> + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + {{template "repo/issue/labels/label_new" .}} + {{end}} + {{template "base/alert" .}} + {{template "repo/issue/labels/label_list" .}} + </div> +</div> + +{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + {{template "repo/issue/labels/edit_delete_label" .}} +{{end}} +{{template "base/footer" .}} diff --git a/templates/repo/issue/labels/edit_delete_label.tmpl b/templates/repo/issue/labels/edit_delete_label.tmpl new file mode 100644 index 00000000..fcf69217 --- /dev/null +++ b/templates/repo/issue/labels/edit_delete_label.tmpl @@ -0,0 +1,72 @@ +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.issues.label_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.issues.label_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +<div class="ui small edit-label modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.label_modify"}} + </div> + <div class="content"> + <form class="ui edit-label form ignore-dirty" action="{{$.Link}}/edit" method="post"> + {{.CsrfTokenHtml}} + <input id="label-modal-id" name="id" type="hidden"> + <div class="required field"> + <label for="name">{{ctx.Locale.Tr "repo.issues.label_title"}}</label> + <div class="ui small input"> + <input class="label-name-input" name="title" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> + </div> + </div> + <div class="field label-exclusive-input-field"> + <div class="ui checkbox"> + <input class="label-exclusive-input" name="exclusive" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.issues.label_exclusive"}}</label> + </div> + <br> + <small class="desc">{{ctx.Locale.Tr "repo.issues.label_exclusive_desc"}}</small> + <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> + <div class="field label-is-archived-input-field"> + <div class="ui checkbox"> + <input class="label-is-archived-input" name="is_archived" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.issues.label_archive"}}</label> + </div> + <i class="tw-ml-1" data-tooltip-content={{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}> + {{svg "octicon-info"}} + </i> + </div> + <div class="field"> + <label for="description">{{ctx.Locale.Tr "repo.issues.label_description"}}</label> + <div class="ui small fluid input"> + <input class="label-desc-input" name="description" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> + </div> + <div class="field color-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"> + {{template "repo/issue/label_precolors"}} + </div> + </div> + </form> + </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> +</div> diff --git a/templates/repo/issue/labels/label.tmpl b/templates/repo/issue/labels/label.tmpl new file mode 100644 index 00000000..3651ba11 --- /dev/null +++ b/templates/repo/issue/labels/label.tmpl @@ -0,0 +1,7 @@ +<a + class="item {{if not .label.IsChecked}}tw-hidden{{end}}" + id="label_{{.label.ID}}" + href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}"{{/* FIXME: use .root.Issue.Link or create .root.Link */}} +> + {{- RenderLabel $.Context ctx.Locale .label -}} +</a> diff --git a/templates/repo/issue/labels/label_archived.tmpl b/templates/repo/issue/labels/label_archived.tmpl new file mode 100644 index 00000000..feaf77e4 --- /dev/null +++ b/templates/repo/issue/labels/label_archived.tmpl @@ -0,0 +1,5 @@ +{{if .IsArchived}} + <span class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}"> + {{ctx.Locale.Tr "archived"}} + </span> +{{end}} diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl new file mode 100644 index 00000000..8d7fc2c3 --- /dev/null +++ b/templates/repo/issue/labels/label_list.tmpl @@ -0,0 +1,88 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.issues.label_count" .NumLabels}} + <div class="ui right"> + <div class="ui secondary menu"> + <!-- Sort --> + <div class="item ui jump dropdown tw-py-2"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active {{end}}item" href="?sort=alphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?sort=reversealphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> + <a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="?sort=leastissues&state={{$.State}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}}</a> + <a class="{{if eq .SortType "mostissues"}}active {{end}}item" href="?sort=mostissues&state={{$.State}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}}</a> + </div> + </div> + </div> + </div> <!-- filter menu --> +</h4> + +<div class="ui attached segment"> + {{if and (not $.PageIsOrgSettingsLabels) (or $.CanWriteIssues $.CanWritePulls) (eq .NumLabels 0) (not $.Repository.IsArchived)}} + {{template "repo/issue/labels/label_load_template" .}} + <div class="divider"></div> + {{else if and ($.PageIsOrgSettingsLabels) (eq .NumLabels 0)}} + {{template "repo/issue/labels/label_load_template" .}} + <div class="divider"></div> + {{end}} + + <ul class="issue-label-list"> + {{range .Labels}} + <li class="item"> + <div class="label-title"> + {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + </div> + <div class="label-issues"> + {{if $.PageIsOrgSettingsLabels}} + <a class="open-issues" href="{{AppSubUrl}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> + {{else}} + <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"> + {{template "repo/issue/labels/label_archived" .}} + <div class="tw-flex tw-ml-auto"> + {{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}} + <a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a> + <a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a> + {{else if $.PageIsOrgSettingsLabels}} + <a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a> + <a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{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> + </li> + + {{range .OrgLabels}} + <li class="item org-label"> + <div class="label-title"> + {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + </div> + <div class="label-issues"> + <a class="open-issues" {{if .IsArchived}}data-is-archived{{end}} href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a> + </div> + <div class="label-operation"> + {{template "repo/issue/labels/label_archived" .}} + </div> + </li> + {{end}} + {{end}} + </ul> +</div> diff --git a/templates/repo/issue/labels/label_load_template.tmpl b/templates/repo/issue/labels/label_load_template.tmpl new file mode 100644 index 00000000..02494300 --- /dev/null +++ b/templates/repo/issue/labels/label_load_template.tmpl @@ -0,0 +1,24 @@ +<div class="ui centered grid"> + <div class="twelve wide computer column"> + <div class="ui attached left aligned segment"> + <p>{{ctx.Locale.Tr "repo.issues.label_templates.info"}}</p> + <br> + <form class="ui form center" action="{{.Link}}/initialize" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <div class="ui selection dropdown"> + <input type="hidden" name="template_name" value="Default"> + <div class="default text">{{ctx.Locale.Tr "repo.issues.label_templates.helper"}}</div> + <div class="menu"> + {{range .LabelTemplateFiles}} + <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><p>({{.Description}})</p></div> + {{end}} + </div> + {{svg "octicon-triangle-down" 18 "dropdown icon"}} + </div> + </div> + <button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.label_templates.use"}}</button> + </form> + </div> + </div> +</div> diff --git a/templates/repo/issue/labels/label_new.tmpl b/templates/repo/issue/labels/label_new.tmpl new file mode 100644 index 00000000..32fd8e76 --- /dev/null +++ b/templates/repo/issue/labels/label_new.tmpl @@ -0,0 +1,48 @@ +<div class="ui small new-label modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new_label"}} + </div> + <div class="content"> + <form class="ui new-label form ignore-dirty" action="{{$.Link}}/new" method="post"> + {{.CsrfTokenHtml}} + <div class="required field"> + <label for="name">{{ctx.Locale.Tr "repo.issues.label_title"}}</label> + <div class="ui small input"> + <input class="label-name-input" name="title" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> + </div> + </div> + <div class="field label-exclusive-input-field"> + <div class="ui checkbox"> + <input class="label-exclusive-input" name="exclusive" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.issues.label_exclusive"}}</label> + </div> + <br> + <small class="desc">{{ctx.Locale.Tr "repo.issues.label_exclusive_desc"}}</small> + </div> + <div class="field"> + <label for="description">{{ctx.Locale.Tr "repo.issues.label_description"}}</label> + <div class="ui small fluid input"> + <input class="label-desc-input" name="description" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> + </div> + <div class="field color-field"> + <label for="color">{{ctx.Locale.Tr "repo.issues.label_color"}}</label> + <div class="js-color-picker-input column"> + <input name="color" value="#70c24a" placeholder="#c320f6" required maxlength="7"> + {{template "repo/issue/label_precolors"}} + </div> + </div> + </form> + </div> + + <div class="actions"> + <button class="ui cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "cancel"}} + </button> + <button class="ui primary ok button"> + {{svg "octicon-check"}} + {{ctx.Locale.Tr "repo.issues.create_label"}} + </button> + </div> +</div> diff --git a/templates/repo/issue/labels/labels_selector_field.tmpl b/templates/repo/issue/labels/labels_selector_field.tmpl new file mode 100644 index 00000000..9e54e7a6 --- /dev/null +++ b/templates/repo/issue/labels/labels_selector_field.tmpl @@ -0,0 +1,46 @@ +<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown"> + <span class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.labels"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </span> + <div class="filter menu ugc-labels" {{if .Issue}}data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels"{{else}}data-id="#label_ids"{{end}}> + {{if or .Labels .OrgLabels}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input class="tw-w-auto" type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_labels"}}"> + </div> + {{end}} + <a class="no-select item" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a> + {{if or .Labels .OrgLabels}} + {{$previousExclusiveScope := "_no_scope"}} + {{range .Labels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}tw-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + <p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p> + </a> + {{end}} + <div class="divider"></div> + {{$previousExclusiveScope = "_no_scope"}} + {{range .OrgLabels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}tw-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + <p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p> + </a> + {{end}} + {{else}} + <div class="disabled item">{{ctx.Locale.Tr "repo.issues.new.no_items"}}</div> + {{end}} + </div> +</div> diff --git a/templates/repo/issue/labels/labels_sidebar.tmpl b/templates/repo/issue/labels/labels_sidebar.tmpl new file mode 100644 index 00000000..81fc9709 --- /dev/null +++ b/templates/repo/issue/labels/labels_sidebar.tmpl @@ -0,0 +1,11 @@ +<div class="ui labels list"> + <span class="no-select {{if .root.HasSelectedLabel}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span> + <span class="labels-list ugc-labels"> + {{range .root.Labels}} + {{template "repo/issue/labels/label" dict "root" $.root "label" .}} + {{end}} + {{range .root.OrgLabels}} + {{template "repo/issue/labels/label" dict "root" $.root "label" .}} + {{end}} + </span> +</div> diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl new file mode 100644 index 00000000..8c81bf02 --- /dev/null +++ b/templates/repo/issue/list.tmpl @@ -0,0 +1,55 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository issue-list"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + + {{if .PinnedIssues}} + <div id="issue-pins" {{if .IsRepoAdmin}}data-is-repo-admin{{end}}> + {{range .PinnedIssues}} + <div class="issue-card tw-break-anywhere {{if $.IsRepoAdmin}}tw-cursor-grab{{end}}" data-move-url="{{$.Link}}/move_pin" data-issue-id="{{.ID}}"> + {{template "repo/issue/card" (dict "Issue" . "Page" $ "isPinnedIssueCard" true)}} + </div> + {{end}} + </div> + {{end}} + + <div class="list-header list-header-issues"> + {{template "repo/issue/navbar" .}} + {{template "repo/issue/search" .}} + {{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> + {{else}} + <a class="ui small primary button new-pr-button issue-list-new{{if not .PullRequestCtx.Allowed}} disabled{{end}}" href="{{if .PullRequestCtx.Allowed}}{{.Repository.Link}}/compare/{{.Repository.DefaultBranch | PathEscapeSegments}}...{{if ne .Repository.Owner.Name .PullRequestCtx.BaseRepo.Owner.Name}}{{PathEscape .Repository.Owner.Name}}:{{end}}{{.Repository.DefaultBranch | PathEscapeSegments}}{{end}}">{{ctx.Locale.Tr "repo.pulls.new"}}</a> + {{end}} + {{else}} + {{if not .PageIsIssueList}} + <a class="ui small primary small button issue-list-new{{if not .PullRequestCtx.Allowed}} disabled{{end}}" href="{{if .PullRequestCtx.Allowed}}{{.PullRequestCtx.BaseRepo.Link}}/compare/{{.PullRequestCtx.BaseRepo.DefaultBranch | PathEscapeSegments}}...{{if ne .Repository.Owner.Name .PullRequestCtx.BaseRepo.Owner.Name}}{{PathEscape .Repository.Owner.Name}}:{{end}}{{.Repository.DefaultBranch | PathEscapeSegments}}{{end}}">{{ctx.Locale.Tr "action.compare_commits_general"}}</a> + {{end}} + {{end}} + </div> + + {{template "repo/issue/filters" .}} + + <div id="issue-actions" class="issue-list-toolbar tw-hidden"> + <div class="issue-list-toolbar-left"> + {{template "repo/issue/openclose" .}} + <!-- Total Tracked Time --> + {{if .TotalTrackedTime}} + <div class="ui compact tiny secondary menu"> + <span class="item" data-tooltip-content='{{ctx.Locale.Tr "tracked_time_summary"}}'> + {{svg "octicon-clock"}} + {{.TotalTrackedTime | Sec2Time}} + </span> + </div> + {{end}} + </div> + <div class="issue-list-toolbar-right"> + {{template "repo/issue/filter_actions" .}} + </div> + </div> + {{template "shared/issuelist" dict "." . "listType" "repo"}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/issue/milestone/filter_list.tmpl b/templates/repo/issue/milestone/filter_list.tmpl new file mode 100644 index 00000000..ecfb95bb --- /dev/null +++ b/templates/repo/issue/milestone/filter_list.tmpl @@ -0,0 +1,15 @@ +<!-- Sort --> +<div class="list-header-sort ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "closestduedate") (not .SortType)}}active {{end}}item" href="?sort=closestduedate&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.earliest_due_data"}}</a> + <a class="{{if eq .SortType "furthestduedate"}}active {{end}}item" href="?sort=furthestduedate&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.latest_due_date"}}</a> + <a class="{{if eq .SortType "leastcomplete"}}active {{end}}item" href="?sort=leastcomplete&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.least_complete"}}</a> + <a class="{{if eq .SortType "mostcomplete"}}active {{end}}item" href="?sort=mostcomplete&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}}</a> + <a class="{{if eq .SortType "mostissues"}}active {{end}}item" href="?sort=mostissues&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}}</a> + <a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="?sort=leastissues&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}}</a> + </div> +</div> diff --git a/templates/repo/issue/milestone/select_menu.tmpl b/templates/repo/issue/milestone/select_menu.tmpl new file mode 100644 index 00000000..9b0492ce --- /dev/null +++ b/templates/repo/issue/milestone/select_menu.tmpl @@ -0,0 +1,38 @@ +{{if or .OpenMilestones .ClosedMilestones}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_milestones"}}"> + </div> + <div class="divider"></div> +{{end}} +<div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_milestone"}}</div> +{{if and (not .OpenMilestones) (not .ClosedMilestones)}} + <div class="disabled item"> + {{ctx.Locale.Tr "repo.issues.new.no_items"}} + </div> +{{else}} + {{if .OpenMilestones}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.open_milestone"}} + </div> + {{range .OpenMilestones}} + <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> + {{svg "octicon-milestone" 16 "tw-mr-1"}} + {{.Name}} + </a> + {{end}} + {{end}} + {{if .ClosedMilestones}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.closed_milestone"}} + </div> + {{range .ClosedMilestones}} + <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> + {{svg "octicon-milestone" 16 "tw-mr-1"}} + {{.Name}} + </a> + {{end}} + {{end}} +{{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl new file mode 100644 index 00000000..e5dc8cb6 --- /dev/null +++ b/templates/repo/issue/milestone_issues.tmpl @@ -0,0 +1,65 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository milestone-issue-list"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <div class="tw-flex tw-items-center tw-justify-between"> + <h1 class="tw-mb-2">{{.Milestone.Name}}</h1> + {{if not .Repository.IsArchived}} + <div class="tw-flex button-row"> + {{if or .CanWriteIssues .CanWritePulls}} + {{if .Milestone.IsClosed}} + <a class="ui primary button link-action" href data-url="{{$.RepoLink}}/milestones/{{.MilestoneID}}/open">{{ctx.Locale.Tr "repo.milestones.open"}} + </a> + {{else}} + <a class="ui red button link-action" href data-url="{{$.RepoLink}}/milestones/{{.MilestoneID}}/close">{{ctx.Locale.Tr "repo.milestones.close"}} + </a> + {{end}} + <a class="ui button" href="{{.RepoLink}}/milestones/{{.MilestoneID}}/edit">{{ctx.Locale.Tr "repo.milestones.edit"}}</a> + {{end}} + <a class="ui primary button" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}?milestone={{.MilestoneID}}">{{ctx.Locale.Tr "repo.issues.new"}}</a> + </div> + {{end}} + </div> + {{if .Milestone.RenderedContent}} + <div class="markup content 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 class="tw-flex tw-items-center"> + {{$closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix ctx.Locale}} + {{if .IsClosed}} + {{svg "octicon-clock"}} {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} + {{else}} + + {{if .Milestone.DeadlineString}} + <span{{if .IsOverdue}} class="text red"{{end}}> + {{svg "octicon-calendar"}} + {{DateTime "short" .Milestone.DeadlineString}} + </span> + {{else}} + {{svg "octicon-calendar"}} + {{ctx.Locale.Tr "repo.milestones.no_due_date"}} + {{end}} + {{end}} + </div> + <div class="tw-mr-2">{{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}} + </div> + {{end}} + </div> + </div> + <div class="divider"></div> + + {{template "repo/issue/filters" .}} + + {{template "shared/issuelist" dict "." . "listType" "milestone"}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/issue/milestone_new.tmpl b/templates/repo/issue/milestone_new.tmpl new file mode 100644 index 00000000..9f32df00 --- /dev/null +++ b/templates/repo/issue/milestone_new.tmpl @@ -0,0 +1,59 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository new milestone"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="issue-navbar"> + {{template "repo/issue/navbar" .}} + {{if and (or .CanWriteIssues .CanWritePulls) .PageIsEditMilestone}} + <div class="ui right floated secondary menu"> + <a class="ui primary button" href="{{$.RepoLink}}/milestones/new">{{ctx.Locale.Tr "repo.milestones.new"}}</a> + </div> + {{end}} + </div> + <div class="divider"></div> + <h2 class="ui dividing header"> + {{if .PageIsEditMilestone}} + {{ctx.Locale.Tr "repo.milestones.edit"}} + <div class="sub header">{{ctx.Locale.Tr "repo.milestones.edit_subheader"}}</div> + {{else}} + {{ctx.Locale.Tr "repo.milestones.new"}} + <div class="sub header">{{ctx.Locale.Tr "repo.milestones.new_subheader"}}</div> + {{end}} + </h2> + {{template "base/alert" .}} + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Title}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.milestones.title"}}</label> + <input name="title" placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" value="{{.title}}" autofocus required maxlength="50"> + </div> + <div class="field {{if .Err_Deadline}}error{{end}}"> + <label> + {{ctx.Locale.Tr "repo.milestones.due_date"}} + <a id="clear-date">{{ctx.Locale.Tr "repo.milestones.clear"}}</a> + </label> + <input type="date" id="deadline" name="deadline" value="{{.deadline}}" placeholder="{{ctx.Locale.Tr "repo.issues.due_date_form"}}"> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.milestones.desc"}}</label> + <textarea name="content">{{.content}}</textarea> + </div> + <div class="divider"></div> + <div class="tw-text-right"> + {{if .PageIsEditMilestone}} + <a class="ui primary basic button" href="{{.RepoLink}}/milestones"> + {{ctx.Locale.Tr "repo.milestones.cancel"}} + </a> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.milestones.modify"}} + </button> + {{else}} + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.milestones.create"}} + </button> + {{end}} + </div> + </form> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl new file mode 100644 index 00000000..63a6f6b2 --- /dev/null +++ b/templates/repo/issue/milestones.tmpl @@ -0,0 +1,110 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository milestones"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + + <div class="list-header list-header-issues"> + {{template "repo/issue/navbar" .}} + {{template "repo/issue/search" .}} + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + <div class="button-row"> + <a class="ui small primary button" href="{{$.Link}}/new">{{ctx.Locale.Tr "repo.milestones.new"}}</a> + </div> + {{end}} + </div> + + {{template "repo/issue/filters" .}} + + <!-- milestone list --> + <div class="milestone-list"> + {{range .Milestones}} + <li class="milestone-card"> + <div class="milestone-header"> + <h3 class="flex-text-block tw-m-0"> + {{svg "octicon-milestone" 16}} + <a class="muted" href="{{$.RepoLink}}/milestone/{{.ID}}">{{.Name}}</a> + </h3> + <div class="tw-flex tw-items-center"> + <span class="tw-mr-2">{{.Completeness}}%</span> + <progress value="{{.Completeness}}" max="100"></progress> + </div> + </div> + <div class="milestone-toolbar"> + <div class="group"> + <div class="flex-text-block"> + {{svg "octicon-issue-opened" 14}} + {{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.Locale.Tr "repo.issues.closed_title"}} + </div> + {{if .TotalTrackedTime}} + <div class="flex-text-block"> + {{svg "octicon-clock"}} + {{.TotalTrackedTime|Sec2Time}} + </div> + {{end}} + {{if .UpdatedUnix}} + <div class="flex-text-block"> + {{svg "octicon-clock"}} + {{ctx.Locale.Tr "repo.milestones.update_ago" (TimeSinceUnix .UpdatedUnix ctx.Locale)}} + </div> + {{end}} + <div class="flex-text-block"> + {{if .IsClosed}} + {{$closedDate:= TimeSinceUnix .ClosedDateUnix ctx.Locale}} + {{svg "octicon-clock" 14}} + {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} + {{else}} + {{if .DeadlineString}} + <span class="flex-text-inline {{if .IsOverdue}}text red{{end}}"> + {{svg "octicon-calendar" 14}} + {{DateTime "short" .DeadlineString}} + </span> + {{else}} + {{svg "octicon-calendar" 14}} + {{ctx.Locale.Tr "repo.milestones.no_due_date"}} + {{end}} + {{end}} + </div> + </div> + {{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}} + <div class="group"> + <a class="flex-text-inline" href="{{$.Link}}/{{.ID}}/edit">{{svg "octicon-pencil" 14}}{{ctx.Locale.Tr "repo.issues.label_edit"}}</a> + {{if .IsClosed}} + <a class="link-action flex-text-inline" href data-url="{{$.Link}}/{{.ID}}/open">{{svg "octicon-check" 14}}{{ctx.Locale.Tr "repo.milestones.open"}}</a> + {{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> + </div> + {{end}} + </div> + {{if .Content}} + <div class="markup content"> + {{.RenderedContent}} + </div> + {{end}} + </li> + {{end}} + + {{template "base/paginate" .}} + </div> + </div> +</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> + {{template "base/modal_actions_confirm" .}} + </div> +{{end}} +{{template "base/footer" .}} diff --git a/templates/repo/issue/navbar.tmpl b/templates/repo/issue/navbar.tmpl new file mode 100644 index 00000000..30e42c77 --- /dev/null +++ b/templates/repo/issue/navbar.tmpl @@ -0,0 +1,4 @@ +<h2 class="ui compact small menu small-menu-items issue-list-navbar"> + <a class="{{if .PageIsLabels}}active {{end}}item" href="{{.RepoLink}}/labels">{{ctx.Locale.Tr "repo.labels"}}</a> + <a class="{{if .PageIsMilestones}}active {{end}}item" href="{{.RepoLink}}/milestones">{{ctx.Locale.Tr "repo.milestones"}}</a> +</h2> diff --git a/templates/repo/issue/new.tmpl b/templates/repo/issue/new.tmpl new file mode 100644 index 00000000..ccd45fde --- /dev/null +++ b/templates/repo/issue/new.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository new issue"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "repo/issue/new_form" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl new file mode 100644 index 00000000..465cb44f --- /dev/null +++ b/templates/repo/issue/new_form.tmpl @@ -0,0 +1,190 @@ +{{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"> + <div class="ui comments"> + <div class="comment"> + {{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"> + {{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}} + </div> + {{if .Fields}} + <input type="hidden" name="template-file" value="{{.TemplateFile}}"> + {{range .Fields}} + {{if eq .Type "input"}} + {{template "repo/issue/fields/input" dict "Context" $.Context "item" .}} + {{else if eq .Type "markdown"}} + {{template "repo/issue/fields/markdown" dict "Context" $.Context "item" .}} + {{else if eq .Type "textarea"}} + {{template "repo/issue/fields/textarea" dict "Context" $.Context "item" . "root" $}} + {{else if eq .Type "dropdown"}} + {{template "repo/issue/fields/dropdown" dict "Context" $.Context "item" .}} + {{else if eq .Type "checkboxes"}} + {{template "repo/issue/fields/checkboxes" dict "Context" $.Context "item" .}} + {{end}} + {{end}} + {{else}} + {{template "repo/issue/comment_tab" .}} + {{end}} + <div class="text right"> + <button class="ui primary button"> + {{if .PageIsComparePull}} + {{ctx.Locale.Tr "repo.pulls.create"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.create"}} + {{end}} + </button> + </div> + </div> + </div> + </div> + </div> + + <div class="issue-content-right ui segment"> + {{template "repo/issue/view_content/sidebar/branch_selector_field" .}} + + <input id="label_ids" name="label_ids" type="hidden" value="{{.label_ids}}"> + {{template "repo/issue/labels/labels_selector_field" .}} + {{template "repo/issue/labels/labels_sidebar" dict "root" $}} + + <div class="divider"></div> + + <input id="milestone_id" name="milestone_id" type="hidden" value="{{.milestone_id}}"> + <div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating jump select-milestone dropdown"> + <span class="text flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.milestone"}}</strong> + {{if .HasIssuesOrPullsWritePermission}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </span> + <div class="menu"> + {{template "repo/issue/milestone/select_menu" .}} + </div> + </div> + <div class="ui select-milestone list"> + <span class="no-select item {{if .Milestone}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_milestone"}}</span> + <div class="selected"> + {{if .Milestone}} + <a class="item muted sidebar-item-link" href="{{.RepoLink}}/issues?milestone={{.Milestone.ID}}"> + {{svg "octicon-milestone" 18 "tw-mr-2"}} + {{.Milestone.Name}} + </a> + {{end}} + </div> + </div> + + {{if .IsProjectsEnabled}} + <div class="divider"></div> + + <input id="project_id" name="project_id" type="hidden" value="{{.project_id}}"> + <div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating jump select-project dropdown"> + <span class="text flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.projects"}}</strong> + {{if .HasIssuesOrPullsWritePermission}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </span> + <div class="menu"> + {{if or .OpenProjects .ClosedProjects}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_projects"}}"> + </div> + {{end}} + <div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}</div> + {{if and (not .OpenProjects) (not .ClosedProjects)}} + <div class="disabled item"> + {{ctx.Locale.Tr "repo.issues.new.no_items"}} + </div> + {{else}} + {{if .OpenProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.open_projects"}} + </div> + {{range .OpenProjects}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link ctx}}"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </a> + {{end}} + {{end}} + {{if .ClosedProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.closed_projects"}} + </div> + {{range .ClosedProjects}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link ctx}}"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </a> + {{end}} + {{end}} + {{end}} + </div> + </div> + <div class="ui select-project list"> + <span class="no-select item {{if .Project}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_projects"}}</span> + <div class="selected"> + {{if .Project}} + <a class="item muted sidebar-item-link" href="{{.Project.Link ctx}}"> + {{svg .Project.IconName 18 "tw-mr-2"}}{{.Project.Title}} + </a> + {{end}} + </div> + </div> + {{end}} + <div class="divider"></div> + <input id="assignee_ids" name="assignee_ids" type="hidden" value="{{.assignee_ids}}"> + <div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating jump select-assignees dropdown"> + <span class="text flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong> + {{if .HasIssuesOrPullsWritePermission}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </span> + <div class="filter menu" data-id="#assignee_ids"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}"> + </div> + <div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div> + {{range .Assignees}} + <a class="item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}"> + <span class="octicon-check tw-invisible">{{svg "octicon-check"}}</span> + <span class="text"> + {{ctx.AvatarUtils.Avatar . 28 "tw-mr-2"}}{{template "repo/search_name" .}} + </span> + </a> + {{end}} + </div> + </div> + <div class="ui assignees list"> + <span class="no-select item {{if .HasSelectedLabel}}tw-hidden{{end}}"> + {{ctx.Locale.Tr "repo.issues.new.no_assignees"}} + </span> + <div class="selected"> + {{range .Assignees}} + <a class="item tw-p-1 muted tw-hidden" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "tw-mr-2 tw-align-middle"}}{{.GetDisplayName}} + </a> + {{end}} + </div> + </div> + {{if and .PageIsComparePull (not (eq .HeadRepo.FullName .BaseCompareRepo.FullName)) .CanWriteToHeadRepo}} + <div class="divider"></div> + <div class="inline field"> + <div class="ui checkbox"> + <label data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}"><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label> + <input name="allow_maintainer_edit" type="checkbox" {{if .AllowMaintainerEdit}}checked{{end}}> + </div> + </div> + {{end}} + </div> + <input type="hidden" name="redirect_after_creation" value="{{.redirect_after_creation}}"> +</form> diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl new file mode 100644 index 00000000..eb2d6e09 --- /dev/null +++ b/templates/repo/issue/openclose.tmpl @@ -0,0 +1,16 @@ +<div class="small-menu-items ui compact tiny menu"> + <a class="{{if eq .State "open"}}active {{end}}item" href="{{if eq .State "open"}}{{.AllStatesLink}}{{else}}{{.OpenLink}}{{end}}"> + {{if .PageIsMilestones}} + {{svg "octicon-milestone" 16 "tw-mr-2"}} + {{else if .PageIsPullList}} + {{svg "octicon-git-pull-request" 16 "tw-mr-2"}} + {{else}} + {{svg "octicon-issue-opened" 16 "tw-mr-2"}} + {{end}} + {{ctx.Locale.PrettyNumber .OpenCount}} {{ctx.Locale.Tr "repo.issues.open_title"}} + </a> + <a class="{{if eq .State "closed"}}active {{end}}item" href="{{if eq .State "closed"}}{{.AllStatesLink}}{{else}}{{.ClosedLink}}{{end}}"> + {{svg "octicon-check" 16 "tw-mr-2"}} + {{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 new file mode 100644 index 00000000..f1c0ea32 --- /dev/null +++ b/templates/repo/issue/search.tmpl @@ -0,0 +1,20 @@ +<form class="list-header-search ui form ignore-dirty issue-list-search"> + <div class="ui small search fluid action input"> + <input type="hidden" name="state" value="{{$.State}}"> + {{if not .PageIsMilestones}} + <input type="hidden" name="type" value="{{$.ViewType}}"> + <input type="hidden" name="labels" value="{{.SelectLabels}}"> + <input type="hidden" name="milestone" value="{{$.MilestoneID}}"> + <input type="hidden" name="project" value="{{$.ProjectID}}"> + <input type="hidden" name="assignee" value="{{$.AssigneeID}}"> + <input type="hidden" name="poster" value="{{$.PosterID}}"> + {{end}} + {{if .PageIsPullList}} + {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.pull_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} + {{else if .PageIsMilestones}} + {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.milestone_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} + {{else}} + {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.issue_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} + {{end}} + </div> +</form> diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl new file mode 100644 index 00000000..1ef9e735 --- /dev/null +++ b/templates/repo/issue/view.tmpl @@ -0,0 +1,12 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository view issue pull"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "repo/issue/view_title" .}} + {{if .Issue.IsPull}} + {{template "repo/pulls/tab_menu" .}} + {{end}} + {{template "repo/issue/view_content" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl new file mode 100644 index 00000000..543191e0 --- /dev/null +++ b/templates/repo/issue/view_content.tmpl @@ -0,0 +1,187 @@ +<div class="issue-content"> + <!-- I know, there is probably a better way to do this (moved from sidebar.tmpl, original author: 6543 @ 2021-02-28) --> + <!-- Agree, there should be a better way, eg: introduce window.config.pageData (original author: wxiaoguang @ 2021-09-05) --> + <input type="hidden" id="repolink" value="{{$.RepoRelPath}}"> + <input type="hidden" id="repoId" value="{{.Repository.ID}}"> + <input type="hidden" id="issueIndex" value="{{.Issue.Index}}"> + <input type="hidden" id="type" value="{{.IssueType}}"> + + {{$createdStr:= TimeSinceUnix .Issue.CreatedUnix ctx.Locale}} + <div class="issue-content-left comment-list prevent-before-timeline"> + <div class="ui timeline"> + <div id="{{.Issue.HashTag}}" class="timeline-item comment first"> + {{if .Issue.OriginalAuthor}} + <span class="timeline-avatar"> + {{ctx.AvatarUtils.Avatar nil 40}} + </span> + {{else}} + <a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}> + {{ctx.AvatarUtils.Avatar .Issue.Poster 40}} + </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-left tw-flex tw-items-center"> + {{if .Issue.OriginalAuthor}} + <span class="text black tw-font-semibold"> + {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}} + {{.Issue.OriginalAuthor}} + </span> + <span class="text grey muted-links"> + {{ctx.Locale.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr}} + </span> + <span class="text migrate"> + {{if .Repository.OriginalURL}} ({{ctx.Locale.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname}}){{end}} + </span> + {{else}} + <a class="inline-timeline-avatar" href="{{.Issue.Poster.HomeLink}}"> + {{ctx.AvatarUtils.Avatar .Issue.Poster 24}} + </a> + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Issue.Poster}} + {{ctx.Locale.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr}} + </span> + {{end}} + </div> + <div class="comment-header-right actions tw-flex tw-items-center"> + {{template "repo/issue/view_content/show_role" dict "ShowRole" .Issue.ShowRole "IgnorePoster" true "IsPull" .Issue.IsPull}} + {{if not $.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} + {{end}} + {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}} + </div> + </div> + <div class="ui attached segment comment-body" role="article"> + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}data-can-edit="true"{{end}}> + {{if .Issue.RenderedContent}} + {{.Issue.RenderedContent}} + {{else}} + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div id="issue-{{.Issue.ID}}-raw" class="raw-content tw-hidden">{{.Issue.Content}}</div> + <div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-content-version="{{.Issue.ContentVersion}}" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div> + {{if .Issue.Attachments}} + {{template "repo/issue/view_content/attachments" dict "Attachments" .Issue.Attachments "RenderedContent" .Issue.RenderedContent}} + {{end}} + </div> + {{$reactions := .Issue.Reactions.GroupByType}} + {{if $reactions}} + {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}} + {{end}} + </div> + </div> + + {{template "repo/issue/view_content/comments" .}} + + {{if and .Issue.IsPull (not $.Repository.IsArchived)}} + {{template "repo/issue/view_content/pull".}} + {{end}} + + {{if .IsSigned}} + {{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}} + <div class="timeline-item comment form"> + <a class="timeline-avatar" href="{{.SignedUser.HomeLink}}"> + {{ctx.AvatarUtils.Avatar .SignedUser 40}} + </a> + <div class="content"> + <form class="ui segment form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post"> + {{template "repo/issue/comment_tab" .}} + {{.CsrfTokenHtml}} + <div class="field footer"> + <div class="text right"> + {{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"> + {{ctx.Locale.Tr "repo.issues.reopen_issue"}} + </button> + {{else}} + {{$closeTranslationKey := "repo.issues.close"}} + {{if .Issue.IsPull}} + {{$closeTranslationKey = "repo.pulls.close"}} + {{end}} + <button id="status-button" class="ui red basic button" data-status="{{ctx.Locale.Tr $closeTranslationKey}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.close_comment_issue"}}" name="status" value="close"> + {{ctx.Locale.Tr $closeTranslationKey}} + </button> + {{end}} + {{end}} + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.issues.create_comment"}} + </button> + </div> + </div> + </form> + </div> + </div> + {{else if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} + {{else}} + {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} + {{end}} + </div> + {{end}} + {{else}} {{/* not .IsSigned */}} + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} + {{else}} + {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} + {{end}} + </div> + {{else}} + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.issues.sign_in_require_desc" .SignInLink}} + </div> + {{end}} + {{end}}{{/* end if: .IsSigned */}} + </div> + </div> + + {{template "repo/issue/view_content/sidebar" .}} +</div> + +<template id="issue-comment-editor-template"> + <div class="ui comment form"> + <div class="field"> + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewUrl" (print .Repository.Link "/markup") + "MarkdownPreviewContext" .RepoLink + "TextareaName" "content" + "DropzoneParentContainer" ".ui.form" + )}} + </div> + + {{if .IsAttachmentEnabled}} + <div class="field"> + {{template "repo/upload" .}} + </div> + {{end}} + + <div class="field"> + <div class="text right edit"> + <button class="ui basic cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> + <button class="ui primary save button">{{ctx.Locale.Tr "repo.issues.save"}}</button> + </div> + </div> + </div> +</template> + +{{template "repo/issue/view_content/reference_issue_dialog" .}} + +<div class="tw-hidden" id="no-content"> + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> +</div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.branch.delete_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> diff --git a/templates/repo/issue/view_content/add_reaction.tmpl b/templates/repo/issue/view_content/add_reaction.tmpl new file mode 100644 index 00000000..37931f28 --- /dev/null +++ b/templates/repo/issue/view_content/add_reaction.tmpl @@ -0,0 +1,12 @@ +{{if .ctxData.IsSigned}} +<div class="item action ui dropdown jump pointing top right select-reaction" data-action-url="{{.ActionURL}}"> + <a class="add-reaction muted"> + {{svg "octicon-smiley"}} + </a> + <div class="menu reactions-menu"> + {{range $value := AllowedReactions}} + <a class="item reaction" data-tooltip-content="{{$value}}" aria-label="{{$value}}" data-reaction-content="{{$value}}">{{ReactionToEmoji $value}}</a> + {{end}} + </div> +</div> +{{end}} diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl new file mode 100644 index 00000000..79085df3 --- /dev/null +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -0,0 +1,42 @@ +<div class="dropzone-attachments"> + {{if .Attachments}} + <div class="divider"></div> + {{end}} + {{$hasThumbnails := false}} + {{- range .Attachments -}} + <div class="tw-flex"> + <div class="tw-flex-1 tw-p-2"> + <a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}"> + {{if FilenameIsImage .Name}} + {{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}} + {{$hasThumbnails = true}} + {{end}} + {{svg "octicon-file"}} + {{else}} + {{svg "octicon-desktop-download"}} + {{end}} + <span><strong>{{.Name}}</strong></span> + </a> + </div> + <div class="tw-p-2 tw-flex tw-items-center"> + <span class="ui text grey">{{.Size | ctx.Locale.TrSize}}</span> + </div> + </div> + {{end -}} + + {{if $hasThumbnails}} + <div class="divider"></div> + <div class="ui small thumbnails"> + {{- range .Attachments -}} + {{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}}"> + </a> + {{end}} + {{end}} + {{end -}} + </div> + {{end}} + +</div> diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl new file mode 100644 index 00000000..6d14d726 --- /dev/null +++ b/templates/repo/issue/view_content/comments.tmpl @@ -0,0 +1,683 @@ +{{template "base/alert"}} +{{range .Issue.Comments}} + {{if call $.ShouldShowCommentType .Type}} + {{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} + + <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, + 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 8 = MILESTONE_CHANGE, + 9 = ASSIGNEES_CHANGE, 10 = TITLE_CHANGE, 11 = DELETE_BRANCH, 12 = START_TRACKING, + 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, + 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, + 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED, + 26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST, 28 = MERGE_PULL_REQUEST, + 29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED + 32 = DISMISSED_REVIEW, 33 = COMMENT_TYPE_CHANGE_ISSUE_REF, 34 = PR_SCHEDULE_TO_AUTO_MERGE, + 35 = CANCEL_SCHEDULED_AUTO_MERGE_PR, 36 = PIN_ISSUE, 37 = UNPIN_ISSUE --> + {{if eq .Type 0}} + <div class="timeline-item comment" id="{{.HashTag}}"> + {{if .OriginalAuthor}} + <span class="timeline-avatar"> + {{ctx.AvatarUtils.Avatar nil 40}} + </span> + {{else}} + <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> + {{ctx.AvatarUtils.Avatar .Poster 40}} + </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-left tw-flex tw-items-center"> + {{if .OriginalAuthor}} + <span class="text black tw-font-semibold tw-mr-1"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{.OriginalAuthor}} + </span> + <span class="text grey muted-links"> + {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}} {{if $.Repository.OriginalURL}} + </span> + <span class="text migrate"> + ({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}}){{end}} + </span> + {{else}} + {{if gt .Poster.ID 0}} + <a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}"> + {{ctx.AvatarUtils.Avatar .Poster 24}} + </a> + {{end}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}} + </span> + {{end}} + </div> + <div class="comment-header-right actions tw-flex tw-items-center"> + {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole "IsPull" .Issue.IsPull}} + {{if not $.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{end}} + {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + </div> + </div> + <div class="ui attached segment comment-body" role="article"> + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> + {{if .RenderedContent}} + {{.RenderedContent}} + {{else}} + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div> + <div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + {{if .Attachments}} + {{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}} + {{end}} + </div> + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + {{end}} + </div> + </div> + {{else if eq .Type 1}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge tw-bg-green tw-text-white">{{svg "octicon-dot-fill"}}</span> + {{if not .OriginalAuthor}} + {{template "shared/user/avatarlink" dict "user" .Poster}} + {{end}} + <span class="text grey muted-links"> + {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.pulls.reopened_at" .EventTag $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.reopened_at" .EventTag $createdStr}} + {{end}} + </span> + </div> + {{else if eq .Type 2}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge tw-bg-red tw-text-white">{{svg "octicon-circle-slash"}}</span> + {{if not .OriginalAuthor}} + {{template "shared/user/avatarlink" dict "user" .Poster}} + {{end}} + <span class="text grey muted-links"> + {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.pulls.closed_at" .EventTag $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.closed_at" .EventTag $createdStr}} + {{end}} + </span> + </div> + {{else if eq .Type 28}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge tw-bg-purple tw-text-white">{{svg "octicon-git-merge"}}</span> + {{if not .OriginalAuthor}} + {{template "shared/user/avatarlink" dict "user" .Poster}} + {{end}} + <span class="text grey muted-links"> + {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}} + {{if eq $.Issue.PullRequest.Status 3}} + {{ctx.Locale.Tr "repo.issues.comment_manually_pull_merged_at" (HTMLFormat `<a class="ui sha" href="%[1]s"><b>%[2]s</b></a>` $link (ShortSha $.Issue.PullRequest.MergedCommitID)) (HTMLFormat "<b>%[1]s</b>" $.BaseTarget) $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.comment_pull_merged_at" (HTMLFormat `<a class="ui sha" href="%[1]s"><b>%[2]s</b></a>` $link (ShortSha $.Issue.PullRequest.MergedCommitID)) (HTMLFormat "<b>%[1]s</b>" $.BaseTarget) $createdStr}} + {{end}} + </span> + </div> + {{else if eq .Type 3 5 6}} + {{$refFrom:= ""}} + {{if ne .RefRepoID .Issue.RepoID}} + {{$refFrom = ctx.Locale.Tr "repo.issues.ref_from" .RefRepo.FullName}} + {{end}} + {{$refTr := "repo.issues.ref_issue_from"}} + {{if .Issue.IsPull}} + {{$refTr = "repo.issues.ref_pull_from"}} + {{else if eq .RefAction 1}} + {{$refTr = "repo.issues.ref_closing_from"}} + {{else if eq .RefAction 2}} + {{$refTr = "repo.issues.ref_reopening_from"}} + {{end}} + {{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-bookmark"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + {{if eq .RefAction 3}}<del>{{end}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr $refTr .EventTag $createdStr (.RefCommentLink ctx) $refFrom}} + </span> + {{if eq .RefAction 3}}</del>{{end}} + + <div class="detail flex-text-block"> + <span class="text grey muted-links"><a href="{{.RefIssueLink ctx}}"><b>{{.RefIssueTitle ctx}}</b> {{.RefIssueIdent ctx}}</a></span> + </div> + </div> + {{else if eq .Type 4}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-bookmark"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.pulls.commit_ref_at" .EventTag $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr}} + {{end}} + </span> + <div class="detail flex-text-block"> + {{svg "octicon-git-commit"}} + <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}}"> + <span class="badge">{{svg "octicon-tag"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{if and .AddedLabels (not .RemovedLabels)}} + {{ctx.Locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels $.Context ctx.Locale .AddedLabels $.RepoLink .Issue.IsPull) $createdStr}} + {{else if and (not .AddedLabels) .RemovedLabels}} + {{ctx.Locale.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels $.Context ctx.Locale .RemovedLabels $.RepoLink .Issue.IsPull) $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.add_remove_labels" (RenderLabels $.Context ctx.Locale .AddedLabels $.RepoLink .Issue.IsPull) (RenderLabels $.Context ctx.Locale .RemovedLabels $.RepoLink .Issue.IsPull) $createdStr}} + {{end}} + </span> + </div> + {{end}} + {{else if eq .Type 8}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-milestone"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.change_milestone_at" .OldMilestone.Name .Milestone.Name $createdStr}}{{else}}{{ctx.Locale.Tr "repo.issues.remove_milestone_at" .OldMilestone.Name $createdStr}}{{end}}{{else if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.add_milestone_at" .Milestone.Name $createdStr}}{{end}} + </span> + </div> + {{else if and (eq .Type 9) (gt .AssigneeID 0)}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-person"}}</span> + {{if .RemovedAssignee}} + {{template "shared/user/avatarlink" dict "user" .Assignee}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Assignee}} + {{if eq .Poster.ID .Assignee.ID}} + {{ctx.Locale.Tr "repo.issues.remove_self_assignment" $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.remove_assignee_at" .Poster.GetDisplayName $createdStr}} + {{end}} + </span> + {{else}} + {{template "shared/user/avatarlink" dict "user" .Assignee}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Assignee}} + {{if eq .Poster.ID .AssigneeID}} + {{ctx.Locale.Tr "repo.issues.self_assign_at" $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.add_assignee_at" .Poster.GetDisplayName $createdStr}} + {{end}} + </span> + {{end}} + </div> + {{else if eq .Type 10}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-pencil"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji $.Context) (.NewTitle|RenderEmoji $.Context) $createdStr}} + </span> + </div> + {{else if eq .Type 11}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-git-branch"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.delete_branch_at" .OldRef $createdStr}} + </span> + </div> + {{else if eq .Type 12}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.start_tracking_history" $createdStr}} + </span> + </div> + {{else if eq .Type 13}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.stop_tracking_history" $createdStr}} + </span> + {{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}} + <div class="detail flex-text-block"> + {{svg "octicon-clock"}} + {{if .RenderedContent}} + {{/* 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> + {{end}} + </div> + </div> + {{else if eq .Type 14}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.add_time_history" $createdStr}} + </span> + {{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}} + <div class="detail flex-text-block"> + {{svg "octicon-clock"}} + {{if .RenderedContent}} + {{/* 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> + {{end}} + </div> + </div> + {{else if eq .Type 15}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.cancel_tracking_history" $createdStr}} + </span> + </div> + {{else if eq .Type 16}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.due_date_added" (DateTime "long" .Content) $createdStr}} + </span> + </div> + {{else if eq .Type 17}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{$parsedDeadline := StringUtils.Split .Content "|"}} + {{if eq (len $parsedDeadline) 2}} + {{$from := DateTime "long" (index $parsedDeadline 1)}} + {{$to := DateTime "long" (index $parsedDeadline 0)}} + {{ctx.Locale.Tr "repo.issues.due_date_modified" $to $from $createdStr}} + {{end}} + </span> + </div> + {{else if eq .Type 18}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.due_date_remove" (DateTime "long" .Content) $createdStr}} + </span> + </div> + {{else if eq .Type 19}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-package-dependents"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.dependency.added_dependency" $createdStr}} + </span> + {{if .DependentIssue}} + <div class="detail flex-text-block"> + {{svg "octicon-plus"}} + <span class="text grey muted-links"> + <a href="{{.DependentIssue.Link}}"> + {{if eq .DependentIssue.RepoID .Issue.RepoID}} + #{{.DependentIssue.Index}} {{.DependentIssue.Title}} + {{else}} + {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} + {{end}} + </a> + </span> + </div> + {{end}} + </div> + {{else if eq .Type 20}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-package-dependents"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.dependency.removed_dependency" $createdStr}} + </span> + {{if .DependentIssue}} + <div class="detail flex-text-block"> + {{svg "octicon-trash"}} + <span class="text grey muted-links"> + <a href="{{.DependentIssue.Link}}"> + {{if eq .DependentIssue.RepoID .Issue.RepoID}} + #{{.DependentIssue.Index}} {{.DependentIssue.Title}} + {{else}} + {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} + {{end}} + </a> + </span> + </div> + {{end}} + </div> + {{else if eq .Type 22}} + <div class="timeline-item-group" id="{{.HashTag}}"> + <div class="timeline-item event"> + {{if not .OriginalAuthor}} + {{/* Some timeline avatars need a offset to correctly align with their speech bubble. + The condition depends on whether the comment has contents/attachments or reviews */}} + <a class="timeline-avatar{{if or .Content .Attachments (and .Review .Review.CodeComments)}} timeline-avatar-offset{{end}}"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> + {{ctx.AvatarUtils.Avatar .Poster 40}} + </a> + {{end}} + <span class="badge{{if eq .Review.Type 1}} tw-bg-green tw-text-white{{else if eq .Review.Type 3}} tw-bg-red tw-text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span> + <span class="text grey muted-links"> + {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{if eq .Review.Type 1}} + {{ctx.Locale.Tr "repo.issues.review.approve" $createdStr}} + {{else if eq .Review.Type 2}} + {{ctx.Locale.Tr "repo.issues.review.comment" $createdStr}} + {{else if eq .Review.Type 3}} + {{ctx.Locale.Tr "repo.issues.review.reject" $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.comment" $createdStr}} + {{end}} + {{if .Review.Dismissed}} + <div class="ui small label">{{ctx.Locale.Tr "repo.issues.review.dismissed_label"}}</div> + {{end}} + </span> + </div> + {{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-left tw-flex tw-items-center"> + {{if gt .Poster.ID 0}} + <a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}"> + {{ctx.AvatarUtils.Avatar .Poster 24}} + </a> + {{end}} + <span class="text grey muted-links"> + {{if .OriginalAuthor}} + <span class="text black tw-font-semibold"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{.OriginalAuthor}} + </span> + <span class="text grey muted-links"> {{if $.Repository.OriginalURL}}</span> + <span class="text migrate">({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}}){{end}}</span> + {{else}} + {{template "shared/user/authorlink" .Poster}} + {{end}} + + {{ctx.Locale.Tr "repo.issues.review.left_comment"}} + </span> + </div> + <div class="comment-header-right actions tw-flex tw-items-center"> + {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole "IsPull" .Issue.IsPull}} + {{if not $.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{end}} + </div> + </div> + <div class="ui attached segment comment-body"> + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> + {{if .RenderedContent}} + {{.RenderedContent}} + {{else}} + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div> + <div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + {{if .Attachments}} + {{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}} + {{end}} + </div> + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + {{end}} + </div> + </div> + {{end}} + + {{if .Review.CodeComments}} + <div class="timeline-item event"> + {{range $filename, $lines := .Review.CodeComments}} + {{range $line, $comms := $lines}} + {{template "repo/issue/view_content/conversation" dict "." $ "comments" $comms}} + {{end}} + {{end}} + </div> + {{end}} + </div> + {{else if eq .Type 23}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-lock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + {{if .Content}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.lock_with_reason" .Content $createdStr}} + </span> + {{else}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.lock_no_reason" $createdStr}} + </span> + {{end}} + </div> + {{else if eq .Type 24}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-key"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{ctx.Locale.Tr "repo.issues.unlock_comment" $createdStr}} + </span> + </div> + {{else if eq .Type 25}} + <div class="timeline-item event"> + <span class="badge">{{svg "octicon-git-branch"}}</span> + {{if not .OriginalAuthor}} + {{template "shared/user/avatarlink" dict "user" .Poster}} + {{end}} + <span class="text grey muted-links"> + {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{ctx.Locale.Tr "repo.pulls.change_target_branch_at" .OldRef .NewRef $createdStr}} + </span> + </div> + {{else if eq .Type 26}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + + {{ctx.Locale.Tr "repo.issues.del_time_history" $createdStr}} + </span> + <div class="detail flex-text-block"> + {{svg "octicon-clock"}} + {{if .RenderedContent}} + {{/* 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> + {{end}} + </div> + </div> + {{else if eq .Type 27}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-eye"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{if (gt .AssigneeID 0)}} + {{if .RemovedAssignee}} + {{if eq .PosterID .AssigneeID}} + {{ctx.Locale.Tr "repo.issues.review.remove_review_request_self" $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.remove_review_request" .Assignee.GetDisplayName $createdStr}} + {{end}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.add_review_request" .Assignee.GetDisplayName $createdStr}} + {{end}} + {{else}} + <!-- If the assigned team is deleted, just displaying "Ghost Team" in the comment --> + {{$teamName := "Ghost Team"}} + {{if .AssigneeTeam}} + {{$teamName = .AssigneeTeam.Name}} + {{end}} + {{if .RemovedAssignee}} + {{ctx.Locale.Tr "repo.issues.review.remove_review_request" $teamName $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.add_review_request" $teamName $createdStr}} + {{end}} + {{end}} + </span> + </div> + {{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}} + <!-- If PR is closed, the comments whose type is CommentTypePullRequestPush(29) after latestCloseCommentID won't be rendered. //--> + {{if and .Issue.IsClosed (gt .ID $.LatestCloseCommentID)}} + {{continue}} + {{end}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-repo-push"}}</span> + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{if .IsForcePush}} + {{ctx.Locale.Tr "repo.issues.force_push_codes" $.Issue.PullRequest.HeadBranch (ShortSha .OldCommit) ($.Issue.Repo.CommitLink .OldCommit) (ShortSha .NewCommit) ($.Issue.Repo.CommitLink .NewCommit) $createdStr}} + {{else}} + {{ctx.Locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr}} + {{end}} + </span> + {{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}} + <span class="tw-float-right comparebox"> + <a href="{{$.Issue.PullRequest.BaseRepo.Link}}/compare/{{PathEscape .OldCommit}}..{{PathEscape .NewCommit}}" rel="nofollow" class="ui compare label">{{ctx.Locale.Tr "repo.issues.force_push_compare"}}</a> + </span> + {{end}} + </div> + {{if not .IsForcePush}} + {{template "repo/commits_list_small" dict "comment" . "root" $}} + {{end}} + {{else if eq .Type 30}} + {{if not $.UnitProjectsGlobalDisabled}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-project"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{$oldProjectDisplayHtml := "Unknown Project"}} + {{if .OldProject}} + {{$trKey := printf "projects.type-%d.display_name" .OldProject.Type}} + {{$oldProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr $trKey) .OldProject.Title}} + {{end}} + {{$newProjectDisplayHtml := "Unknown Project"}} + {{if .Project}} + {{$trKey := printf "projects.type-%d.display_name" .Project.Type}} + {{$newProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr $trKey) .Project.Title}} + {{end}} + {{if and (gt .OldProjectID 0) (gt .ProjectID 0)}} + {{ctx.Locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr}} + {{else if gt .OldProjectID 0}} + {{ctx.Locale.Tr "repo.issues.remove_project_at" $oldProjectDisplayHtml $createdStr}} + {{else if gt .ProjectID 0}} + {{ctx.Locale.Tr "repo.issues.add_project_at" $newProjectDisplayHtml $createdStr}} + {{end}} + </span> + </div> + {{end}} + {{else if eq .Type 32}} + <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 $.Context}}" width="40" height="40"> + </a> + <span class="badge grey">{{svg "octicon-x" 16}}</span> + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{$reviewerName := ""}} + {{if eq .Review.OriginalAuthor ""}} + {{$reviewerName = .Review.Reviewer.Name}} + {{else}} + {{$reviewerName = .Review.OriginalAuthor}} + {{end}} + <span class="dismissed-message">{{ctx.Locale.Tr "repo.issues.review.dismissed" $reviewerName $createdStr}}</span> + </span> + </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"> + {{if gt .Poster.ID 0}} + <a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}"> + {{ctx.AvatarUtils.Avatar .Poster 24}} + </a> + {{end}} + <span class="text grey muted-links"> + {{ctx.Locale.Tr "action.review_dismissed_reason"}} + </span> + </div> + <div class="ui attached segment"> + <div class="render-content markup"> + {{if .RenderedContent}} + {{.RenderedContent}} + {{else}} + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + </div> + </div> + </div> + {{end}} + </div> + {{else if eq .Type 33}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-git-branch"}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{if and .OldRef .NewRef}} + {{ctx.Locale.Tr "repo.issues.change_ref_at" .OldRef .NewRef $createdStr}} + {{else if .OldRef}} + {{ctx.Locale.Tr "repo.issues.remove_ref_at" .OldRef $createdStr}} + {{else}} + {{ctx.Locale.Tr "repo.issues.add_ref_at" .NewRef $createdStr}} + {{end}} + </span> + </div> + {{else if or (eq .Type 34) (eq .Type 35)}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-git-merge" 16}}</span> + <span class="text grey muted-links"> + {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{if eq .Type 34}}{{ctx.Locale.Tr "repo.pulls.auto_merge_newly_scheduled_comment" $createdStr}} + {{else}}{{ctx.Locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr}}{{end}} + </span> + </div> + {{else if or (eq .Type 36) (eq .Type 37)}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-pin" 16}}</span> + {{template "shared/user/avatarlink" dict "user" .Poster}} + <span class="text grey muted-links"> + {{template "shared/user/authorlink" .Poster}} + {{if eq .Type 36}}{{ctx.Locale.Tr "repo.issues.pin_comment" $createdStr}} + {{else}}{{ctx.Locale.Tr "repo.issues.unpin_comment" $createdStr}}{{end}} + </span> + </div> + {{end}} + {{end}} +{{end}} diff --git a/templates/repo/issue/view_content/comments_authorlink.tmpl b/templates/repo/issue/view_content/comments_authorlink.tmpl new file mode 100644 index 00000000..f652a0be --- /dev/null +++ b/templates/repo/issue/view_content/comments_authorlink.tmpl @@ -0,0 +1,11 @@ +{{if .comment.OriginalAuthor}} + <span class="text black"> + {{svg (MigrationIcon .ctxData.Repository.GetOriginalURLHostname)}} + {{.comment.OriginalAuthor}} + </span> + {{if .ctxData.Repository.OriginalURL}} + <span class="migrate">({{ctx.Locale.Tr "repo.migrated_from" .ctxData.Repository.OriginalURL .ctxData.Repository.GetOriginalURLHostname}})</span> + {{end}} +{{else}} + {{template "shared/user/authorlink" .comment.Poster}} +{{end}} diff --git a/templates/repo/issue/view_content/comments_delete_time.tmpl b/templates/repo/issue/view_content/comments_delete_time.tmpl new file mode 100644 index 00000000..2377e7c4 --- /dev/null +++ b/templates/repo/issue/view_content/comments_delete_time.tmpl @@ -0,0 +1,18 @@ +{{if and .comment.Time (.ctxData.Repository.IsTimetrackerEnabled ctx)}} {{/* compatibility with time comments made before v1.14 */}} + {{if (not .comment.Time.Deleted)}} + {{if (or .ctxData.IsAdmin (and .ctxData.IsSigned (eq .ctxData.SignedUserID .comment.PosterID)))}} + <span class="tw-float-right"> + <div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}"> + <form method="post" class="delete-time-form" action="{{.ctxData.RepoLink}}/issues/{{.ctxData.Issue.Index}}/times/{{.comment.TimeID}}/delete"> + {{.ctxData.CsrfTokenHtml}} + </form> + <div class="header">{{ctx.Locale.Tr "repo.issues.del_time"}}</div> + {{template "base/modal_actions_confirm"}} + </div> + <button class="ui icon button compact mini issue-delete-time" data-id="{{.comment.Time.ID}}" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.del_time"}}"> + {{svg "octicon-trash"}} + </button> + </span> + {{end}} + {{end}} +{{end}} diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl new file mode 100644 index 00000000..4afd73c3 --- /dev/null +++ b/templates/repo/issue/view_content/context_menu.tmpl @@ -0,0 +1,27 @@ +<div class="item action ui dropdown jump pointing top right context-dropdown"> + <a class="context-menu muted"> + {{svg "octicon-kebab-horizontal"}} + </a> + <div class="menu"> + {{$referenceUrl := ""}} + {{if .issue}} + {{$referenceUrl = printf "%s#%s" .ctxData.Issue.Link .item.HashTag}} + {{else}} + {{$referenceUrl = printf "%s/files#%s" .ctxData.Issue.Link .item.HashTag}} + {{end}} + <div class="item context js-aria-clickable" data-clipboard-text-type="url" data-clipboard-text="{{$referenceUrl}}">{{ctx.Locale.Tr "repo.issues.context.copy_link"}}</div> + {{if and .ctxData.IsSigned (not .ctxData.Repository.IsArchived)}} + <div class="item context js-aria-clickable quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.HashTag}}-raw">{{ctx.Locale.Tr "repo.issues.context.quote_reply"}}</div> + {{if not .ctxData.UnitIssuesGlobalDisabled}} + <div class="item context js-aria-clickable reference-issue" data-target="{{.item.HashTag}}-raw" data-modal="#reference-issue-modal" data-poster="{{.item.Poster.GetDisplayName}}" data-poster-username="{{.item.Poster.Name}}" data-reference="{{$referenceUrl}}">{{ctx.Locale.Tr "repo.issues.context.reference_issue"}}</div> + {{end}} + {{if or .ctxData.Permission.IsAdmin .IsCommentPoster .ctxData.HasIssuesOrPullsWritePermission}} + <div class="divider"></div> + <div class="item context js-aria-clickable edit-content">{{ctx.Locale.Tr "repo.issues.context.edit"}}</div> + {{if .delete}} + <div class="item context js-aria-clickable delete-comment" data-comment-id={{.item.HashTag}} data-url="{{.ctxData.RepoLink}}/comments/{{.item.ID}}/delete" data-locale="{{ctx.Locale.Tr "repo.issues.delete_comment_confirm"}}">{{ctx.Locale.Tr "repo.issues.context.delete"}}</div> + {{end}} + {{end}} + {{end}} + </div> +</div> diff --git a/templates/repo/issue/view_content/conversation.tmpl b/templates/repo/issue/view_content/conversation.tmpl new file mode 100644 index 00000000..c788a611 --- /dev/null +++ b/templates/repo/issue/view_content/conversation.tmpl @@ -0,0 +1,137 @@ +{{$invalid := (index .comments 0).Invalidated}} +{{$resolved := (index .comments 0).IsResolved}} +{{$resolveDoer := (index .comments 0).ResolveDoer}} +{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}} +<div class="ui segments conversation-holder"> + <div class="ui segment collapsible-comment-box tw-py-2 tw-flex tw-items-center tw-justify-between"> + <div class="tw-flex tw-items-center"> + <a href="{{(index .comments 0).CodeCommentLink ctx}}" class="file-comment tw-ml-2 tw-break-anywhere">{{(index .comments 0).TreePath}}</a> + {{if $invalid}} + <span class="ui label basic small tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> + {{ctx.Locale.Tr "repo.issues.review.outdated"}} + </span> + {{end}} + </div> + <div> + {{if or $invalid $resolved}} + <button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if not $resolved}}tw-hidden {{end}}ui compact labeled button show-outdated tw-flex tw-items-center"> + {{svg "octicon-unfold" 16 "tw-mr-2"}} + {{if $resolved}} + {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.show_outdated"}} + {{end}} + </button> + <button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if $resolved}}tw-hidden {{end}}ui compact labeled button hide-outdated tw-flex tw-items-center"> + {{svg "octicon-fold" 16 "tw-mr-2"}} + {{if $resolved}} + {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.hide_outdated"}} + {{end}} + </button> + {{end}} + </div> + </div> + {{$diff := (CommentMustAsDiff ctx (index .comments 0))}} + {{if $diff}} + {{$file := (index $diff.Files 0)}} + <div id="code-preview-{{(index .comments 0).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="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> + <table> + <tbody> + {{template "repo/diff/section_unified" dict "file" $file "root" $}} + </tbody> + </table> + </div> + </div> + </div> + {{end}} + <div id="code-comments-{{(index .comments 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} tw-hidden{{end}}"> + <div class="ui comments tw-mb-0"> + {{range .comments}} + {{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} + <div class="comment code-comment tw-pb-4" id="{{.HashTag}}"> + <div class="content"> + <div class="header comment-header"> + <div class="comment-header-left tw-flex tw-items-center"> + {{if not .OriginalAuthor}} + <a class="avatar"> + {{ctx.AvatarUtils.Avatar .Poster 20}} + </a> + {{end}} + <span class="text grey muted-links"> + {{if .OriginalAuthor}} + <span class="text black"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{.OriginalAuthor}} + </span> + {{if $.Repository.OriginalURL}} + <span class="migrate">({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}})</span> + {{end}} + {{else}} + {{template "shared/user/authorlink" .Poster}} + {{end}} + {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdSubStr}} + </span> + </div> + <div class="comment-header-right actions tw-flex tw-items-center"> + {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole "IsPull" $.Issue.IsPull}} + {{if not $.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{end}} + </div> + </div> + <div class="text comment-content"> + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> + {{if .RenderedContent}} + {{.RenderedContent}} + {{else}} + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div> + <div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + {{if .Attachments}} + {{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}} + {{end}} + </div> + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + {{end}} + </div> + </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="tw-flex-1"> + {{if $resolved}} + <div class="ui grey text"> + {{svg "octicon-check" 16 "tw-mr-1"}} + <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} + </div> + {{end}} + </div> + <div class="code-comment-buttons-buttons button-row"> + {{if and $.CanMarkConversation $isNotPending}} + <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index .comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> + {{if $resolved}} + {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.review.resolve_conversation"}} + {{end}} + </button> + {{end}} + {{if and $.SignedUserID (not $.Repository.IsArchived)}} + <button class="comment-form-reply ui primary tiny labeled icon button"> + {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} + </button> + {{end}} + </div> + </div> + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index .comments 0).ReviewID "root" $ "comment" (index .comments 0)}} + </div> +</div> diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl new file mode 100644 index 00000000..2672bd33 --- /dev/null +++ b/templates/repo/issue/view_content/pull.tmpl @@ -0,0 +1,396 @@ +{{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-avatar text {{if .Issue.PullRequest.HasMerged}}purple + {{- else if .Issue.IsClosed}}grey + {{- else if .IsPullWorkInProgress}}grey + {{- else if .IsFilesConflicted}}grey + {{- else if .IsPullRequestBroken}}red + {{- else if .IsBlockedByApprovals}}red + {{- else if .IsBlockedByRejection}}red + {{- else if .IsBlockedByOfficialReviewRequests}}red + {{- else if .IsBlockedByOutdatedBranch}}red + {{- else if .IsBlockedByChangedProtectedFiles}}red + {{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red + {{- else if and .EnableStatusCheck (or (not $.LatestCommitStatus) .RequiredStatusCheckState.IsPending .RequiredStatusCheckState.IsWarning)}}yellow + {{- else if and .AllowMerge .RequireSigned (not .WillSign)}}red + {{- else if .Issue.PullRequest.IsChecking}}yellow + {{- else if .Issue.PullRequest.IsEmpty}}grey + {{- else if .Issue.PullRequest.CanAutoMerge}}green + {{- else}}red{{end}}">{{svg "octicon-git-merge" 40}}</div> + <div class="content"> + {{if .LatestCommitStatus}} + <div class="ui attached segment fitted"> + {{template "repo/pulls/status" (dict + "CommitStatus" .LatestCommitStatus + "CommitStatuses" .LatestCommitStatuses + "MissingRequiredChecks" .MissingRequiredChecks + "ShowHideChecks" true + "is_context_required" .is_context_required + )}} + </div> + {{end}} + {{$showGeneralMergeForm := false}} + <div class="ui attached segment merge-section {{if not $.LatestCommitStatus}}no-header{{end}} flex-items-block"> + {{if .Issue.PullRequest.HasMerged}} + {{if .IsPullBranchDeletable}} + <div class="item item-section text tw-flex-1"> + <div class="item-section-left"> + <h3 class="tw-mb-2"> + {{ctx.Locale.Tr "repo.pulls.merged_success"}} + </h3> + <div class="merge-section-info"> + {{ctx.Locale.Tr "repo.pulls.merged_info_text" (HTMLFormat "<code>%s</code>" .HeadTarget)}} + </div> + </div> + <div class="item-section-right"> + <button class="delete-button ui button" data-url="{{.DeleteBranchLink}}">{{ctx.Locale.Tr "repo.branch.delete_html"}}</button> + </div> + </div> + {{end}} + {{else if .Issue.IsClosed}} + <div class="item item-section text tw-flex-1"> + <div class="item-section-left"> + <h3 class="tw-mb-2">{{ctx.Locale.Tr "repo.pulls.closed"}}</h3> + <div class="merge-section-info"> + {{if .IsPullRequestBroken}} + {{ctx.Locale.Tr "repo.pulls.cant_reopen_deleted_branch"}} + {{else}} + {{ctx.Locale.Tr "repo.pulls.reopen_to_merge"}} + {{end}} + </div> + </div> + {{if and .IsPullBranchDeletable (not .IsPullRequestBroken)}} + <div class="item-section-right"> + <button class="delete-button ui button" data-url="{{.DeleteBranchLink}}">{{ctx.Locale.Tr "repo.branch.delete_html"}}</button> + </div> + {{end}} + </div> + {{else if .IsPullFilesConflicted}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.files_conflicted"}} + </div> + <ul> + {{range .ConflictedFiles}} + <li>{{.}}</li> + {{end}} + </ul> + {{else if .IsPullRequestBroken}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.data_broken"}} + </div> + {{else if .IsPullWorkInProgress}} + <div class="item toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}" data-update-url="{{.Issue.Link}}/title"> + <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"> + {{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}} + </button> + {{end}} + </div> + {{template "repo/issue/view_content/update_branch_by_merge" $}} + {{else if .Issue.PullRequest.IsChecking}} + <div class="item"> + {{svg "octicon-sync"}} + {{ctx.Locale.Tr "repo.pulls.is_checking"}} + </div> + {{else if .Issue.PullRequest.IsAncestor}} + <div class="item"> + {{svg "octicon-alert"}} + {{ctx.Locale.Tr "repo.pulls.is_ancestor"}} + </div> + {{else if or .Issue.PullRequest.CanAutoMerge .Issue.PullRequest.IsEmpty}} + {{if .IsBlockedByApprovals}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}} + </div> + {{else if .IsBlockedByRejection}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_rejection"}} + </div> + {{else if .IsBlockedByOfficialReviewRequests}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_official_review_requests"}} + </div> + {{else if .IsBlockedByOutdatedBranch}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_outdated_branch"}} + </div> + {{else if .IsBlockedByChangedProtectedFiles}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n"}} + </div> + <ul> + {{range .ChangedProtectedFiles}} + <li>{{.}}</li> + {{end}} + </ul> + {{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsError .RequiredStatusCheckState.IsFailure)}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.required_status_check_failed"}} + </div> + {{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.required_status_check_missing"}} + </div> + {{else if and .AllowMerge .RequireSigned (not .WillSign)}} + <div class="item"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.require_signed_wont_sign"}} + </div> + <div class="item"> + {{svg "octicon-unlock"}} + {{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}} + </div> + {{end}} + + {{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} + + {{/* admin can merge without checks, writer can merge when checks succeed */}} + {{$canMergeNow := and (or (and $.IsRepoAdmin (not .ProtectedBranch.ApplyToAdmins)) (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}} + {{/* admin and writer both can make an auto merge schedule */}} + + {{if $canMergeNow}} + {{if $notAllOverridableChecksOk}} + <div class="item"> + {{svg "octicon-dot-fill"}} + {{ctx.Locale.Tr "repo.pulls.required_status_check_administrator"}} + </div> + {{else}} + <div class="item"> + {{svg "octicon-check"}} + {{ctx.Locale.Tr "repo.pulls.can_auto_merge_desc"}} + </div> + {{end}} + {{if .WillSign}} + <div class="item"> + {{svg "octicon-lock" 16 "text green"}} + {{ctx.Locale.Tr "repo.signing.will_sign" .SigningKey}} + </div> + {{else if .IsSigned}} + <div class="item"> + {{svg "octicon-unlock"}} + {{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}} + </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"}} + </div> + {{end}} + + {{if .AllowMerge}} {{/* user is allowed to merge */}} + {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}} + {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash $prUnit.PullRequestsConfig.AllowFastForwardOnly}} + {{$hasPendingPullRequestMergeTip := ""}} + {{if .HasPendingPullRequestMerge}} + {{$createdPRMergeStr := TimeSinceUnix .PendingPullRequestMerge.CreatedUnix ctx.Locale}} + {{$hasPendingPullRequestMergeTip = ctx.Locale.Tr "repo.pulls.auto_merge_has_pending_schedule" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr}} + {{end}} + <div class="divider"></div> + <script type="module"> + const defaultMergeTitle = {{.DefaultMergeMessage}}; + const defaultSquashMergeTitle = {{.DefaultSquashMergeMessage}}; + const defaultMergeMessage = {{.DefaultMergeBody}}; + const defaultSquashMergeMessage = {{.DefaultSquashMergeBody}}; + const mergeForm = { + 'baseLink': {{.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"}}, + 'textAutoMergeWhenSucceed': {{ctx.Locale.Tr "repo.pulls.auto_merge_when_succeed"}}, + 'textAutoMergeCancelSchedule': {{ctx.Locale.Tr "repo.pulls.auto_merge_cancel_schedule"}}, + 'textClearMergeMessage': {{ctx.Locale.Tr "repo.pulls.clear_merge_message"}}, + 'textClearMergeMessageHint': {{ctx.Locale.Tr "repo.pulls.clear_merge_message_hint"}}, + 'textMergeCommitId': {{ctx.Locale.Tr "repo.pulls.merge_commit_id"}}, + + 'canMergeNow': {{$canMergeNow}}, + 'allOverridableChecksOk': {{not $notAllOverridableChecksOk}}, + 'emptyCommit': {{.Issue.PullRequest.IsEmpty}}, + 'pullHeadCommitID': {{.PullHeadCommitID}}, + 'isPullBranchDeletable': {{.IsPullBranchDeletable}}, + 'defaultMergeStyle': {{.MergeStyle}}, + 'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}}, + 'mergeMessageFieldPlaceHolder': {{ctx.Locale.Tr "repo.editor.commit_message_desc"}}, + 'defaultMergeMessage': defaultMergeMessage, + + 'hasPendingPullRequestMerge': {{.HasPendingPullRequestMerge}}, + 'hasPendingPullRequestMergeTip': {{$hasPendingPullRequestMergeTip}}, + }; + + const generalHideAutoMerge = mergeForm.canMergeNow && mergeForm.allOverridableChecksOk; // if this pr can be merged now, then hide the auto merge + mergeForm['mergeStyles'] = [ + { + 'name': 'merge', + 'allowed': {{$prUnit.PullRequestsConfig.AllowMerge}}, + 'textDoMerge': {{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}, + 'mergeTitleFieldText': defaultMergeTitle, + 'mergeMessageFieldText': defaultMergeMessage, + 'hideAutoMerge': generalHideAutoMerge, + }, + { + 'name': 'rebase', + 'allowed': {{$prUnit.PullRequestsConfig.AllowRebase}}, + 'textDoMerge': {{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}, + 'hideMergeMessageTexts': true, + 'hideAutoMerge': generalHideAutoMerge, + }, + { + 'name': 'rebase-merge', + 'allowed': {{$prUnit.PullRequestsConfig.AllowRebaseMerge}}, + 'textDoMerge': {{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}, + 'mergeTitleFieldText': defaultMergeTitle, + 'mergeMessageFieldText': defaultMergeMessage, + 'hideAutoMerge': generalHideAutoMerge, + }, + { + 'name': 'squash', + 'allowed': {{$prUnit.PullRequestsConfig.AllowSquash}}, + 'textDoMerge': {{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}, + 'mergeTitleFieldText': defaultSquashMergeTitle, + 'mergeMessageFieldText': {{.GetCommitMessages}} + defaultSquashMergeMessage, + 'hideAutoMerge': generalHideAutoMerge, + }, + { + 'name': 'fast-forward-only', + 'allowed': {{and $prUnit.PullRequestsConfig.AllowFastForwardOnly (eq .Issue.PullRequest.CommitsBehind 0)}}, + 'textDoMerge': {{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}, + 'hideMergeMessageTexts': true, + 'hideAutoMerge': generalHideAutoMerge, + }, + { + 'name': 'manually-merged', + 'allowed': {{$prUnit.PullRequestsConfig.AllowManualMerge}}, + 'textDoMerge': {{ctx.Locale.Tr "repo.pulls.merge_manually"}}, + 'hideMergeMessageTexts': true, + 'hideAutoMerge': true, + } + ]; + window.config.pageData.pullRequestMergeForm = mergeForm; + </script> + + {{$showGeneralMergeForm = true}} + <div id="pull-request-merge-form"></div> + {{else}} + {{/* no merge style was set in repo setting: not or ($prUnit.PullRequestsConfig.AllowMerge ...) */}} + <div class="divider"></div> + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.no_merge_desc"}} + </div> + <div class="item"> + {{svg "octicon-info"}} + {{ctx.Locale.Tr "repo.pulls.no_merge_helper"}} + </div> + {{end}} {{/* end if the repo was set to use any merge style */}} + {{else}} + {{/* user is not allowed to merge */}} + <div class="divider"></div> + <div class="item"> + {{svg "octicon-info"}} + {{ctx.Locale.Tr "repo.pulls.no_merge_access"}} + </div> + {{end}} {{/* end if user is allowed to merge or not */}} + {{else}} + {{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}} + {{if .IsBlockedByApprovals}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}} + </div> + {{else if .IsBlockedByRejection}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_rejection"}} + </div> + {{else if .IsBlockedByOfficialReviewRequests}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_official_review_requests"}} + </div> + {{else if .IsBlockedByOutdatedBranch}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.blocked_by_outdated_branch"}} + </div> + {{else if .IsBlockedByChangedProtectedFiles}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n"}} + </div> + <ul> + {{range .ChangedProtectedFiles}} + <li>{{.}}</li> + {{end}} + </ul> + {{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.required_status_check_failed"}} + </div> + {{else if and .RequireSigned (not .WillSign)}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.require_signed_wont_sign"}} + </div> + {{else}} + <div class="item text red"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "repo.pulls.cannot_auto_merge_desc"}} + </div> + <div class="item"> + {{svg "octicon-info"}} + {{ctx.Locale.Tr "repo.pulls.cannot_auto_merge_helper"}} + </div> + {{end}} + {{end}}{{/* end if: pull request status */}} + + {{/* + Manually Merged is not a well-known feature, it is used to mark a non-mergeable PR (already merged, conflicted) as merged + To test it: + * Enable "Manually Merged" feature in the Repository Settings + * Create a pull request, either: + * - Merge the pull request branch locally and push the merged commit to Gitea + * - Make some conflicts between the base branch and the pull request branch + * Then the Manually Merged form will be shown in the merge form + */}} + {{if and $.StillCanManualMerge (not $showGeneralMergeForm)}} + <div class="divider"></div> + <div class="ui form"> + <form action="{{.Link}}/merge" method="post" class="form-fetch-action"> + {{.CsrfTokenHtml}} + <div class="field"> + <input type="text" name="merge_commit_id" placeholder="{{ctx.Locale.Tr "repo.pulls.merge_commit_id"}}"> + </div> + <button class="ui red button" type="submit" name="do" value="manually-merged"> + {{ctx.Locale.Tr "repo.pulls.merge_manually"}} + </button> + </form> + </div> + {{end}} + + {{if and .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}} + {{template "repo/issue/view_content/pull_merge_instruction" dict "PullRequest" .Issue.PullRequest "ShowMergeInstructions" .ShowMergeInstructions}} + {{end}} + </div> + </div> +</div> +{{end}} diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl new file mode 100644 index 00000000..e8910280 --- /dev/null +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -0,0 +1,49 @@ +<div class="divider"></div> +<details class="collapsible"> + <summary class="tw-py-2"> {{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}} </summary> + <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 +refs/pull/{{.PullRequest.Index}}/head:{{$localBranch}}</div> + {{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"}}</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> + {{end}} +</details> diff --git a/templates/repo/issue/view_content/reactions.tmpl b/templates/repo/issue/view_content/reactions.tmpl new file mode 100644 index 00000000..da631966 --- /dev/null +++ b/templates/repo/issue/view_content/reactions.tmpl @@ -0,0 +1,17 @@ +<div class="ui attached segment reactions" data-action-url="{{$.ActionURL}}"> +{{range $key, $value := .Reactions}} + {{$hasReacted := $value.HasUser $.ctxData.SignedUserID}} + <a role="button" class="ui label basic{{if $hasReacted}} primary{{end}}{{if not $.ctxData.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}}" + 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}}"> + <span class="reaction">{{ReactionToEmoji $key}}</span> + <span class="reaction-count">{{len $value}}</span> + </a> +{{end}} +{{if AllowedReactions}} + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $.ctxData "ActionURL" .ActionURL}} +{{end}} +</div> diff --git a/templates/repo/issue/view_content/reference_issue_dialog.tmpl b/templates/repo/issue/view_content/reference_issue_dialog.tmpl new file mode 100644 index 00000000..c7a471f5 --- /dev/null +++ b/templates/repo/issue/view_content/reference_issue_dialog.tmpl @@ -0,0 +1,28 @@ +<div class="ui small modal" id="reference-issue-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.context.reference_issue"}} + </div> + <div class="content"> + <form class="ui form form-fetch-action" action="{{.Repository.Link}}/issues/new" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label><strong>{{ctx.Locale.Tr "repository"}}</strong></label> + <div class="ui search selection dropdown issue_reference_repository_search"> + <div class="default text gt-ellipsis">{{.Repository.FullName}}</div> + <div class="menu"></div> + </div> + </div> + <div class="field"> + <label><strong>{{ctx.Locale.Tr "repo.milestones.title"}}</strong></label> + <input name="title" value="" autofocus required maxlength="255" autocomplete="off"> + </div> + <div class="field"> + <label><strong>{{ctx.Locale.Tr "repo.issues.reference_issue.body"}}</strong></label> + <textarea name="content"></textarea> + </div> + <div class="text right"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.issues.create"}}</button> + </div> + </form> + </div> +</div> diff --git a/templates/repo/issue/view_content/show_role.tmpl b/templates/repo/issue/view_content/show_role.tmpl new file mode 100644 index 00000000..0f1b8955 --- /dev/null +++ b/templates/repo/issue/view_content/show_role.tmpl @@ -0,0 +1,15 @@ +{{if and .ShowRole.IsPoster (not .IgnorePoster)}} + <div class="ui basic label role-label" data-tooltip-content=" + {{if .IsPull}} + {{ctx.Locale.Tr "repo.issues.author.tooltip.pr"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.author.tooltip.issue"}} + {{end}}"> + {{ctx.Locale.Tr "repo.issues.author"}} + </div> +{{end}} +{{if .ShowRole.RoleInRepo}} + <div class="ui basic label role-label" data-tooltip-content="{{.ShowRole.RoleInRepo.LocaleHelper ctx.Locale}}"> + {{.ShowRole.RoleInRepo.LocaleString ctx.Locale}} + </div> +{{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl new file mode 100644 index 00000000..ba155398 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -0,0 +1,66 @@ +<div class="issue-content-right ui segment"> + {{template "repo/issue/view_content/sidebar/branch_selector_field" .}} + {{if .Issue.IsPull}} + {{template "repo/issue/view_content/sidebar/pull_review" .}} + {{template "repo/issue/view_content/sidebar/pull_wip" .}} + <div class="divider"></div> + {{end}} + + {{template "repo/issue/labels/labels_selector_field" .}} + {{template "repo/issue/labels/labels_sidebar" dict "root" $}} + + <div class="divider"></div> + + {{template "repo/issue/view_content/sidebar/milestones" .}} + <div class="divider"></div> + + {{template "repo/issue/view_content/sidebar/projects" .}} + <div class="divider"></div> + + {{template "repo/issue/view_content/sidebar/assignees" .}} + <div class="divider"></div> + + {{if .Participants}} + {{template "repo/issue/view_content/sidebar/participants" .}} + {{end}} + + {{if and $.IssueWatch (not .Repository.IsArchived)}} + <div class="divider"></div> + + {{template "repo/issue/view_content/sidebar/watch" .}} + {{end}} + + {{if .Repository.IsTimetrackerEnabled $.Context}} + {{template "repo/issue/view_content/sidebar/timetracking" .}} + {{end}} + + <div class="divider"></div> + {{template "repo/issue/view_content/sidebar/due_deadline" .}} + + {{if .Repository.IsDependenciesEnabled $.Context}} + <div class="divider"></div> + + {{template "repo/issue/view_content/sidebar/dependencies" .}} + {{end}} + + <div class="divider"></div> + {{template "repo/issue/view_content/sidebar/reference" .}} + + {{if and .IsRepoAdmin (not .Repository.IsArchived)}} + <div class="divider"></div> + + {{template "repo/issue/view_content/sidebar/actions" .}} + {{end}} + + {{if and + .Issue.IsPull + .IsIssuePoster + (not .Issue.IsClosed) + .Issue.PullRequest.HeadRepo + (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) + .CanWriteToHeadRepo + }} + <div class="divider"></div> + {{template "repo/issue/view_content/sidebar/pull_maintainer_edits" .}} + {{end}} +</div> diff --git a/templates/repo/issue/view_content/sidebar/actions.tmpl b/templates/repo/issue/view_content/sidebar/actions.tmpl new file mode 100644 index 00000000..36f21822 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/actions.tmpl @@ -0,0 +1,114 @@ +{{if or .PinEnabled .Issue.IsPinned}} + <form class="tw-mt-1 form-fetch-action single-button-form" method="post" {{if $.NewPinAllowed}}action="{{.Issue.Link}}/pin"{{else}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.max_pinned"}}"{{end}}> + {{$.CsrfTokenHtml}} + <button class="fluid ui button {{if not $.NewPinAllowed}}disabled{{end}}"> + {{if not .Issue.IsPinned}} + {{svg "octicon-pin" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "pin"}} + {{else}} + {{svg "octicon-pin-slash" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "unpin"}} + {{end}} + </button> + </form> +{{end}} + +<button class="tw-mt-1 fluid ui show-modal button {{if .Issue.IsLocked}} negative {{end}}" data-modal="#lock"> + {{if .Issue.IsLocked}} + {{svg "octicon-key"}} + {{ctx.Locale.Tr "repo.issues.unlock"}} + {{else}} + {{svg "octicon-lock"}} + {{ctx.Locale.Tr "repo.issues.lock"}} + {{end}} +</button> +<div class="ui tiny modal" id="lock"> + <div class="header"> + {{if .Issue.IsLocked}} + {{ctx.Locale.Tr "repo.issues.unlock.title"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.lock.title"}} + {{end}} + </div> + <div class="content"> + <div class="ui warning message"> + {{if .Issue.IsLocked}} + {{ctx.Locale.Tr "repo.issues.unlock.notice_1"}}<br> + {{ctx.Locale.Tr "repo.issues.unlock.notice_2"}}<br> + {{else}} + {{ctx.Locale.Tr "repo.issues.lock.notice_1"}}<br> + {{ctx.Locale.Tr "repo.issues.lock.notice_2"}}<br> + {{ctx.Locale.Tr "repo.issues.lock.notice_3"}}<br> + {{end}} + </div> + + <form class="ui form form-fetch-action" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}" + method="post"> + {{.CsrfTokenHtml}} + + {{if not .Issue.IsLocked}} + <div class="field"> + <strong> {{ctx.Locale.Tr "repo.issues.lock.reason"}} </strong> + </div> + + <div class="field"> + <div class="ui fluid dropdown selection"> + + <select name="reason"> + <option value=""> </option> + {{range .LockReasons}} + <option value="{{.}}">{{.}}</option> + {{end}} + </select> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + + <div class="default text"> </div> + + <div class="menu"> + {{range .LockReasons}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + </div> + {{end}} + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button"> + {{if .Issue.IsLocked}} + {{ctx.Locale.Tr "repo.issues.unlock_confirm"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.lock_confirm"}} + {{end}} + </button> + </div> + </form> + </div> +</div> +<button class="tw-mt-1 fluid ui show-modal button" data-modal="#sidebar-delete-issue"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.issues.delete"}} +</button> +<div class="ui g-modal-confirm modal" id="sidebar-delete-issue"> + <div class="header"> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.pulls.delete.title"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.delete.title"}} + {{end}} + </div> + <div class="content"> + <p> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.pulls.delete.text"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.delete.text"}} + {{end}} + </p> + </div> + <form action="{{.Issue.Link}}/delete" method="post"> + {{.CsrfTokenHtml}} + {{template "base/modal_actions_confirm" .}} + </form> +</div> diff --git a/templates/repo/issue/view_content/sidebar/assignees.tmpl b/templates/repo/issue/view_content/sidebar/assignees.tmpl new file mode 100644 index 00000000..e51bda95 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/assignees.tmpl @@ -0,0 +1,45 @@ +<input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}"> +<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-assignees-modify dropdown"> + <a class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.assignees"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="filter menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/assignee"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_assignees"}}"> + </div> + <div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}</div> + {{range .Assignees}} + + {{$AssigneeID := .ID}} + <a class="item{{range $.Issue.Assignees}}{{if eq .ID $AssigneeID}} checked{{end}}{{end}}" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}"> + {{$checked := false}} + {{range $.Issue.Assignees}} + {{if eq .ID $AssigneeID}} + {{$checked = true}} + {{end}} + {{end}} + <span class="octicon-check {{if not $checked}}tw-invisible{{end}}">{{svg "octicon-check"}}</span> + <span class="text"> + {{ctx.AvatarUtils.Avatar . 20 "tw-mr-2"}}{{template "repo/search_name" .}} + </span> + </a> + {{end}} + </div> +</div> +<div class="ui assignees list"> + <span class="no-select item {{if .Issue.Assignees}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_assignees"}}</span> + <div class="selected"> + {{range .Issue.Assignees}} + <div class="item"> + <a class="muted sidebar-item-link" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?assignee={{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "tw-mr-2"}} + {{.GetDisplayName}} + </a> + </div> + {{end}} + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl b/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl new file mode 100644 index 00000000..c23e13b2 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/branch_selector_field.tmpl @@ -0,0 +1,59 @@ +{{if and (not .Issue.IsPull) (not .PageIsComparePull)}} +<input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}"> +<input id="editing_mode" name="edit_mode" type="hidden" value="{{(or .IsIssueWriter .HasIssuesOrPullsWritePermission)}}"> +<form method="post" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref" id="update_issueref_form"> + {{$.CsrfTokenHtml}} +</form> +{{/* TODO: share this branch selector dropdown with the same in repo page */}} +<div class="ui {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}} floating filter select-branch dropdown tw-max-w-full" data-no-results="{{ctx.Locale.Tr "repo.pulls.no_results"}}"> + <div class="ui basic small button"> + <span class="text branch-name gt-ellipsis">{{if .Reference}}{{$.RefEndName}}{{else}}{{ctx.Locale.Tr "repo.issues.no_ref"}}{{end}}</span> + {{if .HasIssuesOrPullsWritePermission}}{{svg "octicon-triangle-down" 14 "dropdown icon"}}{{end}} + </div> + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-filter" 16}}</i> + <input name="search" placeholder="{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}..."> + </div> + <div class="header"> + <div class="ui grid"> + <div class="two column row"> + <a class="reference column muted" href="#" data-target="#branch-list"> + <span class="text black"> + {{svg "octicon-git-branch" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.branches"}} + </span> + </a> + <a class="reference column muted" href="#" data-target="#tag-list"> + <span class="text"> + {{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.tags"}} + </span> + </a> + </div> + </div> + </div> + <div class="branch-tag-divider"></div> + <div id="branch-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}}"> + {{if .Reference}} + <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{ctx.Locale.Tr "repo.clear_ref"}}</a></strong></div> + {{end}} + {{range .Branches}} + <div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector" title="{{.}}">{{.}}</div> + {{else}} + <div class="item">{{ctx.Locale.Tr "repo.pulls.no_results"}}</div> + {{end}} + </div> + <div id="tag-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}} tw-hidden"> + {{if .Reference}} + <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{ctx.Locale.Tr "repo.clear_ref"}}</a></strong></div> + {{end}} + {{range .Tags}} + <div class="item" data-id="refs/tags/{{.}}" data-name="tags/{{.}}" data-id-selector="#ref_selector">{{.}}</div> + {{else}} + <div class="item">{{ctx.Locale.Tr "repo.pulls.no_results"}}</div> + {{end}} + </div> + </div> +</div> + +<div class="divider"></div> +{{end}} diff --git a/templates/repo/issue/view_content/sidebar/dependencies.tmpl b/templates/repo/issue/view_content/sidebar/dependencies.tmpl new file mode 100644 index 00000000..791bd5c4 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/dependencies.tmpl @@ -0,0 +1,145 @@ +<div class="ui depending"> + {{if (and (not .BlockedByDependencies) (not .BlockedByDependenciesNotPermitted) (not .BlockingDependencies) (not .BlockingDependenciesNotPermitted))}} + <span class="text"><strong>{{ctx.Locale.Tr "repo.issues.dependency.title"}}</strong></span> + <br> + <p> + {{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.issues.dependency.pr_no_dependencies"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.dependency.issue_no_dependencies"}} + {{end}} + </p> + {{end}} + + {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}} + <span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{ctx.Locale.Tr "repo.issues.dependency.pr_close_blocks"}}{{else}}{{ctx.Locale.Tr "repo.issues.dependency.issue_close_blocks"}}{{end}}"> + <strong>{{ctx.Locale.Tr "repo.issues.dependency.blocks_short"}}</strong> + </span> + <div class="ui relaxed divided list"> + {{range .BlockingDependencies}} + <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> + <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> + <a class="title muted" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}"> + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} + </a> + <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> + {{.Repository.OwnerName}}/{{.Repository.Name}} + </div> + </div> + <div class="item-right tw-flex tw-items-center tw-m-1"> + {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + {{svg "octicon-trash" 16}} + </a> + {{end}} + </div> + </div> + {{end}} + {{if .BlockingDependenciesNotPermitted}} + <div class="item tw-flex tw-items-center tw-justify-between gt-ellipsis"> + <span>{{ctx.Locale.TrN (len .BlockingDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockingDependenciesNotPermitted)}}</span> + </div> + {{end}} + </div> + {{end}} + + {{if or .BlockedByDependencies .BlockedByDependenciesNotPermitted}} + <span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{ctx.Locale.Tr "repo.issues.dependency.pr_closing_blockedby"}}{{else}}{{ctx.Locale.Tr "repo.issues.dependency.issue_closing_blockedby"}}{{end}}"> + <strong>{{ctx.Locale.Tr "repo.issues.dependency.blocked_by_short"}}</strong> + </span> + <div class="ui relaxed divided list"> + {{range .BlockedByDependencies}} + <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> + <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> + <a class="title muted" href="{{.Issue.Link}}" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}"> + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} + </a> + <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> + {{.Repository.OwnerName}}/{{.Repository.Name}} + </div> + </div> + <div class="item-right tw-flex tw-items-center tw-m-1"> + {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blockedBy" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + {{svg "octicon-trash" 16}} + </a> + {{end}} + </div> + </div> + {{end}} + {{if $.CanCreateIssueDependencies}} + {{range .BlockedByDependenciesNotPermitted}} + <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} tw-flex tw-items-center tw-justify-between"> + <div class="item-left tw-flex tw-justify-center tw-flex-col tw-flex-1 gt-ellipsis"> + <div class="gt-ellipsis"> + <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.no_permission.can_remove"}}">{{svg "octicon-lock" 16}}</span> + <span class="title" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}"> + #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}} + </span> + </div> + <div class="text small gt-ellipsis" data-tooltip-content="{{.Repository.OwnerName}}/{{.Repository.Name}}"> + {{.Repository.OwnerName}}/{{.Repository.Name}} + </div> + </div> + <div class="item-right tw-flex tw-items-center tw-m-1"> + {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} + <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> + {{svg "octicon-trash" 16}} + </a> + {{end}} + </div> + </div> + {{end}} + {{else if .BlockedByDependenciesNotPermitted}} + <div class="item tw-flex tw-items-center tw-justify-between gt-ellipsis"> + <span>{{ctx.Locale.TrN (len .BlockedByDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockedByDependenciesNotPermitted)}}</span> + </div> + {{end}} + </div> + {{end}} + + {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} + <div> + <form method="post" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm"> + {{$.CsrfTokenHtml}} + <div class="ui fluid action input"> + <div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}"> + <input name="newDependency" type="hidden"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <input type="text" class="search"> + <div class="default text">{{ctx.Locale.Tr "repo.issues.dependency.add"}}</div> + </div> + <button class="ui icon button"> + {{svg "octicon-plus"}} + </button> + </div> + </form> + </div> + {{end}} +</div> + +{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} + <input type="hidden" id="crossRepoSearch" value="{{.AllowCrossRepositoryDependencies}}"> + + <div class="ui g-modal-confirm modal remove-dependency"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.issues.dependency.remove_header"}} + </div> + <div class="content"> + <form method="post" action="{{.Issue.Link}}/dependency/delete" id="removeDependencyForm"> + {{$.CsrfTokenHtml}} + <input type="hidden" value="" name="removeDependencyID" id="removeDependencyID"> + <input type="hidden" value="" name="dependencyType" id="dependencyType"> + </form> + <p>{{if .Issue.IsPull}} + {{ctx.Locale.Tr "repo.issues.dependency.pr_remove_text"}} + {{else}} + {{ctx.Locale.Tr "repo.issues.dependency.issue_remove_text"}} + {{end}}</p> + </div> + {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}} + {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}} + {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}} + </div> +{{end}} diff --git a/templates/repo/issue/view_content/sidebar/due_deadline.tmpl b/templates/repo/issue/view_content/sidebar/due_deadline.tmpl new file mode 100644 index 00000000..2de836b4 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/due_deadline.tmpl @@ -0,0 +1,41 @@ +<span class="text"><strong>{{ctx.Locale.Tr "repo.issues.due_date"}}</strong></span> +<div class="ui form" id="deadline-loader"> + <div class="ui negative message tw-hidden" id="deadline-err-invalid-date"> + {{svg "octicon-x" 16 "close icon"}} + {{ctx.Locale.Tr "repo.issues.due_date_invalid"}} + </div> + {{if ne .Issue.DeadlineUnix 0}} + <p> + <div class="tw-flex tw-justify-between tw-items-center"> + <div class="due-date {{if .Issue.IsOverdue}}text red{{end}}" {{if .Issue.IsOverdue}}data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date_overdue"}}"{{end}}> + {{svg "octicon-calendar" 16 "tw-mr-2"}} + {{DateTime "long" .Issue.DeadlineUnix.FormatDate}} + </div> + <div> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + <a class="issue-due-edit muted" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date_form_edit"}}">{{svg "octicon-pencil" 16 "tw-mr-1"}}</a> + <a class="issue-due-remove muted" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date_form_remove"}}">{{svg "octicon-trash"}}</a> + {{end}} + </div> + </div> + </p> + {{else}} + <p>{{ctx.Locale.Tr "repo.issues.due_date_not_set"}}</p> + {{end}} + + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + <div {{if ne .Issue.DeadlineUnix 0}} class="tw-hidden"{{end}} id="deadlineForm"> + <form class="ui fluid action input issue-due-form" action="{{AppSubUrl}}/{{PathEscape .Repository.Owner.Name}}/{{PathEscape .Repository.Name}}/issues/{{.Issue.Index}}/deadline" method="post" id="update-issue-deadline-form"> + {{$.CsrfTokenHtml}} + <input required placeholder="{{ctx.Locale.Tr "repo.issues.due_date_form"}}" {{if gt .Issue.DeadlineUnix 0}}value="{{.Issue.DeadlineUnix.FormatDate}}"{{end}} type="date" name="deadlineDate" id="deadlineDate"> + <button class="ui icon button"> + {{if ne .Issue.DeadlineUnix 0}} + {{svg "octicon-pencil"}} + {{else}} + {{svg "octicon-plus"}} + {{end}} + </button> + </form> + </div> + {{end}} +</div> diff --git a/templates/repo/issue/view_content/sidebar/milestones.tmpl b/templates/repo/issue/view_content/sidebar/milestones.tmpl new file mode 100644 index 00000000..661ca807 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/milestones.tmpl @@ -0,0 +1,22 @@ +<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-milestone dropdown"> + <a class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.milestone"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/milestone"> + {{template "repo/issue/milestone/select_menu" .}} + </div> +</div> +<div class="ui select-milestone list"> + <span class="no-select item {{if .Issue.Milestone}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_milestone"}}</span> + <div class="selected"> + {{if .Issue.Milestone}} + <a class="item muted sidebar-item-link" href="{{.RepoLink}}/milestone/{{.Issue.Milestone.ID}}"> + {{svg "octicon-milestone" 18 "tw-mr-2"}} + {{.Issue.Milestone.Name}} + </a> + {{end}} + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/participants.tmpl b/templates/repo/issue/view_content/sidebar/participants.tmpl new file mode 100644 index 00000000..93e2579d --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/participants.tmpl @@ -0,0 +1,8 @@ +<span class="text"><strong>{{ctx.Locale.TrN .NumParticipants "repo.issues.num_participants_one" "repo.issues.num_participants_few" .NumParticipants}}</strong></span> +<div class="ui list tw-flex tw-flex-wrap"> + {{range .Participants}} + <a {{if gt .ID 0}}href="{{.HomeLink}}"{{end}} data-tooltip-content="{{.GetDisplayName}}"> + {{ctx.AvatarUtils.Avatar . 28 "tw-my-0.5 tw-mr-1"}} + </a> + {{end}} +</div> diff --git a/templates/repo/issue/view_content/sidebar/projects.tmpl b/templates/repo/issue/view_content/sidebar/projects.tmpl new file mode 100644 index 00000000..91d75f3b --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/projects.tmpl @@ -0,0 +1,54 @@ +<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-project dropdown"> + <a class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.projects"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/projects"> + {{if or .OpenProjects .ClosedProjects}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_projects"}}"> + </div> + {{end}} + <div class="no-select item">{{ctx.Locale.Tr "repo.issues.new.clear_projects"}}</div> + {{if and (not .OpenProjects) (not .ClosedProjects)}} + <div class="disabled item"> + {{ctx.Locale.Tr "repo.issues.new.no_items"}} + </div> + {{end}} + {{if .OpenProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.open_projects"}} + </div> + {{range .OpenProjects}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link ctx}}"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </a> + {{end}} + {{end}} + {{if .ClosedProjects}} + <div class="divider"></div> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new.closed_projects"}} + </div> + {{range .ClosedProjects}} + <a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link ctx}}"> + {{svg .IconName 18 "tw-mr-2"}}{{.Title}} + </a> + {{end}} + {{end}} + </div> +</div> +<div class="ui select-project list"> + <span class="no-select item {{if .Issue.Project}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_projects"}}</span> + <div class="selected"> + {{if .Issue.Project}} + <a class="item muted sidebar-item-link" href="{{.Issue.Project.Link ctx}}"> + {{svg .Issue.Project.IconName 18 "tw-mr-2"}}{{.Issue.Project.Title}} + </a> + {{end}} + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl b/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl new file mode 100644 index 00000000..6ec5c05f --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_maintainer_edits.tmpl @@ -0,0 +1,10 @@ +<div class="inline field"> + <div class="ui checkbox loading-icon-2px" id="allow-edits-from-maintainers" + data-url="{{.Issue.Link}}" + data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}" + data-prompt-error="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_err"}}" + > + <label><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label> + <input type="checkbox" {{if .Issue.PullRequest.AllowMaintainerEdit}}checked{{end}}> + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/pull_review.tmpl b/templates/repo/issue/view_content/sidebar/pull_review.tmpl new file mode 100644 index 00000000..930c2a63 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_review.tmpl @@ -0,0 +1,45 @@ +<input id="reviewer_id" name="reviewer_id" type="hidden" value="{{.reviewer_id}}"> +<div class="ui {{if or (and (not .Reviewers) (not .TeamReviewers)) (not .CanChooseReviewer) .Repository.IsArchived}}disabled{{end}} floating jump select-reviewers-modify dropdown"> + <a class="text tw-flex tw-items-center muted"> + <strong>{{ctx.Locale.Tr "repo.issues.review.reviewers"}}</strong> + {{if and .CanChooseReviewer (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </a> + <div class="filter menu" data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/request_review"> + {{if .Reviewers}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_reviewers"}}"> + </div> + {{end}} + {{if .Reviewers}} + {{range .Reviewers}} + {{if .User}} + <a class="{{if not .CanChange}}ui{{end}} item {{if .Checked}}checked{{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-tooltip-content="{{ctx.Locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}> + <span class="octicon-check {{if not .Checked}}tw-invisible{{end}}">{{svg "octicon-check"}}</span> + <span class="text"> + {{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}{{template "repo/search_name" .User}} + </span> + </a> + {{end}} + {{end}} + {{end}} + {{if .TeamReviewers}} + {{if .Reviewers}} + <div class="divider"></div> + {{end}} + {{range .TeamReviewers}} + {{if .Team}} + <a class="{{if not .CanChange}}ui{{end}} item {{if .Checked}}checked{{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_team_{{.Team.ID}}" {{if not .CanChange}} data-tooltip-content="{{ctx.Locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}> + <span class="octicon-check {{if not .Checked}}tw-invisible{{end}}">{{svg "octicon-check" 16}}</span> + <span class="text"> + {{svg "octicon-people" 16 "tw-ml-4 tw-mr-1"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}} + </span> + </a> + {{end}} + {{end}} + {{end}} + </div> +</div> +{{template "repo/issue/view_content/sidebar/pull_reviewers" .}} diff --git a/templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl b/templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl new file mode 100644 index 00000000..102508fd --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_reviewers.tmpl @@ -0,0 +1,67 @@ +<div class="ui assignees list"> + <span class="no-select item {{if or .OriginalReviews .PullReviewers}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_reviewers"}}</span> + <div class="selected"> + {{range .PullReviewers}} + <div class="item tw-flex tw-items-center tw-py-2"> + <div class="tw-flex tw-items-center tw-flex-1"> + {{if .User}} + <a class="muted sidebar-item-link" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20 "tw-mr-2"}}{{.User.GetDisplayName}}</a> + {{else if .Team}} + <span class="text">{{svg "octicon-people" 20 "tw-mr-2"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}</span> + {{end}} + </div> + <div class="tw-flex tw-items-center tw-gap-2"> + {{if (and $.Permission.IsAdmin (or (eq .Review.Type 1) (eq .Review.Type 3)) (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged))}} + <a href="#" class="ui muted icon tw-flex tw-items-center show-modal" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dismiss_review"}}" data-modal="#dismiss-review-modal-{{.Review.ID}}"> + {{svg "octicon-x" 20}} + </a> + <div class="ui small modal" id="dismiss-review-modal-{{.Review.ID}}"> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.dismiss_review"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.issues.dismiss_review_warning"}} + </div> + <form class="ui form dismiss-review-form" id="dismiss-review-{{.Review.ID}}" action="{{$.RepoLink}}/issues/dismiss_review" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="review_id" value="{{.Review.ID}}"> + <div class="field"> + <label for="message">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</label> + <input id="message" name="message"> + </div> + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button" type="submit">{{ctx.Locale.Tr "ok"}}</button> + </div> + </form> + </div> + </div> + {{end}} + {{if .Review.Stale}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.issues.is_stale"}}"> + {{svg "octicon-hourglass" 16}} + </span> + {{end}} + {{if and .CanChange (or .Checked (and (not $.Issue.IsClosed) (not $.Issue.PullRequest.HasMerged)))}} + <a href="#" class="ui muted icon re-request-review{{if .Checked}} checked{{end}}" data-tooltip-content="{{if .Checked}}{{ctx.Locale.Tr "repo.issues.remove_request_review"}}{{else}}{{ctx.Locale.Tr "repo.issues.re_request_review"}}{{end}}" data-issue-id="{{$.Issue.ID}}" data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review">{{if .Checked}}{{svg "octicon-trash"}}{{else}}{{svg "octicon-sync"}}{{end}}</a> + {{end}} + {{svg (printf "octicon-%s" .Review.Type.Icon) 16 (printf "text %s" (.Review.HTMLTypeColorName))}} + </div> + </div> + {{end}} + {{range .OriginalReviews}} + <div class="item tw-flex tw-items-center tw-py-2"> + <div class="tw-flex tw-items-center tw-flex-1"> + <a class="muted" href="{{$.Repository.OriginalURL}}" data-tooltip-content="{{ctx.Locale.Tr "repo.migrated_from_fake" $.Repository.GetOriginalURLHostname}}"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname) 20 "tw-mr-2"}} + {{.OriginalAuthor}} + </a> + </div> + <div class="tw-flex tw-items-center tw-gap-2"> + {{svg (printf "octicon-%s" .Type.Icon) 16 (printf "text %s" (.HTMLTypeColorName))}} + </div> + </div> + {{end}} + </div> + </div> diff --git a/templates/repo/issue/view_content/sidebar/pull_wip.tmpl b/templates/repo/issue/view_content/sidebar/pull_wip.tmpl new file mode 100644 index 00000000..f1588b3f --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/pull_wip.tmpl @@ -0,0 +1,11 @@ +{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed)}} + <div class="toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}" data-update-url="{{.Issue.Link}}/title"> + <a class="muted"> + {{if .IsPullWorkInProgress}} + {{ctx.Locale.Tr "repo.pulls.ready_for_review"}} {{ctx.Locale.Tr "repo.pulls.remove_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} + {{else}} + {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} + {{end}} + </a> + </div> +{{end}} diff --git a/templates/repo/issue/view_content/sidebar/reference.tmpl b/templates/repo/issue/view_content/sidebar/reference.tmpl new file mode 100644 index 00000000..bbbc0995 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/reference.tmpl @@ -0,0 +1,7 @@ +<div class="ui equal width compact grid"> + {{$issueReferenceLink := printf "%s#%d" .Issue.Repo.FullName .Issue.Index}} + <div class="row tw-items-center" data-tooltip-content="{{$issueReferenceLink}}"> + <span class="text column truncate">{{ctx.Locale.Tr "repo.issues.reference_link" $issueReferenceLink}}</span> + <button class="ui two wide button column tw-p-2" data-clipboard-text="{{$issueReferenceLink}}">{{svg "octicon-copy" 14}}</button> + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/timetracking.tmpl b/templates/repo/issue/view_content/sidebar/timetracking.tmpl new file mode 100644 index 00000000..610600b2 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/timetracking.tmpl @@ -0,0 +1,73 @@ +{{if and .CanUseTimetracker (not .Repository.IsArchived)}} + <div class="divider"></div> + <div class="ui timetrack"> + <span class="text"><strong>{{ctx.Locale.Tr "repo.issues.tracker"}}</strong></span> + <div class="tw-mt-2"> + <form method="post" action="{{.Issue.Link}}/times/stopwatch/toggle" id="toggle_stopwatch_form"> + {{$.CsrfTokenHtml}} + </form> + <form method="post" action="{{.Issue.Link}}/times/stopwatch/cancel" id="cancel_stopwatch_form"> + {{$.CsrfTokenHtml}} + </form> + {{if $.IsStopwatchRunning}} + <button class="ui fluid button issue-stop-time"> + {{svg "octicon-stopwatch" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.stop_tracking"}} + </button> + <button class="ui fluid button issue-cancel-time tw-mt-2"> + {{svg "octicon-trash" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.cancel_tracking"}} + </button> + {{else}} + {{if .HasUserStopwatch}} + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.issues.tracking_already_started" .OtherStopwatchURL}} + </div> + {{end}} + <button class="ui fluid button issue-start-time" data-tooltip-content='{{ctx.Locale.Tr "repo.issues.start_tracking"}}'> + {{svg "octicon-stopwatch" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.start_tracking_short"}} + </button> + <div class="ui mini modal issue-start-time-modal"> + <div class="header">{{ctx.Locale.Tr "repo.issues.add_time"}}</div> + <div class="content"> + <form method="post" id="add_time_manual_form" action="{{.Issue.Link}}/times/add" class="ui input fluid tw-gap-2"> + {{$.CsrfTokenHtml}} + <input placeholder='{{ctx.Locale.Tr "repo.issues.add_time_hours"}}' type="number" name="hours"> + <input placeholder='{{ctx.Locale.Tr "repo.issues.add_time_minutes"}}' type="number" name="minutes" class="ui compact"> + </form> + </div> + <div class="actions"> + <button class="ui primary approve button">{{ctx.Locale.Tr "repo.issues.add_time_short"}}</button> + <button class="ui cancel button">{{ctx.Locale.Tr "repo.issues.add_time_cancel"}}</button> + </div> + </div> + <button class="ui fluid button issue-add-time tw-mt-2" data-tooltip-content='{{ctx.Locale.Tr "repo.issues.add_time"}}'> + {{svg "octicon-plus" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.add_time_short"}} + </button> + {{end}} + </div> + </div> +{{end}} +{{if .WorkingUsers}} + <div class="divider"></div> + <div class="ui comments"> + <span class="text"><strong>{{ctx.Locale.Tr "repo.issues.time_spent_from_all_authors" ($.Issue.TotalTrackedTime | Sec2Time)}}</strong></span> + <div> + {{range $user, $trackedtime := .WorkingUsers}} + <div class="comment tw-mt-2"> + <a class="avatar"> + {{ctx.AvatarUtils.Avatar $user}} + </a> + <div class="content"> + {{template "shared/user/authorlink" $user}} + <div class="text"> + {{$trackedtime|Sec2Time}} + </div> + </div> + </div> + {{end}} + </div> + </div> +{{end}} diff --git a/templates/repo/issue/view_content/sidebar/watch.tmpl b/templates/repo/issue/view_content/sidebar/watch.tmpl new file mode 100644 index 00000000..ee141680 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/watch.tmpl @@ -0,0 +1,6 @@ +<div class="ui watching"> + <span class="text"><strong>{{ctx.Locale.Tr "notification.notifications"}}</strong></span> + <div class="tw-mt-2"> + {{template "repo/issue/view_content/sidebar/watching" .}} + </div> +</div> diff --git a/templates/repo/issue/view_content/sidebar/watching.tmpl b/templates/repo/issue/view_content/sidebar/watching.tmpl new file mode 100644 index 00000000..d3d75946 --- /dev/null +++ b/templates/repo/issue/view_content/sidebar/watching.tmpl @@ -0,0 +1,19 @@ +<form hx-boost="true" hx-sync="this:replace" hx-target="this" method="post" action="{{.Issue.Link}}/watch" + {{if not $.IsSigned}} + {{if $.Issue.IsPull}} + data-tooltip-content="{{ctx.Locale.Tr "repo.subscribe.pull.guest.tooltip"}}" + {{else}} + data-tooltip-content="{{ctx.Locale.Tr "repo.subscribe.issue.guest.tooltip"}}" + {{end}} + {{end}}> + <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}"> + <button class="fluid ui button {{if not $.IsSigned}}disabled{{end}}"> + {{if $.IssueWatch.IsWatching}} + {{svg "octicon-mute" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.unsubscribe"}} + {{else}} + {{svg "octicon-unmute" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.subscribe"}} + {{end}} + </button> +</form> diff --git a/templates/repo/issue/view_content/update_branch_by_merge.tmpl b/templates/repo/issue/view_content/update_branch_by_merge.tmpl new file mode 100644 index 00000000..adce052d --- /dev/null +++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl @@ -0,0 +1,37 @@ +{{if and (gt $.Issue.PullRequest.CommitsBehind 0) (not $.Issue.IsClosed) (not $.Issue.PullRequest.IsChecking) (not $.IsPullFilesConflicted) (not $.IsPullRequestBroken)}} + <div class="divider"></div> + <div class="item item-section"> + <div class="item-section-left flex-text-inline"> + {{svg "octicon-alert"}} + {{ctx.Locale.Tr "repo.pulls.outdated_with_base_branch"}} + </div> + <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}}"> + <span class="button-text"> + {{ctx.Locale.Tr "repo.pulls.update_branch"}} + </span> + </button> + <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> + </div> + </div> + </div> + </div> + {{end}} + {{if and $.UpdateAllowed (not $.UpdateByRebaseAllowed)}} + <form action="{{$.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> + </button> + </form> + {{end}} + </div> + </div> +{{end}} diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl new file mode 100644 index 00000000..c6276279 --- /dev/null +++ b/templates/repo/issue/view_title.tmpl @@ -0,0 +1,145 @@ +{{if .Flash}} + <div class="sixteen wide column tw-mb-2"> + {{template "base/alert" .}} + </div> +{{end}} +<div class="issue-title-header"> + {{$canEditIssueTitle := and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} + <div class="issue-title" id="issue-title-display"> + <h1 class="tw-break-anywhere"> + {{RenderIssueTitle $.Context .Issue.Title ($.Repository.ComposeMetas ctx) | RenderCodeBlock}} + <span class="index">#{{.Issue.Index}}</span> + </h1> + <div class="button-row"> + {{if $canEditIssueTitle}} + <button id="issue-title-edit-show" class="ui small basic button">{{ctx.Locale.Tr "repo.issues.edit"}}</button> + {{end}} + {{if not .Issue.IsPull}} + <a role="button" class="ui small primary button" href="{{.RepoLink}}/issues/new{{if .NewIssueChooseTemplate}}/choose{{end}}">{{ctx.Locale.Tr "repo.issues.new"}}</a> + {{end}} + </div> + </div> + {{if $canEditIssueTitle}} + <div class="ui form issue-title tw-hidden" id="issue-title-editor"> + <div class="ui input tw-flex-1"> + <input value="{{.Issue.Title}}" data-old-title="{{.Issue.Title}}" maxlength="255" autocomplete="off" class="js-quick-submit"> + </div> + <div class="button-row"> + <button class="ui small basic cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button> + <button class="ui small primary button" + data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title"> + {{ctx.Locale.Tr "repo.issues.save"}} + </button> + </div> + </div> + {{end}} + <div class="issue-title-meta"> + {{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">{{if .Issue.IsPull}}{{svg "octicon-git-pull-request"}}{{else}}{{svg "octicon-issue-closed"}}{{end}} {{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> + {{else}} + <div class="ui green label issue-state-label">{{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.issues.open_title"}}</div> + {{end}} + {{else}} + <div class="ui green label issue-state-label">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.open_title"}}</div> + {{end}} + <div class="tw-ml-2 tw-flex-1 tw-break-anywhere"> + {{if .Issue.IsPull}} + {{$headHref := .HeadTarget}} + {{if .HeadBranchLink}} + {{$headHref = HTMLFormat `<a href="%s">%s</a>` .HeadBranchLink $headHref}} + {{end}} + {{if not .MadeUsingAGit}} + {{$headHref = HTMLFormat `%s <button class="btn interact-fg" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` $headHref (ctx.Locale.Tr "copy_branch") .HeadTarget (svg "octicon-copy" 14)}} + {{end}} + {{$baseHref := .BaseTarget}} + {{if .BaseBranchLink}} + {{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}} + {{end}} + {{if .Issue.PullRequest.HasMerged}} + {{$mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix ctx.Locale}} + {{if .Issue.OriginalAuthor}} + {{.Issue.OriginalAuthor}} + <span class="pull-desc">{{ctx.Locale.TrN .NumCommits "repo.pulls.merged_title_desc_one" "repo.pulls.merged_title_desc_few" .NumCommits $headHref $baseHref $mergedStr}}</span> + {{else}} + <a {{if gt .Issue.PullRequest.Merger.ID 0}}href="{{.Issue.PullRequest.Merger.HomeLink}}"{{end}}>{{.Issue.PullRequest.Merger.GetDisplayName}}</a> + <span class="pull-desc">{{ctx.Locale.TrN .NumCommits "repo.pulls.merged_title_desc_one" "repo.pulls.merged_title_desc_few" .NumCommits $headHref $baseHref $mergedStr}}</span> + {{end}} + {{if .MadeUsingAGit}} + {{/* TODO: Move documentation link to the instructions at the bottom of the PR, show instructions when clicking label */}} + {{/* Note: #agit-label is necessary for testing whether the label appears when it should in tests/integration/git_test.go */}} + <a target="_blank" rel="noopener" href="https://forgejo.org/docs/latest/user/agit-support/"> + <span id="agit-label" data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.agit_explanation"}}" class="ui small label"> + {{ctx.Locale.Tr "repo.pulls.made_using_agit"}} + </span> + </a> + {{end}} + {{else}} + {{if .Issue.OriginalAuthor}} + <span id="pull-desc-display" class="pull-desc">{{.Issue.OriginalAuthor}} {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref}}</span> + {{else}} + <span id="pull-desc-display" class="pull-desc"> + <a {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a> + {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref}} + </span> + {{end}} + {{if .MadeUsingAGit}} + {{/* TODO: Move documentation link to the instructions at the bottom of the PR, show instructions when clicking label */}} + {{/* Note: #agit-label is necessary for testing whether the label appears when it should in tests/integration/git_test.go */}} + <a target="_blank" rel="noopener" href="https://forgejo.org/docs/latest/user/agit-support/"> + <span id="agit-label" data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.agit_explanation"}}" class="ui small label"> + {{ctx.Locale.Tr "repo.pulls.made_using_agit"}} + </span> + </a> + {{end}} + <span id="pull-desc-editor" class="tw-hidden flex-text-block" data-target-update-url="{{$.RepoLink}}/pull/{{.Issue.Index}}/target_branch"> + <div class="ui floating filter dropdown"> + <div class="ui basic small button tw-mr-0"> + <span class="text">{{ctx.Locale.Tr "repo.pulls.compare_compare"}}: {{$.HeadTarget}}</span> + </div> + </div> + {{svg "octicon-arrow-right"}} + <div class="ui floating filter dropdown" data-no-results="{{ctx.Locale.Tr "repo.pulls.no_results"}}"> + <div class="ui basic small button"> + <span class="text" id="pull-target-branch" data-basename="{{$.BaseName}}" data-branch="{{$.BaseBranch}}">{{ctx.Locale.Tr "repo.pulls.compare_base"}}: {{$.BaseName}}:{{$.BaseBranch}}</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-filter" 16}}</i> + <input name="search" placeholder="{{ctx.Locale.Tr "repo.pulls.filter_branch"}}..."> + </div> + <div class="scrolling menu" id="branch-select"> + {{range .Branches}} + {{$sameBase := ne $.BaseName $.HeadUserName}} + {{$differentBranch := ne . $.HeadBranch}} + {{if or $sameBase $differentBranch}} + <div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-branch="{{.}}">{{$.BaseName}}{{if $.HeadRepo}}/{{$.HeadRepo}}{{end}}:{{.}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + </span> + {{end}} + {{else}} + {{$createdStr:= TimeSinceUnix .Issue.CreatedUnix ctx.Locale}} + <span class="time-desc"> + {{if .Issue.OriginalAuthor}} + {{ctx.Locale.Tr "repo.issues.opened_by_fake" $createdStr .Issue.OriginalAuthor}} + {{else if gt .Issue.Poster.ID 0}} + {{ctx.Locale.Tr "repo.issues.opened_by" $createdStr .Issue.Poster.HomeLink .Issue.Poster.GetDisplayName}} + {{else}} + {{ctx.Locale.Tr "repo.issues.opened_by_fake" $createdStr .Issue.Poster.GetDisplayName}} + {{end}} + · + {{ctx.Locale.TrN .Issue.NumComments "repo.issues.num_comments_1" "repo.issues.num_comments" .Issue.NumComments}} + </span> + {{end}} + </div> + </div> +</div> diff --git a/templates/repo/latest_commit.tmpl b/templates/repo/latest_commit.tmpl new file mode 100644 index 00000000..8bacb427 --- /dev/null +++ b/templates/repo/latest_commit.tmpl @@ -0,0 +1,31 @@ +{{if not .LatestCommit}} + <div class="ui active tiny slow centered inline">…</div> +{{else}} + {{if .LatestCommitUser}} + {{ctx.AvatarUtils.Avatar .LatestCommitUser 24 "tw-mr-1"}} + {{if and .LatestCommitUser.FullName DefaultShowFullName}} + <a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a> + {{else}} + <a class="muted author-wrapper" title="{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a> + {{end}} + {{else}} + {{if .LatestCommit.Author}} + {{ctx.AvatarUtils.AvatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24 "tw-mr-1"}} + <span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span> + {{end}} + {{end}} + <a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified}} isVerified{{if eq .LatestCommitVerification.TrustStatus "trusted"}}{{else if eq .LatestCommitVerification.TrustStatus "untrusted"}}Untrusted{{else}}Unmatched{{end}}{{else if .LatestCommitVerification.Warning}} isWarning{{end}}{{end}}" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}"> + <span class="shortsha">{{ShortSha .LatestCommit.ID.String}}</span> + {{if .LatestCommit.Signature}} + {{template "repo/shabox_badge" dict "root" $ "verification" .LatestCommitVerification}} + {{end}} + </a> + {{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">{{RenderCommitMessageLinkSubject $.Context .LatestCommit.Message $commitLink ($.Repository.ComposeMetas ctx)}}</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">{{RenderCommitBody $.Context .LatestCommit.Message ($.Repository.ComposeMetas ctx)}}</pre> + {{end}} + </span> +{{end}} diff --git a/templates/repo/migrate/codebase.tmpl b/templates/repo/migrate/codebase.tmpl new file mode 100644 index 00000000..1b5e8406 --- /dev/null +++ b/templates/repo/migrate/codebase.tmpl @@ -0,0 +1,120 @@ +{{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"> + {{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" .}} + + <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="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> + </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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/forgejo.tmpl b/templates/repo/migrate/forgejo.tmpl new file mode 100644 index 00000000..3caadbee --- /dev/null +++ b/templates/repo/migrate/forgejo.tmpl @@ -0,0 +1 @@ +{{template "repo/migrate/gitea" .}} diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl new file mode 100644 index 00000000..5ebf4cfd --- /dev/null +++ b/templates/repo/migrate/git.tmpl @@ -0,0 +1,94 @@ +{{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"> + {{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" .}} + + <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> + </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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/gitbucket.tmpl b/templates/repo/migrate/gitbucket.tmpl new file mode 100644 index 00000000..6d671777 --- /dev/null +++ b/templates/repo/migrate/gitbucket.tmpl @@ -0,0 +1,136 @@ +{{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"> + {{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" .}} + + <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"> + <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> + <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> + <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="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> + </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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/gitea.tmpl b/templates/repo/migrate/gitea.tmpl new file mode 100644 index 00000000..20d85c27 --- /dev/null +++ b/templates/repo/migrate/gitea.tmpl @@ -0,0 +1,132 @@ +{{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"> + {{.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://forgejo.org/docs/latest/user/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"> + <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> + <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> + <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="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> + + <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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/github.tmpl b/templates/repo/migrate/github.tmpl new file mode 100644 index 00000000..6e801b8c --- /dev/null +++ b/templates/repo/migrate/github.tmpl @@ -0,0 +1,134 @@ +{{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"> + {{.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> + + {{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"> + <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> + <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> + <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="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> + </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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/gitlab.tmpl b/templates/repo/migrate/gitlab.tmpl new file mode 100644 index 00000000..16457822 --- /dev/null +++ b/templates/repo/migrate/gitlab.tmpl @@ -0,0 +1,131 @@ +{{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"> + {{.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> + + {{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"> + <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> + <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> + <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="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> + </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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/gogs.tmpl b/templates/repo/migrate/gogs.tmpl new file mode 100644 index 00000000..312a4e9e --- /dev/null +++ b/templates/repo/migrate/gogs.tmpl @@ -0,0 +1,134 @@ +{{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"> + {{.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> + + {{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"> + <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> + <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> + <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="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> + + <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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/helper.tmpl b/templates/repo/migrate/helper.tmpl new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates/repo/migrate/helper.tmpl diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl new file mode 100644 index 00000000..c5c697ed --- /dev/null +++ b/templates/repo/migrate/migrate.tmpl @@ -0,0 +1,32 @@ +{{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"> + {{template "repo/migrate/helper" .}} + <div class="ui cards migrate-entries"> + {{range .Services}} + <a class="ui card migrate-entry tw-flex tw-items-center" href="{{AppSubUrl}}/repo/migrate?service_type={{.}}&org={{$.Org}}&mirror={{$.Mirror}}"> + {{if eq .Name "github"}} + {{svg "octicon-mark-github" 184 "tw-p-4"}} + {{else if eq .Name "gitlab"}} + {{svg "gitea-gitlab" 184 "tw-p-4"}} + {{else if eq .Name "gitbucket"}} + {{svg "gitea-gitbucket" 184 "tw-p-4"}} + {{else}} + {{svg (printf "gitea-%s" .Name) 184}} + {{end}} + <div class="content"> + <div class="header tw-text-center"> + {{.Title}} + </div> + <div class="description tw-text-center"> + {{ctx.Locale.Tr (printf "repo.migrate.%s.description" .Name)}} + </div> + </div> + </a> + {{end}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/migrating.tmpl b/templates/repo/migrate/migrating.tmpl new file mode 100644 index 00000000..0b536361 --- /dev/null +++ b/templates/repo/migrate/migrating.tmpl @@ -0,0 +1,101 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="ui grid"> + <div class="sixteen wide column content"> + {{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-task-id="{{.MigrateTask.ID}}"> + <div> + <img src="{{AssetUrlPrefix}}/img/forgejo-loading.svg" width="256" height="256"> + </div> + </div> + <div id="repo_migrating_failed_image" class="sixteen wide center aligned centered column tw-hidden"> + <div> + <span class="red">{{svg "octicon-git-pull-request-closed" 256 "ui red icon"}}</span> + </div> + </div> + </div> + <div class="ui stackable middle very relaxed page grid"> + <div class="sixteen wide center aligned centered column"> + <div id="repo_migrating_progress"> + <p>{{ctx.Locale.Tr "repo.migrate.migrating" .CloneAddr}}</p> + <p id="repo_migrating_progress_message"></p> + </div> + <div id="repo_migrating_failed" class="tw-hidden"> + {{if .CloneAddr}} + <p>{{ctx.Locale.Tr "repo.migrate.migrating_failed" .CloneAddr}}</p> + {{else}} + <p>{{ctx.Locale.Tr "repo.migrate.migrating_failed_no_addr"}}</p> + {{end}} + <p id="repo_migrating_failed_error"></p> + </div> + {{if .Permission.IsAdmin}} + <div class="divider"></div> + <div class="item"> + {{if .Failed}} + <button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{ctx.Locale.Tr "repo.settings.delete"}}</button> + {{else}} + <button class="ui basic show-modal button" data-modal="#cancel-repo-modal">{{ctx.Locale.Tr "cancel"}}</button> + {{end}} + <button id="repo_migrating_retry" data-migrating-task-retry-url="{{.Link}}/settings/migrate/retry" class="ui basic button tw-hidden">{{ctx.Locale.Tr "retry"}}</button> + </div> + {{end}} + </div> + </div> + </div> + </div> + </div> + </div> +</div> + +<div class="ui small modal" id="delete-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.delete"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br> + {{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName}} + {{if .Repository.NumForks}}<br> + {{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}} + {{end}} + </div> + <form class="ui form" action="{{.Link}}/settings" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="delete"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label for="repo_name_to_delete">{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input id="repo_name_to_delete" name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button> + </div> + </form> + </div> +</div> + +<div class="ui g-modal-confirm modal" id="cancel-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.migrate.cancel_migrating_title"}} + </div> + <form action="{{.Link}}/settings/migrate/cancel" method="post"> + {{.CsrfTokenHtml}} + <div class="content"> + {{ctx.Locale.Tr "repo.migrate.cancel_migrating_confirm"}} + </div> + {{template "base/modal_actions_confirm" .}} + </form> +</div> + +{{template "base/footer" .}} diff --git a/templates/repo/migrate/onedev.tmpl b/templates/repo/migrate/onedev.tmpl new file mode 100644 index 00000000..a5a216c6 --- /dev/null +++ b/templates/repo/migrate/onedev.tmpl @@ -0,0 +1,120 @@ +{{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"> + {{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" .}} + + <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="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> + </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"> + <input name="private" type="checkbox" + {{if .IsForcedPrivate}} + checked disabled + {{else}} + {{if .private}}checked{{end}} + {{end}}> + <label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label> + </div> + {{if .IsForcedPrivate}} + <span class="help">{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</span> + {{end}} + <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" 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> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/migrate/options.tmpl b/templates/repo/migrate/options.tmpl new file mode 100644 index 00000000..8a46e576 --- /dev/null +++ b/templates/repo/migrate/options.tmpl @@ -0,0 +1,26 @@ +{{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 .LFSActive}} +<div class="inline field"> + <label></label> + <div class="ui checkbox"> + <input id="lfs" name="lfs" type="checkbox" {{if .lfs}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.migrate_options_lfs"}}</label> + </div> + <span id="lfs_settings" class="tw-hidden">(<a id="lfs_settings_show" href="#">{{ctx.Locale.Tr "repo.settings.advanced_settings"}}</a>)</span> +</div> +<div id="lfs_endpoint" class="tw-hidden"> + <span class="help">{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.description.local"}}{{end}}</span> + <div class="inline field {{if .Err_LFSEndpoint}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.label"}}</label> + <input name="lfs_endpoint" value="{{.lfs_endpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}"> + </div> +</div> +{{end}} diff --git a/templates/repo/navbar.tmpl b/templates/repo/navbar.tmpl new file mode 100644 index 00000000..b2471dc1 --- /dev/null +++ b/templates/repo/navbar.tmpl @@ -0,0 +1,14 @@ +<div class="ui fluid vertical menu"> + <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> +</div> diff --git a/templates/repo/packages.tmpl b/templates/repo/packages.tmpl new file mode 100644 index 00000000..14e32c12 --- /dev/null +++ b/templates/repo/packages.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository packages"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "package/shared/list" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl new file mode 100644 index 00000000..9eae401f --- /dev/null +++ b/templates/repo/projects/list.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository projects milestones"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "projects/list" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/projects/new.tmpl b/templates/repo/projects/new.tmpl new file mode 100644 index 00000000..e70f3bca --- /dev/null +++ b/templates/repo/projects/new.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository projects edit-project new milestone"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "projects/new" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl new file mode 100644 index 00000000..05ad7264 --- /dev/null +++ b/templates/repo/projects/view.tmpl @@ -0,0 +1,15 @@ +{{template "base/head" .}} +<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" .}} + <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> +</div> + +{{template "base/footer" .}} diff --git a/templates/repo/pulls/commits.tmpl b/templates/repo/pulls/commits.tmpl new file mode 100644 index 00000000..bf6e8128 --- /dev/null +++ b/templates/repo/pulls/commits.tmpl @@ -0,0 +1,10 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository view issue pull commits"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "repo/issue/view_title" .}} + {{template "repo/pulls/tab_menu" .}} + {{template "repo/commits_table" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/pulls/files.tmpl b/templates/repo/pulls/files.tmpl new file mode 100644 index 00000000..402bec80 --- /dev/null +++ b/templates/repo/pulls/files.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .}} + +<input type="hidden" id="repolink" value="{{$.RepoRelPath}}"> +<input type="hidden" id="issueIndex" value="{{.Issue.Index}}"> + +<div role="main" aria-label="{{.Title}}" class="page-content repository view issue pull files diff"> + {{template "repo/header" .}} + <div class="ui container fluid padded"> + {{template "repo/issue/view_title" .}} + {{template "repo/pulls/tab_menu" .}} + {{template "repo/diff/box" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl new file mode 100644 index 00000000..2cf0a85f --- /dev/null +++ b/templates/repo/pulls/fork.tmpl @@ -0,0 +1,90 @@ +{{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"> + {{.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> + </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> + <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> + <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"> + <input type="hidden" id="fork_single_branch" name="fork_single_branch" value="" required> + <span class="text truncated-item-container" data-value="" title="{{ctx.Locale.Tr "repo.all_branches"}}"> + <span class="truncated-item-name">{{ctx.Locale.Tr "repo.all_branches"}}</span> + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item truncated-item-container" data-value="" title="{{ctx.Locale.Tr "repo.all_branches"}}"> + <span class="truncated-item-name">{{ctx.Locale.Tr "repo.all_branches"}}</span> + </div> + {{range .Branches}} + <div class="item truncated-item-container" data-value="{{.}}" title="{{.}}"> + <span class="truncated-item-name">{{.}}</span> + </div> + {{end}} + </div> + </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> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/pulls/status.tmpl b/templates/repo/pulls/status.tmpl new file mode 100644 index 00000000..e8636ba1 --- /dev/null +++ b/templates/repo/pulls/status.tmpl @@ -0,0 +1,59 @@ +{{/* +Template Attributes: +* CommitStatus: summary of all commit status state +* CommitStatuses: all commit status elements +* MissingRequiredChecks: commit check contexts that are required by branch protection but not present +* ShowHideChecks: whether use a button to show/hide the checks +* is_context_required: Used in pull request commit status check table +*/}} + +{{if .CommitStatus}} +<div class="commit-status-panel"> + <div class="ui top attached header commit-status-header"> + {{if or (eq .CommitStatus.State "pending") (.MissingRequiredChecks)}} + {{ctx.Locale.Tr "repo.pulls.status_checking"}} + {{else if eq .CommitStatus.State "success"}} + {{ctx.Locale.Tr "repo.pulls.status_checks_success"}} + {{else if eq .CommitStatus.State "warning"}} + {{ctx.Locale.Tr "repo.pulls.status_checks_warning"}} + {{else if eq .CommitStatus.State "failure"}} + {{ctx.Locale.Tr "repo.pulls.status_checks_failure"}} + {{else if eq .CommitStatus.State "error"}} + {{ctx.Locale.Tr "repo.pulls.status_checks_error"}} + {{else}} + {{ctx.Locale.Tr "repo.pulls.status_checking"}} + {{end}} + + {{if .ShowHideChecks}} + <div class="ui right"> + <button class="commit-status-hide-checks btn interact-fg" + data-show-all="{{ctx.Locale.Tr "repo.pulls.status_checks_show_all"}}" + data-hide-all="{{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}"> + {{ctx.Locale.Tr "repo.pulls.status_checks_hide_all"}}</button> + </div> + {{end}} + </div> + + <div class="commit-status-list"> + {{range .CommitStatuses}} + <div class="commit-status-item"> + {{template "repo/commit_status" .}} + <div class="status-context gt-ellipsis">{{.Context}} <span class="text light-2">{{.Description}}</span></div> + <div class="ui status-details"> + {{if $.is_context_required}} + {{if (call $.is_context_required .Context)}}<div class="ui label">{{ctx.Locale.Tr "repo.pulls.status_checks_requested"}}</div>{{end}} + {{end}} + <span>{{if .TargetURL}}<a href="{{.TargetURL}}">{{ctx.Locale.Tr "repo.pulls.status_checks_details"}}</a>{{end}}</span> + </div> + </div> + {{end}} + {{range .MissingRequiredChecks}} + <div class="commit-status-item"> + {{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}} + <div class="status-context gt-ellipsis">{{.}}</div> + <div class="ui label">{{ctx.Locale.Tr "repo.pulls.status_checks_requested"}}</div> + </div> + {{end}} + </div> +</div> +{{end}} diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl new file mode 100644 index 00000000..d5a8d6ed --- /dev/null +++ b/templates/repo/pulls/tab_menu.tmpl @@ -0,0 +1,28 @@ +<div class="ui pull tabs container"> + <div class="ui top attached pull tabular menu"> + <a class="item {{if .PageIsPullConversation}}active{{end}}" href="{{.Issue.Link}}"> + {{svg "octicon-comment-discussion"}} + {{ctx.Locale.Tr "repo.pulls.tab_conversation"}} + <span class="ui small label">{{.Issue.NumComments}}</span> + </a> + <a class="item {{if .PageIsPullCommits}}active{{end}}" {{if .NumCommits}}href="{{.Issue.Link}}/commits"{{end}}> + {{svg "octicon-git-commit"}} + {{ctx.Locale.Tr "repo.pulls.tab_commits"}} + <span class="ui small label">{{if .NumCommits}}{{.NumCommits}}{{else}}-{{end}}</span> + </a> + <a class="item {{if .PageIsPullFiles}}active{{end}}" href="{{.Issue.Link}}/files"> + {{svg "octicon-diff"}} + {{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}} + <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 class="diff-stats-bar"> + <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div> + </span> + </span> + {{end}} + </div> + <div class="ui tabs divider"></div> +</div> diff --git a/templates/repo/pulse.tmpl b/templates/repo/pulse.tmpl new file mode 100644 index 00000000..47902085 --- /dev/null +++ b/templates/repo/pulse.tmpl @@ -0,0 +1,231 @@ +<h2 class="ui header activity-header"> + <span>{{DateTime "long" .DateFrom}} - {{DateTime "long" .DateUntil}}</span> + <!-- Period --> + <div class="ui floating dropdown jump filter"> + <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"> + <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> + <a class="{{if eq .Period "monthly"}}active {{end}}item" href="{{$.RepoLink}}/activity/monthly">{{ctx.Locale.Tr "repo.activity.period.monthly"}}</a> + <a class="{{if eq .Period "quarterly"}}active {{end}}item" href="{{$.RepoLink}}/activity/quarterly">{{ctx.Locale.Tr "repo.activity.period.quarterly"}}</a> + <a class="{{if eq .Period "semiyearly"}}active {{end}}item" href="{{$.RepoLink}}/activity/semiyearly">{{ctx.Locale.Tr "repo.activity.period.semiyearly"}}</a> + <a class="{{if eq .Period "yearly"}}active {{end}}item" href="{{$.RepoLink}}/activity/yearly">{{ctx.Locale.Tr "repo.activity.period.yearly"}}</a> + </div> + </div> +</h2> + +{{if (or (.Permission.CanRead $.UnitTypeIssues) (.Permission.CanRead $.UnitTypePullRequests))}} +<h4 class="ui top attached header">{{ctx.Locale.Tr "repo.activity.overview"}}</h4> +<div class="ui attached segment two column grid"> + {{if .Permission.CanRead $.UnitTypePullRequests}} + <div class="column"> + {{if gt .Activity.ActivePRCount 0}} + <div class="stats-table"> + {{if gt .Activity.MergedPRPerc 0}} + <a href="#merged-pull-requests" class="table-cell tiny tw-bg-purple" style="width: {{.Activity.MergedPRPerc}}%"></a> + {{end}} + <a href="#proposed-pull-requests" class="table-cell tiny tw-bg-green"></a> + </div> + {{else}} + <div class="stats-table"> + <a class="table-cell tiny tw-bg-grey"></a> + </div> + {{end}} + {{ctx.Locale.TrN .Activity.ActivePRCount "repo.activity.active_prs_count_1" "repo.activity.active_prs_count_n" .Activity.ActivePRCount}} + </div> + {{end}} + {{if .Permission.CanRead $.UnitTypeIssues}} + <div class="column"> + {{if gt .Activity.ActiveIssueCount 0}} + <div class="stats-table"> + {{if gt .Activity.ClosedIssuePerc 0}} + <a href="#closed-issues" class="table-cell tiny tw-bg-red" style="width: {{.Activity.ClosedIssuePerc}}%"></a> + {{end}} + <a href="#new-issues" class="table-cell tiny tw-bg-green"></a> + </div> + {{else}} + <div class="stats-table"> + <a class="table-cell tiny background light grey"></a> + </div> + {{end}} + {{ctx.Locale.TrN .Activity.ActiveIssueCount "repo.activity.active_issues_count_1" "repo.activity.active_issues_count_n" .Activity.ActiveIssueCount}} + </div> + {{end}} +</div> +<div class="ui attached segment horizontal segments"> + {{if .Permission.CanRead $.UnitTypePullRequests}} + <a href="#merged-pull-requests" class="ui attached segment text center"> + <span class="text purple">{{svg "octicon-git-pull-request"}}</span> <strong>{{.Activity.MergedPRCount}}</strong><br> + {{ctx.Locale.TrN .Activity.MergedPRCount "repo.activity.merged_prs_count_1" "repo.activity.merged_prs_count_n"}} + </a> + <a href="#proposed-pull-requests" class="ui attached segment text center"> + <span class="text green">{{svg "octicon-git-branch"}}</span> <strong>{{.Activity.OpenedPRCount}}</strong><br> + {{ctx.Locale.TrN .Activity.OpenedPRCount "repo.activity.opened_prs_count_1" "repo.activity.opened_prs_count_n"}} + </a> + {{end}} + {{if .Permission.CanRead $.UnitTypeIssues}} + <a href="#closed-issues" class="ui attached segment text center"> + <span class="text red">{{svg "octicon-issue-closed"}}</span> <strong>{{.Activity.ClosedIssueCount}}</strong><br> + {{ctx.Locale.TrN .Activity.ClosedIssueCount "repo.activity.closed_issues_count_1" "repo.activity.closed_issues_count_n"}} + </a> + <a href="#new-issues" class="ui attached segment text center"> + <span class="text green">{{svg "octicon-issue-opened"}}</span> <strong>{{.Activity.OpenedIssueCount}}</strong><br> + {{ctx.Locale.TrN .Activity.OpenedIssueCount "repo.activity.new_issues_count_1" "repo.activity.new_issues_count_n"}} + </a> + {{end}} +</div> +{{end}} + +{{if .Permission.CanRead $.UnitTypeCode}} + {{if eq .Activity.Code.CommitCountInAllBranches 0}} + <div class="ui center aligned segment"> + <h4 class="ui header">{{ctx.Locale.Tr "repo.activity.no_git_activity"}}</h4> + </div> + {{end}} + {{if gt .Activity.Code.CommitCountInAllBranches 0}} + <div class="ui attached segment horizontal segments"> + <div class="ui attached segment text"> + {{ctx.Locale.Tr "repo.activity.git_stats_exclude_merges"}} + <strong>{{ctx.Locale.TrN .Activity.Code.AuthorCount "repo.activity.git_stats_author_1" "repo.activity.git_stats_author_n" .Activity.Code.AuthorCount}}</strong> + {{ctx.Locale.TrN .Activity.Code.AuthorCount "repo.activity.git_stats_pushed_1" "repo.activity.git_stats_pushed_n"}} + <strong>{{ctx.Locale.TrN .Activity.Code.CommitCount "repo.activity.git_stats_commit_1" "repo.activity.git_stats_commit_n" .Activity.Code.CommitCount}}</strong> + {{ctx.Locale.Tr "repo.activity.git_stats_push_to_branch" .Repository.DefaultBranch}} + <strong>{{ctx.Locale.TrN .Activity.Code.CommitCountInAllBranches "repo.activity.git_stats_commit_1" "repo.activity.git_stats_commit_n" .Activity.Code.CommitCountInAllBranches}}</strong> + {{ctx.Locale.Tr "repo.activity.git_stats_push_to_all_branches"}} + {{ctx.Locale.Tr "repo.activity.git_stats_on_default_branch" .Repository.DefaultBranch}} + <strong>{{ctx.Locale.TrN .Activity.Code.ChangedFiles "repo.activity.git_stats_file_1" "repo.activity.git_stats_file_n" .Activity.Code.ChangedFiles}}</strong> + {{ctx.Locale.TrN .Activity.Code.ChangedFiles "repo.activity.git_stats_files_changed_1" "repo.activity.git_stats_files_changed_n"}} + {{ctx.Locale.Tr "repo.activity.git_stats_additions"}} + <strong class="text green">{{ctx.Locale.TrN .Activity.Code.Additions "repo.activity.git_stats_addition_1" "repo.activity.git_stats_addition_n" .Activity.Code.Additions}}</strong> + {{ctx.Locale.Tr "repo.activity.git_stats_and_deletions"}} + <strong class="text red">{{ctx.Locale.TrN .Activity.Code.Deletions "repo.activity.git_stats_deletion_1" "repo.activity.git_stats_deletion_n" .Activity.Code.Deletions}}</strong>. + </div> + <div class="ui attached segment"> + <div id="repo-activity-top-authors-chart" data-locale-commit-activity="{{ctx.Locale.Tr "repo.activity.commit"}}"></div> + </div> + </div> + {{end}} +{{end}} + +{{if gt .Activity.PublishedReleaseCount 0}} + <h4 class="divider divider-text" id="published-releases"> + {{svg "octicon-tag" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.activity.title.releases_published_by" + (ctx.Locale.TrN .Activity.PublishedReleaseCount "repo.activity.title.releases_1" "repo.activity.title.releases_n" .Activity.PublishedReleaseCount) + (ctx.Locale.TrN .Activity.PublishedReleaseAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.PublishedReleaseAuthorCount) + }} + </h4> + <div class="list"> + {{range .Activity.PublishedReleases}} + <p class="desc"> + <span class="ui green label">{{ctx.Locale.Tr "repo.activity.published_release_label"}}</span> + {{.TagName}} + {{if not .IsTag}} + <a class="title" href="{{$.RepoLink}}/src/{{.TagName | PathEscapeSegments}}">{{.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{end}} + {{TimeSinceUnix .CreatedUnix ctx.Locale}} + </p> + {{end}} + </div> +{{end}} + +{{if gt .Activity.MergedPRCount 0}} + <h4 class="divider divider-text" id="merged-pull-requests"> + {{svg "octicon-git-pull-request" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.activity.title.prs_merged_by" + (ctx.Locale.TrN .Activity.MergedPRCount "repo.activity.title.prs_1" "repo.activity.title.prs_n" .Activity.MergedPRCount) + (ctx.Locale.TrN .Activity.MergedPRAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.MergedPRAuthorCount) + }} + </h4> + <div class="list"> + {{range .Activity.MergedPRs}} + <p class="desc"> + <span class="ui purple label">{{ctx.Locale.Tr "repo.activity.merged_prs_label"}}</span> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{TimeSinceUnix .MergedUnix ctx.Locale}} + </p> + {{end}} + </div> +{{end}} + +{{if gt .Activity.OpenedPRCount 0}} + <h4 class="divider divider-text" id="proposed-pull-requests"> + {{svg "octicon-git-branch" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.activity.title.prs_opened_by" + (ctx.Locale.TrN .Activity.OpenedPRCount "repo.activity.title.prs_1" "repo.activity.title.prs_n" .Activity.OpenedPRCount) + (ctx.Locale.TrN .Activity.OpenedPRAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.OpenedPRAuthorCount) + }} + </h4> + <div class="list"> + {{range .Activity.OpenedPRs}} + <p class="desc"> + <span class="ui green label">{{ctx.Locale.Tr "repo.activity.opened_prs_label"}}</span> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Issue.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{TimeSinceUnix .Issue.CreatedUnix ctx.Locale}} + </p> + {{end}} + </div> +{{end}} + +{{if gt .Activity.ClosedIssueCount 0}} + <h4 class="divider divider-text" id="closed-issues"> + {{svg "octicon-issue-closed" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.activity.title.issues_closed_from" + (ctx.Locale.TrN .Activity.ClosedIssueCount "repo.activity.title.issues_1" "repo.activity.title.issues_n" .Activity.ClosedIssueCount) + (ctx.Locale.TrN .Activity.ClosedIssueAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.ClosedIssueAuthorCount) + }} + </h4> + <div class="list"> + {{range .Activity.ClosedIssues}} + <p class="desc"> + <span class="ui red label">{{ctx.Locale.Tr "repo.activity.closed_issue_label"}}</span> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{TimeSinceUnix .ClosedUnix ctx.Locale}} + </p> + {{end}} + </div> +{{end}} + +{{if gt .Activity.OpenedIssueCount 0}} + <h4 class="divider divider-text" id="new-issues"> + {{svg "octicon-issue-opened" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.activity.title.issues_created_by" + (ctx.Locale.TrN .Activity.OpenedIssueCount "repo.activity.title.issues_1" "repo.activity.title.issues_n" .Activity.OpenedIssueCount) + (ctx.Locale.TrN .Activity.OpenedIssueAuthorCount "repo.activity.title.user_1" "repo.activity.title.user_n" .Activity.OpenedIssueAuthorCount) + }} + </h4> + <div class="list"> + {{range .Activity.OpenedIssues}} + <p class="desc"> + <span class="ui green label">{{ctx.Locale.Tr "repo.activity.new_issue_label"}}</span> + #{{.Index}} <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{TimeSinceUnix .CreatedUnix ctx.Locale}} + </p> + {{end}} + </div> +{{end}} + +{{if gt .Activity.UnresolvedIssueCount 0}} + <h4 class="divider divider-text" id="unresolved-conversations" data-tooltip-content="{{ctx.Locale.Tr "repo.activity.unresolved_conv_desc"}}"> + {{svg "octicon-comment-discussion" 16 "tw-mr-2"}} + {{ctx.Locale.TrN .Activity.UnresolvedIssueCount "repo.activity.title.unresolved_conv_1" "repo.activity.title.unresolved_conv_n" .Activity.UnresolvedIssueCount}} + </h4> + <div class="list"> + {{range .Activity.UnresolvedIssues}} + <p class="desc"> + <span class="ui green label">{{ctx.Locale.Tr "repo.activity.unresolved_conv_label"}}</span> + #{{.Index}} + {{if .IsPull}} + <a class="title" href="{{$.RepoLink}}/pulls/{{.Index}}">{{.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{else}} + <a class="title" href="{{$.RepoLink}}/issues/{{.Index}}">{{.Title | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{end}} + {{TimeSinceUnix .UpdatedUnix ctx.Locale}} + </p> + {{end}} + </div> +{{end}} diff --git a/templates/repo/recent_commits.tmpl b/templates/repo/recent_commits.tmpl new file mode 100644 index 00000000..5c241d63 --- /dev/null +++ b/templates/repo/recent_commits.tmpl @@ -0,0 +1,9 @@ +{{if .Permission.CanRead $.UnitTypeCode}} + <div id="repo-recent-commits-chart" + data-locale-loading-title="{{ctx.Locale.Tr "graphs.component_loading" (ctx.Locale.Tr "graphs.recent_commits.what")}}" + data-locale-loading-title-failed="{{ctx.Locale.Tr "graphs.component_loading_failed" (ctx.Locale.Tr "graphs.recent_commits.what")}}" + data-locale-loading-info="{{ctx.Locale.Tr "graphs.component_loading_info"}}" + data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}" + > + </div> +{{end}} diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl new file mode 100644 index 00000000..bcb71e5f --- /dev/null +++ b/templates/repo/release/list.tmpl @@ -0,0 +1,130 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository releases"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{template "repo/release_tag_header" .}} + <ul id="release-list"> + {{range $idx, $info := .Releases}} + {{$release := $info.Release}} + <li class="ui grid"> + <div class="ui four wide column meta"> + <a class="muted" href="{{if not (and $release.Sha1 ($.Permission.CanRead $.UnitTypeCode))}}#{{else}}{{$.RepoLink}}/src/tag/{{$release.TagName | PathEscapeSegments}}{{end}}" rel="nofollow">{{svg "octicon-tag" 16 "tw-mr-1"}}{{$release.TagName}}</a> + {{if and $release.Sha1 ($.Permission.CanRead $.UnitTypeCode)}} + <a class="muted tw-font-mono" href="{{$.RepoLink}}/src/commit/{{$release.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha $release.Sha1}}</a> + {{template "repo/branch_dropdown" dict "root" $ "release" $release}} + {{end}} + </div> + <div class="ui twelve wide column detail"> + <div class="tw-flex tw-items-center tw-justify-between tw-flex-wrap tw-mb-2"> + <h4 class="release-list-title tw-break-anywhere"> + <a href="{{$.RepoLink}}/releases/tag/{{$release.TagName | PathEscapeSegments}}">{{$release.Title}}</a> + {{template "repo/commit_statuses" dict "Status" $info.CommitStatus "Statuses" $info.CommitStatuses "AdditionalClasses" "tw-flex"}} + {{if $release.IsDraft}} + <span class="ui yellow label">{{ctx.Locale.Tr "repo.release.draft"}}</span> + {{else if $release.IsPrerelease}} + <span class="ui orange label">{{ctx.Locale.Tr "repo.release.prerelease"}}</span> + {{else if (not $release.IsTag)}} + <span class="ui green label">{{ctx.Locale.Tr "repo.release.stable"}}</span> + {{end}} + </h4> + <div> + {{if $.CanCreateRelease}} + <a class="muted" data-tooltip-content="{{ctx.Locale.Tr "repo.release.edit"}}" href="{{$.RepoLink}}/releases/edit/{{$release.TagName | PathEscapeSegments}}" rel="nofollow"> + {{svg "octicon-pencil"}} + </a> + {{end}} + </div> + </div> + <p class="text grey"> + <span class="author"> + {{if $release.OriginalAuthor}} + {{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> + {{else}} + Ghost + {{end}} + </span> + <span class="released"> + {{ctx.Locale.Tr "repo.released_this"}} + </span> + {{if $release.CreatedUnix}} + <span class="time">{{TimeSinceUnix $release.CreatedUnix ctx.Locale}}</span> + {{end}} + {{if and (not $release.IsDraft) ($.Permission.CanRead $.UnitTypeCode)}} + | <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> + {{template "repo/tag/verification_line" (dict "ctxData" $ "release" $release)}} + <div class="markup desc"> + {{$release.RenderedNote}} + </div> + {{$hasReleaseAttachment := gt (len $release.Attachments) 0}} + {{$hasArchiveLinks := and (not $.DisableDownloadSourceArchives) (not $release.IsDraft) (not $release.HideArchiveLinks) ($.Permission.CanRead $.UnitTypeCode)}} + {{if or $hasArchiveLinks $hasReleaseAttachment}} + <div class="divider"></div> + <details class="download" {{if eq $idx 0}}open{{end}}> + <summary class="tw-my-4"> + {{ctx.Locale.Tr "repo.release.downloads"}} + </summary> + <ul class="list"> + {{if $hasArchiveLinks}} + <li> + <a class="archive-link tw-flex-1" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong></a> + <div class="tw-mr-1"> + <span class="text grey">{{ctx.Locale.TrN .Release.ArchiveDownloadCount.Zip "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .Release.ArchiveDownloadCount.Zip)}}</span> + </div> + <span data-tooltip-content="{{ctx.Locale.Tr "repo.release.system_generated"}}"> + {{svg "octicon-info"}} + </span> + </li> + <li class="{{if $hasReleaseAttachment}}start-gap{{end}}"> + <a class="archive-link tw-flex-1" href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong></a> + <div class="tw-mr-1"> + <span class="text grey">{{ctx.Locale.TrN .Release.ArchiveDownloadCount.TarGz "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .Release.ArchiveDownloadCount.TarGz)}}</span> + </div> + <span data-tooltip-content="{{ctx.Locale.Tr "repo.release.system_generated"}}"> + {{svg "octicon-info"}} + </span> + </li> + {{if $hasReleaseAttachment}}<hr>{{end}} + {{end}} + {{range $release.Attachments}} + <li> + <a target="_blank" rel="nofollow" href="{{.DownloadURL}}" download> + <strong>{{svg "octicon-package" 16 "tw-mr-1"}}{{.Name}}</strong> + </a> + <div> + <span class="text grey">{{ctx.Locale.TrN .DownloadCount "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .DownloadCount)}} · {{.Size | ctx.Locale.TrSize}}</span> + </div> + </li> + {{end}} + </ul> + </details> + {{end}} + <div class="dot"></div> + </div> + </li> + {{end}} + </ul> + + {{template "base/paginate" .}} + </div> +</div> + +{{if (and ($.Permission.CanWrite $.UnitTypeCode) .PageIsTagList)}} + <div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.release.delete_tag"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.release.deletion_tag_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +{{end}} + +{{template "base/footer" .}} diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl new file mode 100644 index 00000000..b653fc0c --- /dev/null +++ b/templates/repo/release/new.tmpl @@ -0,0 +1,157 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository new release"> + {{template "repo/header" .}} + <div class="ui container"> + <h2 class="ui dividing header"> + {{if .PageIsEditRelease}} + {{ctx.Locale.Tr "repo.release.edit_release"}} + <div class="sub header">{{ctx.Locale.Tr "repo.release.edit_subheader"}}</div> + {{else}} + {{ctx.Locale.Tr "repo.release.new_release"}} + <div class="sub header">{{ctx.Locale.Tr "repo.release.new_subheader"}}</div> + {{end}} + </h2> + {{template "base/alert" .}} + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="ui seven wide target"> + <div class="inline field {{if .Err_TagName}}error{{end}}"> + {{if .PageIsEditRelease}} + <b>{{.tag_name}}</b><span class="at">@</span><strong>{{.tag_target}}</strong> + {{else}} + <input id="tag-name" name="tag_name" value="{{.tag_name}}" aria-label="{{ctx.Locale.Tr "repo.release.tag_name"}}" placeholder="{{ctx.Locale.Tr "repo.release.tag_name"}}" autofocus required maxlength="255"> + <input id="tag-name-editor" type="hidden" data-existing-tags="{{JsonUtils.EncodeToString .Tags}}" data-tag-helper="{{ctx.Locale.Tr "repo.release.tag_helper"}}" data-tag-helper-new="{{ctx.Locale.Tr "repo.release.tag_helper_new"}}" data-tag-helper-existing="{{ctx.Locale.Tr "repo.release.tag_helper_existing"}}"> + <div id="tag-target-selector" class="tw-inline-block"> + <span class="at">@</span> + <div class="ui selection dropdown"> + <input type="hidden" name="tag_target" value="{{.tag_target}}"> + {{svg "octicon-git-branch"}} + <div class="text"> + {{ctx.Locale.Tr "repo.release.target"}} : + <strong id="repo-branch-current">{{.Repository.DefaultBranch}}</strong> + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range .Branches}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + </div> + <div> + <span id="tag-helper" class="help tw-mt-2 tw-pb-0">{{ctx.Locale.Tr "repo.release.tag_helper"}}</span> + </div> + {{end}} + </div> + </div> + <div class="eleven wide tw-pt-0"> + <div class="field {{if .Err_Title}}error{{end}}"> + <input name="title" aria-label="{{ctx.Locale.Tr "repo.release.title"}}" placeholder="{{ctx.Locale.Tr "repo.release.title"}}" value="{{.title}}" autofocus maxlength="255"> + </div> + <div class="field"> + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewUrl" (print .Repository.Link "/markup") + "MarkdownPreviewContext" .RepoLink + "TextareaName" "content" + "TextareaContent" .content + "TextareaPlaceholder" (ctx.Locale.Tr "repo.release.message") + "TextareaAriaLabel" (ctx.Locale.Tr "repo.release.message") + "DropzoneParentContainer" "form" + "EasyMDE" true + )}} + </div> + {{range .attachments}} + <div class="field flex-text-block" id="attachment-{{.ID}}"> + <div class="flex-text-inline tw-flex-1"> + <input name="attachment-edit-{{.UUID}}" class="attachment_edit" required value="{{.Name}}"> + <input name="attachment-del-{{.UUID}}" type="hidden" value="false"> + <span class="ui text grey tw-whitespace-nowrap">{{ctx.Locale.TrN .DownloadCount "repo.release.download_count_one" "repo.release.download_count_few" (ctx.Locale.PrettyNumber .DownloadCount)}} · {{.Size | ctx.Locale.TrSize}}</span> + </div> + <a class="ui mini compact red button remove-rel-attach" data-id="{{.ID}}" data-uuid="{{.UUID}}"> + {{ctx.Locale.Tr "remove"}} + </a> + </div> + {{end}} + {{if .IsAttachmentEnabled}} + <div class="field"> + {{template "repo/upload" .}} + </div> + {{end}} + </div> + <div class="divider"></div> + <div class="ui"> + <div> + {{if not .PageIsEditRelease}} + <div class="tag-message field"> + <div class="ui checkbox"> + <input type="checkbox" name="add_tag_msg"> + <label><strong>{{ctx.Locale.Tr "repo.release.add_tag_msg"}}</strong></label> + </div> + </div> + {{else}} + <input type="hidden" name="add_tag_msg" value="false"> + {{end}} + <div class="prerelease field"> + <div class="ui checkbox"> + <input type="checkbox" name="prerelease" {{if .prerelease}}checked{{end}}> + <label><strong>{{ctx.Locale.Tr "repo.release.prerelease_desc"}}</strong></label> + </div> + </div> + <span class="help">{{ctx.Locale.Tr "repo.release.prerelease_helper"}}</span> + {{if not .DisableDownloadSourceArchives}} + <div class="field"> + <div class="ui checkbox"> + <input type="checkbox" name="hide_archive_links" {{if .hide_archive_links}}checked{{end}}> + <label><strong>{{ctx.Locale.Tr "repo.release.hide_archive_links"}}</strong></label> + </div> + </div> + <span class="help">{{ctx.Locale.Tr "repo.release.hide_archive_links_helper"}}</span> + {{end}} + <div class="divider tw-mt-0"></div> + <div class="tw-flex tw-justify-end button-row"> + {{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}}"> + {{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> + {{else}} + <button class="ui small primary button"> + {{ctx.Locale.Tr "repo.release.edit_release"}} + </button> + {{end}} + {{else}} + {{if not .tag_name}} + <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> + {{end}} + </div> + </div> + </div> + </form> + </div> +</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> + {{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 new file mode 100644 index 00000000..dafe9f2f --- /dev/null +++ b/templates/repo/release_tag_header.tmpl @@ -0,0 +1,31 @@ +{{$canReadReleases := $.Permission.CanRead $.UnitTypeReleases}} +{{$canReadCode := $.Permission.CanRead $.UnitTypeCode}} + +{{if $canReadReleases}} + <div class="tw-flex"> + <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.TrN .NumReleases "repo.n_release_one" "repo.n_release_few" (ctx.Locale.PrettyNumber .NumReleases)}}</a> + {{if $canReadCode}} + <a class="{{if or .PageIsTagList .PageIsSingleTag}}active {{end}}item" href="{{.RepoLink}}/tags">{{ctx.Locale.TrN .NumTags "repo.n_tag_one" "repo.n_tag_few" (ctx.Locale.PrettyNumber .NumTags)}}</a> + {{end}} + </h2> + </div> + <div class="button-row"> + {{if .EnableFeed}} + <a class="ui small button" href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss"> + {{svg "octicon-rss" 16}} {{ctx.Locale.Tr "rss_feed"}} + </a> + {{end}} + {{if and (not .PageIsTagList) .CanCreateRelease}} + <a class="ui small primary button" href="{{$.RepoLink}}/releases/new"> + {{ctx.Locale.Tr "repo.release.new_release"}} + </a> + {{end}} + </div> + </div> + <div class="divider"></div> +{{else if $canReadCode}} + {{/* if the "repo.releases" unit is disabled, only show the "commits / branches / tags" sub menu */}} + {{template "repo/sub_menu" .}} +{{end}} diff --git a/templates/repo/search.tmpl b/templates/repo/search.tmpl new file mode 100644 index 00000000..6d114c81 --- /dev/null +++ b/templates/repo/search.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository file list"> + {{template "repo/header" .}} + <div class="ui container"> + {{if $.CodeIndexerDisabled}} + {{$branchURLPrefix := printf "%s/search/branch/" $.RepoLink}} + {{$tagURLPrefix := printf "%s/search/tag/" $.RepoLink}} + {{$suffix := printf "?q=%s&fuzzy=%t" (.Keyword|QueryEscape) .IsFuzzy}} + {{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mb-3" "branchURLPrefix" $branchURLPrefix "branchURLSuffix" $suffix "tagURLPrefix" $tagURLPrefix "tagURLSuffix" $suffix}} + {{end}} + {{template "shared/search/code/search" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/search_name.tmpl b/templates/repo/search_name.tmpl new file mode 100644 index 00000000..951f1688 --- /dev/null +++ b/templates/repo/search_name.tmpl @@ -0,0 +1 @@ +<span class="gt-ellipsis">{{.Name}}{{if DefaultShowFullName}}<span class="search-fullname"> {{.FullName}}</span>{{end}}</span> diff --git a/templates/repo/settings/actions.tmpl b/templates/repo/settings/actions.tmpl new file mode 100644 index 00000000..f38ab5b6 --- /dev/null +++ b/templates/repo/settings/actions.tmpl @@ -0,0 +1,11 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings actions")}} + <div class="repo-setting-content"> + {{if eq .PageType "runners"}} + {{template "shared/actions/runner_list" .}} + {{else if eq .PageType "secrets"}} + {{template "shared/secrets/add_list" .}} + {{else if eq .PageType "variables"}} + {{template "shared/variables/variable_list" .}} + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl new file mode 100644 index 00000000..52c0c2c8 --- /dev/null +++ b/templates/repo/settings/branches.tmpl @@ -0,0 +1,78 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings edit")}} + <div class="repo-setting-content"> + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{ctx.Locale.Tr "repo.settings.archive.branchsettings_unavailable"}} + </div> + {{else}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.default_branch"}} + </h4> + <div class="ui attached segment"> + <p> + {{ctx.Locale.Tr "repo.settings.default_branch_desc"}} + </p> + <form class="tw-flex" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="default_branch"> + {{if not .Repository.IsEmpty}} + <div class="ui dropdown selection search tw-flex-1 tw-mr-2 tw-max-w-96"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <input type="hidden" name="branch" value="{{.Repository.DefaultBranch}}"> + <div class="default text">{{.Repository.DefaultBranch}}</div> + <div class="menu"> + {{range .Branches}} + <div class="item" data-value="{{.}}">{{.}}</div> + {{end}} + </div> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.branches.update_default_branch"}}</button> + {{end}} + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.protected_branch"}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{$.Repository.Link}}/settings/branches/edit">{{ctx.Locale.Tr "repo.settings.branches.add_new_rule"}}</a> + </div> + </h4> + + <div class="ui attached segment"> + <div class="flex-list"> + {{range .ProtectedBranches}} + <div class="flex-item tw-items-center"> + <div class="flex-item-main"> + <div class="flex-item-title"> + <div class="ui basic primary label">{{.RuleName}}</div> + </div> + </div> + <div class="flex-item-trailing"> + <a class="rm ui tiny button" href="{{$.Repository.Link}}/settings/branches/edit?rule_name={{.RuleName}}">{{ctx.Locale.Tr "repo.settings.edit_protected_branch"}}</a> + <button class="ui red tiny button delete-button" data-url="{{$.Repository.Link}}/settings/branches/{{.ID}}/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.protected_branch.delete_rule"}} + </button> + </div> + </div> + {{else}} + <div class="flex-item center aligned"> + {{ctx.Locale.Tr "repo.settings.no_protected_branch"}} + </div> + {{end}} + </div> + </div> + {{end}} + </div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.protected_branch_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.protected_branch_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl new file mode 100644 index 00000000..8028642a --- /dev/null +++ b/templates/repo/settings/collaboration.tmpl @@ -0,0 +1,117 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings collaboration")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.collaboration"}} + </h4> + {{if .Collaborators}} + <div class="ui attached segment"> + <div class="flex-list"> + {{range .Collaborators}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + <a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a> + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .}} + </div> + </div> + <div class="flex-item-trailing"> + <div class="flex-text-block"> + {{svg "octicon-shield-lock"}} + <div class="ui inline dropdown access-mode" data-url="{{$.Link}}/access_mode" data-uid="{{.ID}}" data-last-value="{{printf "%d" .Collaboration.Mode}}"> + <div class="text">{{if eq .Collaboration.Mode 1}}{{ctx.Locale.Tr "repo.settings.collaboration.read"}}{{else if eq .Collaboration.Mode 2}}{{ctx.Locale.Tr "repo.settings.collaboration.write"}}{{else if eq .Collaboration.Mode 3}}{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}{{else}}{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}{{end}}</div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-text="{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}" data-value="3">{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}</div> + <div class="item" data-text="{{ctx.Locale.Tr "repo.settings.collaboration.write"}}" data-value="2">{{ctx.Locale.Tr "repo.settings.collaboration.write"}}</div> + <div class="item" data-text="{{ctx.Locale.Tr "repo.settings.collaboration.read"}}" data-value="1">{{ctx.Locale.Tr "repo.settings.collaboration.read"}}</div> + </div> + </div> + </div> + <button class="ui red tiny button inline delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} + </button> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + <div class="ui bottom attached segment"> + <form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div id="search-user-box" class="ui search input tw-align-middle"> + <input class="prompt" name="collaborator" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" autofocus required> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_collaborator"}}</button> + </form> + </div> + + {{if .RepoOwnerIsOrganization}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.teams"}} + </h4> + {{$allowedToChangeTeams := (or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}} + {{if .Teams}} + <div class="ui attached segment"> + <div class="flex-list"> + {{range $t, $team := .Teams}} + <div class="flex-item"> + <div class="flex-item-main"> + <a class="flex-item-title text primary" href="{{AppSubUrl}}/org/{{$.OrgName|PathEscape}}/teams/{{.LowerName|PathEscape}}"> + {{.Name}} + </a> + <div class="flex-item-body flex-text-block"> + {{svg "octicon-shield-lock"}} + {{if eq .AccessMode 1}}{{ctx.Locale.Tr "repo.settings.collaboration.read"}}{{else if eq .AccessMode 2}}{{ctx.Locale.Tr "repo.settings.collaboration.write"}}{{else if eq .AccessMode 3}}{{ctx.Locale.Tr "repo.settings.collaboration.admin"}}{{else if eq .AccessMode 4}}{{ctx.Locale.Tr "repo.settings.collaboration.owner"}}{{else}}{{ctx.Locale.Tr "repo.settings.collaboration.undefined"}}{{end}} + </div> + {{if or (eq .AccessMode 1) (eq .AccessMode 2)}} + {{$first := true}} + <div class="flex-item-body" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.change_team_permission_tip"}}"> + Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $.Context $unit.Type) ($team.UnitEnabled $.Context $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{ctx.Locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}} + </div> + {{end}} + </div> + {{if $allowedToChangeTeams}} + <div class="flex-item-trailing" {{if .IncludesAllRepositories}} data-tooltip-content="{{ctx.Locale.Tr "repo.settings.delete_team_tip"}}"{{end}}> + <button class="ui red tiny button inline delete-button {{if .IncludesAllRepositories}}disabled{{end}}" data-url="{{$.Link}}/team/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.delete_collaborator"}} + </button> + </div> + {{end}} + </div> + {{end}} + </div> + </div> + {{end}} + <div class="ui bottom attached segment"> + {{if $allowedToChangeTeams}} + <form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post"> + {{.CsrfTokenHtml}} + <div id="search-team-box" class="ui search input tw-align-middle" data-org-name="{{.OrgName}}"> + <input class="prompt" name="team" placeholder="{{ctx.Locale.Tr "search.team_kind"}}" autocomplete="off" autofocus required> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_team"}}</button> + </form> + {{else}} + <div class="item"> + {{ctx.Locale.Tr "repo.settings.change_team_access_not_allowed"}} + </div> + {{end}} + </div> + {{end}} + </div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.collaborator_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.collaborator_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl new file mode 100644 index 00000000..4bc3abf6 --- /dev/null +++ b/templates/repo/settings/deploy_keys.tmpl @@ -0,0 +1,86 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.deploy_keys"}} + <div class="ui right"> + {{if not .DisableSSH}} + <button class="ui primary tiny show-panel toggle button" data-panel="#add-deploy-key-panel">{{ctx.Locale.Tr "repo.settings.add_deploy_key"}}</button> + {{else}} + <button class="ui primary tiny button disabled">{{ctx.Locale.Tr "settings.ssh_disabled"}}</button> + {{end}} + </div> + </h4> + <div class="ui attached segment"> + <div class="{{if not .HasError}}tw-hidden{{end}} tw-mb-4" id="add-deploy-key-panel"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + {{ctx.Locale.Tr "repo.settings.deploy_key_desc"}} + </div> + <div class="field {{if .Err_Title}}error{{end}}"> + <label for="ssh-key-title">{{ctx.Locale.Tr "repo.settings.title"}}</label> + <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required> + </div> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="ssh-key-content">{{ctx.Locale.Tr "repo.settings.deploy_key_content"}}</label> + <textarea id="ssh-key-content" name="content" placeholder="{{ctx.Locale.Tr "settings.key_content_ssh_placeholder"}}" required>{{.content}}</textarea> + </div> + <div class="field"> + <div class="ui checkbox {{if .Err_IsWritable}}error{{end}}"> + <input id="ssh-key-is-writable" name="is_writable" type="checkbox" value="1"> + <label for="ssh-key-is-writable"> + {{ctx.Locale.Tr "repo.settings.is_writable"}} + </label> + <small class="tw-pl-[26px]">{{ctx.Locale.Tr "repo.settings.is_writable_info"}}</small> + </div> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.settings.add_deploy_key"}} + </button> + <button class="ui hide-panel button" data-panel="#add-deploy-key-panel"> + {{ctx.Locale.Tr "cancel"}} + </button> + </form> + </div> + {{if .Deploykeys}} + <div class="flex-list"> + {{range .Deploykeys}} + <div class="flex-item"> + <div class="flex-item-leading"> + <span class="text {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.key_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span> + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + {{.Fingerprint}} + </div> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}} - <span>{{ctx.Locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{ctx.Locale.Tr "settings.can_write_info"}} {{end}}</span></p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + {{else}} + {{ctx.Locale.Tr "repo.settings.no_deploy_keys"}} + {{end}} + </div> + </div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.deploy_key_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.deploy_key_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/githook_edit.tmpl b/templates/repo/settings/githook_edit.tmpl new file mode 100644 index 00000000..e20f51b9 --- /dev/null +++ b/templates/repo/settings/githook_edit.tmpl @@ -0,0 +1,27 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings edit githook")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.githooks"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "repo.settings.githook_edit_desc"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + {{with .Hook}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.settings.githook_name"}}</label> + <span class="hook-filename">{{.Name}}</span> + </div> + <div class="field"> + <label for="content">{{ctx.Locale.Tr "repo.settings.githook_content"}}</label> + <textarea id="content" name="content" class="tw-hidden">{{if .IsActive}}{{.Content}}{{else}}{{.Sample}}{{end}}</textarea> + <div class="editor-loading is-loading"></div> + </div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_githook"}}</button> + </div> + {{end}} + </form> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/githooks.tmpl b/templates/repo/settings/githooks.tmpl new file mode 100644 index 00000000..1a603f9f --- /dev/null +++ b/templates/repo/settings/githooks.tmpl @@ -0,0 +1,23 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings githooks")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.githooks"}} + </h4> + <div class="ui attached segment"> + <div class="ui list"> + <div class="item"> + {{ctx.Locale.Tr "repo.settings.githooks_desc"}} + </div> + {{range .Hooks}} + <div class="item truncated-item-container"> + <span class="text {{if .IsActive}}green{{else}}grey{{end}} tw-mr-2">{{svg "octicon-dot-fill" 22}}</span> + <span class="text truncate tw-flex-1 tw-mr-2">{{.Name}}</span> + <a class="muted tw-float-right tw-p-2" href="{{$.RepoLink}}/settings/hooks/git/{{.Name|PathEscape}}"> + {{svg "octicon-pencil"}} + </a> + </div> + {{end}} + </div> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/layout_footer.tmpl b/templates/repo/settings/layout_footer.tmpl new file mode 100644 index 00000000..60cad3ff --- /dev/null +++ b/templates/repo/settings/layout_footer.tmpl @@ -0,0 +1,11 @@ +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} +<div class="page-content"> + <div class="repo-layout-right"> + <div> + {{/* block: repo-setting-content */}} +{{end}} + + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/settings/layout_head.tmpl b/templates/repo/settings/layout_head.tmpl new file mode 100644 index 00000000..efec9bf8 --- /dev/null +++ b/templates/repo/settings/layout_head.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .ctxData}} +<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}"> + {{template "repo/header" .ctxData}} + <div class="ui container flex-container"> + {{template "repo/settings/navbar" .ctxData}} + <div class="flex-container-main"> + {{template "base/alert" .ctxData}} + {{/* block: repo-setting-content */}} + +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} + </div> + </div> +</div> +{{end}} diff --git a/templates/repo/settings/lfs.tmpl b/templates/repo/settings/lfs.tmpl new file mode 100644 index 00000000..6d7aac22 --- /dev/null +++ b/templates/repo/settings/lfs.tmpl @@ -0,0 +1,53 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.lfs_filelist"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <a class="ui tiny button" href="{{.Link}}/locks">{{ctx.Locale.Tr "repo.settings.lfs_locks"}}</a> + <a class="ui primary tiny button" href="{{.Link}}/pointers"> {{ctx.Locale.Tr "repo.settings.lfs_findpointerfiles"}}</a> + </div> + </h4> + <table id="lfs-files-table" class="ui attached segment single line table"> + <tbody> + {{range .LFSFiles}} + <tr> + <td> + <a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui brown button tw-font-mono"> + {{ShortSha .Oid}} + </a> + </td> + <td>{{ctx.Locale.TrSize .Size}}</td> + <td>{{TimeSince .CreatedUnix.AsTime ctx.Locale}}</td> + <td class="right aligned"> + <a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> + <button class="ui basic show-modal icon button red" data-modal="#delete-{{.Oid}}"> + <span class="btn-octicon btn-octicon-danger" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.delete_this_file"}}">{{svg "octicon-trash"}}</span> + </button> + </td> + </tr> + {{else}} + <tr> + <td colspan="4">{{ctx.Locale.Tr "repo.settings.lfs_no_lfs_files"}}</td> + </tr> + {{end}} + </tbody> + </table> + {{template "base/paginate" .}} + {{range .LFSFiles}} + <div class="ui g-modal-confirm modal" id="delete-{{.Oid}}"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.lfs_delete" .Oid}} + </div> + <div class="content"> + <p> + {{ctx.Locale.Tr "repo.settings.lfs_delete_warning"}} + </p> + <form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post"> + {{$.CsrfTokenHtml}} + {{template "base/modal_actions_confirm" (dict "ModalButtonColors" "primary")}} + </form> + </div> + </div> + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_file.tmpl b/templates/repo/settings/lfs_file.tmpl new file mode 100644 index 00000000..5bcd2af5 --- /dev/null +++ b/templates/repo/settings/lfs_file.tmpl @@ -0,0 +1,57 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="user-main-content twelve wide column content repository file list"> + <div class="tab-size-8 non-diff-file-content"> + <h4 class="ui top attached header"> + <a href="{{.LFSFilesLink}}">{{ctx.Locale.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.LFSFile.Oid}}</span> + <div class="ui right"> + {{if .EscapeStatus.Escaped}} + <a class="ui tiny basic button unescape-button tw-hidden">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</a> + <a class="ui tiny basic button escape-button">{{ctx.Locale.Tr "repo.escape_control_characters"}}</a> + {{end}} + <a class="ui primary tiny button" href="{{.LFSFilesLink}}/find?oid={{.LFSFile.Oid}}&size={{.LFSFile.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> + </div> + </h4> + <div class="ui bottom attached table unstackable segment"> + {{template "repo/unicode_escape_prompt" dict "EscapeStatus" .EscapeStatus "root" $}} + <div class="file-view{{if .IsMarkup}} markup {{.MarkupType}}{{else if .IsPlainText}} plain-text{{else if .IsTextFile}} code-view{{end}}"> + {{if .IsMarkup}} + {{if .FileContent}}{{.FileContent | SafeHTML}}{{end}} + {{else if .IsPlainText}} + <pre>{{if .FileContent}}{{.FileContent | SafeHTML}}{{end}}</pre> + {{else if not .IsTextFile}} + <div class="view-raw"> + {{if .IsImageFile}} + <img src="{{$.RawFileLink}}"> + {{else if .IsVideoFile}} + <video controls src="{{$.RawFileLink}}"> + <strong>{{ctx.Locale.Tr "repo.video_not_supported_in_browser"}}</strong> + </video> + {{else if .IsAudioFile}} + <audio controls src="{{$.RawFileLink}}"> + <strong>{{ctx.Locale.Tr "repo.audio_not_supported_in_browser"}}</strong> + </audio> + {{else if .IsPDFFile}} + <div class="pdf-content is-loading" data-src="{{$.RawFileLink}}" data-fallback-button-text="{{ctx.Locale.Tr "diff.view_file"}}"></div> + {{else}} + <a href="{{$.RawFileLink}}" rel="nofollow">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> + {{end}} + </div> + {{else if .FileSize}} + <table> + <tbody> + <tr> + {{if .IsFileTooLarge}} + <td><strong>{{ctx.Locale.Tr "repo.file_too_large"}}</strong></td> + {{else}} + <td class="lines-num">{{.LineNums}}</td> + <td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol>{{.FileContent}}</ol></code></pre></td> + {{end}} + </tr> + </tbody> + </table> + {{end}} + </div> + </div> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_file_find.tmpl b/templates/repo/settings/lfs_file_find.tmpl new file mode 100644 index 00000000..809a028b --- /dev/null +++ b/templates/repo/settings/lfs_file_find.tmpl @@ -0,0 +1,46 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="user-main-content twelve wide column content repository file list"> + <div class="tab-size-8 non-diff-file-content"> + <h4 class="ui top attached header"> + <a href="{{.LFSFilesLink}}">{{ctx.Locale.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.Oid}}</span> + </h4> + <table id="lfs-files-find-table" class="ui attached segment single line table"> + <tbody> + {{range .Results}} + <tr> + <td> + {{svg "octicon-file"}} + <a href="{{$.RepoLink}}/src/commit/{{.SHA}}/{{PathEscapeSegments .Name}}" title="{{.Name}}">{{.Name}}</a> + </td> + <td class="message"> + <span class="truncate"> + <a href="{{$.RepoLink}}/commit/{{.SHA}}" title="{{.Summary}}"> + {{.Summary | RenderEmoji $.Context}} + </a> + </span> + </td> + <td> + <span class="text grey">{{svg "octicon-git-branch"}}{{.BranchName}}</span> + </td> + <td> + {{if .ParentHashes}} + {{ctx.Locale.Tr "repo.diff.parent"}} + {{range .ParentHashes}} + <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{.String}}">{{ShortSha .String}}</a> + {{end}} + {{end}} + {{ctx.Locale.Tr "repo.diff.commit"}} + <a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{.SHA}}">{{ShortSha .SHA}}</a> + </td> + <td>{{TimeSince .When ctx.Locale}}</td> + </tr> + {{else}} + <tr> + <td colspan="5">{{ctx.Locale.Tr "repo.settings.lfs_lfs_file_no_commits"}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_locks.tmpl b/templates/repo/settings/lfs_locks.tmpl new file mode 100644 index 00000000..9a18f525 --- /dev/null +++ b/templates/repo/settings/lfs_locks.tmpl @@ -0,0 +1,56 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="user-main-content twelve wide column content repository file list"> + <div class="tab-size-8 non-diff-file-content"> + <h4 class="ui top attached header"> + <a href="{{.LFSFilesLink}}">{{ctx.Locale.Tr "repo.settings.lfs"}}</a> / {{ctx.Locale.Tr "repo.settings.lfs_locks"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty" method="post"> + {{$.CsrfTokenHtml}} + <div class="ui fluid action input"> + <input name="path" value="" placeholder="{{ctx.Locale.Tr "repo.settings.lfs_lock_path"}}" autofocus> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.lfs_lock"}}</button> + </div> + </form> + </div> + <table id="lfs-files-locks-table" class="ui attached segment single line table"> + <tbody> + {{range $index, $lock := .LFSLocks}} + <tr> + <td> + {{if index $.Linkable $index}} + {{svg "octicon-file"}} + <a href="{{$.RepoLink}}/src/branch/{{PathEscapeSegments $.Repository.DefaultBranch}}/{{PathEscapeSegments $lock.Path}}" title="{{$lock.Path}}">{{$lock.Path}}</a> + {{else}} + {{svg "octicon-diff"}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.lfs_lock_file_no_exist"}}">{{$lock.Path}}</span> + {{end}} + {{if not (index $.Lockables $index)}} + <span data-tooltip-content="{{ctx.Locale.Tr "repo.settings.lfs_noattribute"}}">{{svg "octicon-alert"}}</span> + {{end}} + </td> + <td> + <a href="{{$lock.Owner.HomeLink}}"> + {{ctx.AvatarUtils.Avatar $lock.Owner}} + {{$lock.Owner.DisplayName}} + </a> + </td> + <td>{{TimeSince .Created ctx.Locale}}</td> + <td class="right aligned"> + <form action="{{$.LFSFilesLink}}/locks/{{$lock.ID}}/unlock" method="post"> + {{$.CsrfTokenHtml}} + <button class="ui primary button"><span class="btn-octicon">{{svg "octicon-lock"}}</span>{{ctx.Locale.Tr "repo.settings.lfs_force_unlock"}}</button> + </form> + </td> + </tr> + {{else}} + <tr> + <td colspan="4">{{ctx.Locale.Tr "repo.settings.lfs_locks_no_locks"}}</td> + </tr> + {{end}} + </tbody> + </table> + {{template "base/paginate" .}} + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/lfs_pointers.tmpl b/templates/repo/settings/lfs_pointers.tmpl new file mode 100644 index 00000000..a0bb8c46 --- /dev/null +++ b/templates/repo/settings/lfs_pointers.tmpl @@ -0,0 +1,56 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings lfs")}} + <div class="repo-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.lfs_pointers.found" .NumPointers .NumAssociated .NumNotAssociated .NumNoExist}} + {{if gt .NumAssociatable 0}} + <div class="ui right"> + <form class="ui form" method="post" action="{{$.Link}}/associate"> + {{.CsrfTokenHtml}} + {{range .Pointers}} + {{if .Associatable}} + <input type="hidden" name="oid" value="{{.Oid}} {{.Size}}"> + {{end}} + {{end}} + <button class="ui primary tiny button">{{ctx.Locale.Tr "repo.settings.lfs_pointers.associateAccessible" $.NumAssociatable}}</button> + </form> + </div> + {{end}} + </h4> + <div class="ui attached segment"> + <table id="lfs-files-table" class="ui fixed single line table"> + <thead> + <tr> + <th class="three wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.sha"}}</th> + <th class="four wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.oid"}}</th> + <th class="two wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.inRepo"}}</th> + <th class="two wide">{{ctx.Locale.Tr "repo.settings.lfs_pointers.exists"}}</th> + <th class="two wide" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.lfs_pointers.accessible"}}">{{ctx.Locale.Tr "repo.settings.lfs_pointers.accessible"}}</th> + <th class="three wide"></th> + </tr> + </thead> + <tbody> + {{range .Pointers}} + <tr> + <td> + <a href="{{$.RepoLink}}/raw/blob/{{.SHA}}" rel="nofollow" target="_blank" title="{{.SHA}}" class="ui button tw-font-mono"> + {{ShortSha .SHA}} + </a> + </td> + <td> + <a {{if and .Exists .InRepo}}href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank"{{end}} title="{{.Oid}}" class="ui brown button tw-font-mono"> + {{ShortSha .Oid}} + </a> + </td> + <td>{{if .InRepo}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if .Exists}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td>{{if .Accessible}}{{svg "octicon-check"}}{{else}}{{svg "octicon-x"}}{{end}}</td> + <td class="tw-text-right"> + <a class="ui primary button" href="{{$.LFSFilesLink}}/find?oid={{.Oid}}&size={{.Size}}&sha={{.SHA}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a> + </td> + </tr> + {{end}} + </tbody> + </table> + </div> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl new file mode 100644 index 00000000..df5ba3ab --- /dev/null +++ b/templates/repo/settings/navbar.tmpl @@ -0,0 +1,72 @@ +<div class="flex-container-nav"> + <div class="ui fluid vertical menu"> + <div class="header item">{{ctx.Locale.Tr "repo.settings"}}</div> + <a class="{{if .PageIsSettingsOptions}}active {{end}}item" href="{{.RepoLink}}/settings"> + {{ctx.Locale.Tr "repo.settings.options"}} + </a> + <details class="item toggleable-item" {{if .PageIsRepoSettingsUnits}}open{{end}}> + <summary class="item{{if .PageIsRepoSettingsUnits}} active{{end}}">{{ctx.Locale.Tr "repo.settings.units.units"}}</summary> + <div class="menu"> + <a class="item" href="{{.RepoLink}}/settings/units#overview"> + {{ctx.Locale.Tr "repo.settings.units.overview"}} + </a> + <a class="item" href="{{.RepoLink}}/settings/units#issues"> + {{ctx.Locale.Tr "repo.issues"}} + </a> + <a class="item" href="{{.RepoLink}}/settings/units#pulls"> + {{ctx.Locale.Tr "repo.pulls"}} + </a> + <a class="item" href="{{.RepoLink}}/settings/units#wiki"> + {{ctx.Locale.Tr "repo.wiki"}} + </a> + </div> + </details> + <a class="{{if .PageIsSettingsCollaboration}}active {{end}}item" href="{{.RepoLink}}/settings/collaboration"> + {{ctx.Locale.Tr "repo.settings.collaboration"}} + </a> + {{if not DisableWebhooks}} + <a class="{{if .PageIsSettingsHooks}}active {{end}}item" href="{{.RepoLink}}/settings/hooks"> + {{ctx.Locale.Tr "repo.settings.hooks"}} + </a> + {{end}} + {{if .Repository.UnitEnabled $.Context $.UnitTypeCode}} + {{if not .Repository.IsEmpty}} + <a class="{{if .PageIsSettingsBranches}}active {{end}}item" href="{{.RepoLink}}/settings/branches"> + {{ctx.Locale.Tr "repo.settings.branches"}} + </a> + {{end}} + <a class="{{if .PageIsSettingsTags}}active {{end}}item" href="{{.RepoLink}}/settings/tags"> + {{ctx.Locale.Tr "repo.settings.tags"}} + </a> + {{if .SignedUser.CanEditGitHook}} + <a class="{{if .PageIsSettingsGitHooks}}active {{end}}item" href="{{.RepoLink}}/settings/hooks/git"> + {{ctx.Locale.Tr "repo.settings.githooks"}} + </a> + {{end}} + <a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{.RepoLink}}/settings/keys"> + {{ctx.Locale.Tr "repo.settings.deploy_keys"}} + </a> + {{if .LFSStartServer}} + <a class="{{if .PageIsSettingsLFS}}active {{end}}item" href="{{.RepoLink}}/settings/lfs"> + {{ctx.Locale.Tr "repo.settings.lfs"}} + </a> + {{end}} + {{end}} + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} + <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables}}open{{end}}> + <summary>{{ctx.Locale.Tr "actions.actions"}}</summary> + <div class="menu"> + <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{.RepoLink}}/settings/actions/runners"> + {{ctx.Locale.Tr "actions.runners"}} + </a> + <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{.RepoLink}}/settings/actions/secrets"> + {{ctx.Locale.Tr "secrets.secrets"}} + </a> + <a class="{{if .PageIsSharedSettingsVariables}}active {{end}}item" href="{{.RepoLink}}/settings/actions/variables"> + {{ctx.Locale.Tr "actions.variables"}} + </a> + </div> + </details> + {{end}} + </div> +</div> diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl new file mode 100644 index 00000000..affb7dad --- /dev/null +++ b/templates/repo/settings/options.tmpl @@ -0,0 +1,782 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}} + <div class="user-main-content twelve wide column"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.basic_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="update"> + <div class="required field {{if .Err_RepoName}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.repo_name"}}</label> + <input name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.repo_size"}}</label> + <span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString ctx.Locale}}"{{end}}>{{ctx.Locale.TrSize .Repository.Size}}</span> + </div> + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.template"}}</label> + <div class="ui checkbox"> + <input name="template" type="checkbox" {{if .Repository.IsTemplate}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.template_helper"}}</label> + </div> + </div> + {{if not .Repository.IsFork}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.visibility"}}</label> + <div class="ui checkbox" {{if and (not .Repository.IsPrivate) (gt .Repository.NumStars 0)}}data-tooltip-content="{{ctx.Locale.Tr "repo.stars_remove_warning"}}"{{end}}> + {{if .IsAdmin}} + <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}> + {{else}} + <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} disabled{{end}}> + {{if and .Repository.IsPrivate $.ForcePrivate}}<input type="hidden" name="private" value="{{.Repository.IsPrivate}}">{{end}} + {{end}} + <label>{{ctx.Locale.Tr "repo.visibility_helper"}} {{if .Repository.NumForks}}<span class="text red">{{ctx.Locale.Tr "repo.visibility_fork_helper"}}</span>{{end}}</label> + </div> + </div> + {{end}} + <div class="field {{if .Err_Description}}error{{end}}"> + <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label> + <textarea id="description" name="description" rows="2" maxlength="2048">{{.Repository.Description}}</textarea> + </div> + <div class="field {{if .Err_Website}}error{{end}}"> + <label for="website">{{ctx.Locale.Tr "repo.settings.site"}}</label> + <input id="website" name="website" type="url" maxlength="1024" value="{{.Repository.Website}}"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + + <div class="divider"></div> + <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label> + <input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button> + <button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button> + </div> + </form> + </div> + + {{if FederationEnabled}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.federation_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="federation"> + <div class="field {{if .Err_FollowingRepos}}error{{end}}"> + <p>{{ctx.Locale.Tr "repo.settings.federation_apapiurl"}}</p> + <p><b>{{.RepositoryAPActorID}}</b></p> + <div class="divider"></div> + <label for="following_repos">{{ctx.Locale.Tr "repo.settings.federation_following_repos"}}</label> + <input id="following_repos" name="following_repos" value="{{.FollowingRepos}}"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + </div> + {{end}} + + {{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}} + {{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}} + {{$showMirrorSettings := and (.Repository.UnitEnabled $.Context $.UnitTypeCode) (or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors)}} + {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}} + {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}} + {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}} + {{$existingPushMirror := or .Repository.IsMirror .PushMirrors}} + {{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}} + {{$isWorkingPullMirror := .PullMirror}} + + {{if $showMirrorSettings}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.mirror_settings"}} + </h4> + <div class="ui attached segment"> + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{ctx.Locale.Tr "repo.settings.archive.mirrors_unavailable"}} + </div> + {{else}} + {{if $newMirrorsEntirelyEnabled}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pushing-to-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br> + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section"}}</a><br> + {{else if $onlyNewPushMirrorsEnabled}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br> + {{else if $onlyNewPullMirrorsEnabled}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}} + <a target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/user/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br> + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}} + {{if $existingPushMirror}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}} + {{end}} + {{else}} + {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}<br> + {{end}} + + {{if .Repository.IsMirror}} + <table class="ui table"> + <thead> + <tr> + <th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th> + <th></th> + </tr> + </thead> + {{if $modifyBrokenPullMirror}} + {{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}} + <tbody> + <tr> + <td colspan="4"> + <div class="text red tw-py-4">{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}</div> + </td> + </tr> + </tbody> + {{else if $isWorkingPullMirror}} + <tbody> + <tr> + <td>{{.PullMirror.RemoteAddress}}</td> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td> + <td>{{DateTime "full" .PullMirror.UpdatedUnix}}</td> + <td class="right aligned"> + <form method="post" class="tw-inline-block"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="mirror-sync"> + <button class="ui primary tiny button inline">{{ctx.Locale.Tr "repo.settings.sync_mirror"}}</button> + </form> + </td> + </tr> + <tr> + <td colspan="4"> + <form class="ui form" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="mirror"> + <div class="inline field {{if .Err_EnablePrune}}error{{end}}"> + <label>{{ctx.Locale.Tr "repo.mirror_prune"}}</label> + <div class="ui checkbox"> + <input id="enable_prune" name="enable_prune" type="checkbox" {{if .PullMirror.EnablePrune}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.mirror_prune_desc"}}</label> + </div> + </div> + <div class="inline field {{if .Err_Interval}}error{{end}}"> + <label for="interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> + <input id="interval" name="interval" value="{{.PullMirror.Interval}}"> + </div> + {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName}} + <div class="field {{if .Err_MirrorAddress}}error{{end}}"> + <label for="mirror_address">{{ctx.Locale.Tr "repo.mirror_address"}}</label> + <input id="mirror_address" name="mirror_address" value="{{$address.Address}}" required> + <p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p> + </div> + <details class="ui optional field" {{if or .Err_Auth $address.Username}}open{{end}}> + <summary class="tw-p-1"> + {{ctx.Locale.Tr "repo.need_auth"}} + </summary> + <div class="tw-p-1"> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="mirror_username">{{ctx.Locale.Tr "username"}}</label> + <input id="mirror_username" name="mirror_username" value="{{$address.Username}}" {{if not .mirror_username}}data-need-clear="true"{{end}}> + </div> + <div class="inline field {{if .Err_Auth}}error{{end}}"> + <label for="mirror_password">{{ctx.Locale.Tr "password"}}</label> + <input id="mirror_password" name="mirror_password" type="password" placeholder="{{if $address.Password}}{{ctx.Locale.Tr "repo.mirror_password_placeholder"}}{{else}}{{ctx.Locale.Tr "repo.mirror_password_blank_placeholder"}}{{end}}" value="" {{if not .mirror_password}}data-need-clear="true"{{end}} autocomplete="off"> + </div> + <p class="help">{{ctx.Locale.Tr "repo.mirror_password_help"}}</p> + </div> + </details> + + {{if .LFSStartServer}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.mirror_lfs"}}</label> + <div class="ui checkbox"> + <input id="mirror_lfs" name="mirror_lfs" type="checkbox" {{if .PullMirror.LFS}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.mirror_lfs_desc"}}</label> + </div> + </div> + <div class="field {{if .Err_LFSEndpoint}}error{{end}}"> + <label for="mirror_lfs_endpoint">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}</label> + <input id="mirror_lfs_endpoint" name="mirror_lfs_endpoint" value="{{.PullMirror.LFSEndpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}"> + <p class="help">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery"}}</p> + </div> + {{end}} + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_mirror_settings"}}</button> + </div> + </form> + </td> + </tr> + </tbody> + {{end}}{{/* end if: $modifyBrokenPullMirror / $isWorkingPullMirror */}} + </table> + {{end}}{{/* end if .Repository.IsMirror */}} + + <table class="ui table"> + <thead> + <tr> + <th class="tw-w-2/5">{{ctx.Locale.Tr "repo.settings.mirror_settings.pushed_repository"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th> + <th></th> + </tr> + </thead> + <tbody> + {{range .PushMirrors}} + <tr> + <td class="tw-break-anywhere">{{.RemoteAddress}}</td> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td> + <td>{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td> + <td class="right aligned"> + <button + class="ui tiny button show-modal" + data-modal="#push-mirror-edit-modal" + data-tooltip-content="{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}" + data-modal-push-mirror-edit-id="{{.ID}}" + data-modal-push-mirror-edit-interval="{{.Interval}}" + data-modal-push-mirror-edit-address="{{.RemoteAddress}}" + > + {{svg "octicon-pencil" 14}} + </button> + <form method="post" class="tw-inline-block"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-sync"> + <input type="hidden" name="push_mirror_id" value="{{.ID}}"> + <button class="ui primary tiny button" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.sync_mirror"}}">{{svg "octicon-sync" 14}}</button> + </form> + <form method="post" class="tw-inline-block"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-remove"> + <input type="hidden" name="push_mirror_id" value="{{.ID}}"> + <button class="ui basic red tiny button" data-tooltip-content="{{ctx.Locale.Tr "remove"}}">{{svg "octicon-trash" 14}}</button> + </form> + </td> + </tr> + {{else}} + <tr> + <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}</td> + </tr> + {{end}} + {{if (not .DisableNewPushMirrors)}} + <tr> + <td colspan="4"> + <form class="ui form" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-add"> + <div class="field {{if .Err_PushMirrorAddress}}error{{end}}"> + <label for="push_mirror_address">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.remote_url"}}</label> + <input id="push_mirror_address" name="push_mirror_address" value="{{.push_mirror_address}}" required> + <p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p> + </div> + <details class="ui optional field" {{if or .Err_PushMirrorAuth .push_mirror_username}}open{{end}}> + <summary class="tw-p-1"> + {{ctx.Locale.Tr "repo.need_auth"}} + </summary> + <div class="tw-p-1"> + <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> + <label for="push_mirror_username">{{ctx.Locale.Tr "username"}}</label> + <input id="push_mirror_username" name="push_mirror_username" value="{{.push_mirror_username}}"> + </div> + <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}"> + <label for="push_mirror_password">{{ctx.Locale.Tr "password"}}</label> + <input id="push_mirror_password" name="push_mirror_password" type="password" value="{{.push_mirror_password}}" autocomplete="off"> + </div> + </div> + </details> + <div class="field"> + <div class="ui checkbox"> + <input id="push_mirror_sync_on_commit" name="push_mirror_sync_on_commit" type="checkbox" {{if .push_mirror_sync_on_commit}}checked{{end}}> + <label for="push_mirror_sync_on_commit">{{ctx.Locale.Tr "repo.mirror_sync_on_commit"}}</label> + </div> + </div> + <div class="inline field {{if .Err_PushMirrorInterval}}error{{end}}"> + <label for="push_mirror_interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> + <input id="push_mirror_interval" name="push_mirror_interval" value="{{if .push_mirror_interval}}{{.push_mirror_interval}}{{else}}{{.DefaultMirrorInterval}}{{end}}"> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.add"}}</button> + </div> + </form> + </td> + </tr> + {{end}} + </tbody> + </table> + {{end}} + </div> + {{end}} + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.signing_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="signing"> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.trust_model"}}</label><br> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" id="trust_model_default" name="trust_model" {{if eq .Repository.TrustModel.String "default"}}checked="checked"{{end}} value="default"> + <label for="trust_model_default">{{ctx.Locale.Tr "repo.settings.trust_model.default"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.default.desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" id="trust_model_collaborator" name="trust_model" {{if eq .Repository.TrustModel.String "collaborator"}}checked="checked"{{end}} value="collaborator"> + <label for="trust_model_collaborator">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.long"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" name="trust_model" id="trust_model_committer" {{if eq .Repository.TrustModel.String "committer"}}checked="checked"{{end}} value="committer"> + <label for="trust_model_committer">{{ctx.Locale.Tr "repo.settings.trust_model.committer.long"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.committer.desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input type="radio" name="trust_model" id="trust_model_collaboratorcommitter" {{if eq .Repository.TrustModel.String "collaboratorcommitter"}}checked="checked"{{end}} value="collaboratorcommitter"> + <label for="trust_model_collaboratorcommitter">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.long"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}</p> + </div> + </div> + </div> + + <div class="divider"></div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + </div> + + {{if .IsAdmin}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.admin_settings"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="admin"> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_health_check" type="checkbox" {{if .Repository.IsFsckEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.admin_enable_health_check"}}</label> + </div> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> + </form> + + <div class="divider"></div> + <form class="ui form" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="admin_index"> + {{if .CodeIndexerEnabled}} + <h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_code_indexer"}}</h4> + <div class="inline fields"> + <label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label> + <span class="field"> + {{if .CodeIndexerStatus}} + <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.CodeIndexerStatus.CommitSha}}"> + <span class="shortsha">{{ShortSha .CodeIndexerStatus.CommitSha}}</span> + </a> + {{else}} + <span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span> + {{end}} + </span> + <div class="field"> + <button class="ui primary button" name="request_reindex_type" value="code">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button> + </div> + </div> + {{end}} + <h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_stats_indexer"}}</h4> + <div class="inline fields"> + {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} + <label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label> + {{end}} + <span class="field"> + {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}} + <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.StatsIndexerStatus.CommitSha}}"> + <span class="shortsha">{{ShortSha .StatsIndexerStatus.CommitSha}}</span> + </a> + {{else}} + <span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span> + {{end}} + </span> + <div class="field"> + <button class="ui primary button" name="request_reindex_type" value="stats">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button> + </div> + </div> + </form> + </div> + {{end}} + + {{if .Permission.IsOwner}} + <h4 class="ui top attached error header"> + {{ctx.Locale.Tr "repo.settings.danger_zone"}} + </h4> + <div class="ui attached error danger segment"> + <div class="flex-list"> + {{if .Repository.IsMirror}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#convert-mirror-repo-modal">{{ctx.Locale.Tr "repo.settings.convert"}}</button> + </div> + </div> + {{end}} + {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_fork_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#convert-fork-repo-modal">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</button> + </div> + </div> + {{end}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.transfer.title"}}</div> + <div class="flex-item-body"> + {{if .RepoTransfer}} + {{ctx.Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}} + {{else}} + {{ctx.Locale.Tr "repo.settings.transfer_desc"}} + {{end}} + </div> + </div> + <div class="flex-item-trailing"> + {{if .RepoTransfer}} + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="cancel_transfer"> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_abort"}}</button> + </form> + {{else}} + <button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{ctx.Locale.Tr "repo.settings.transfer.button"}}</button> + {{end}} + </div> + </div> + {{if .Permission.CanRead $.UnitTypeWiki}} + {{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_desc" .DefaultWikiBranchName}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#rename-wiki-branch-modal">{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}}</button> + </div> + </div> + {{end}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_delete_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#delete-wiki-modal">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</button> + </div> + </div> + {{end}} + <div class="flex-item"> + <div class="flex-item-main"> + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.delete"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.delete_desc"}}</div> + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{ctx.Locale.Tr "repo.settings.delete"}}</button> + </div> + </div> + {{if not .Repository.IsMirror}} + <div class="flex-item tw-items-center"> + <div class="flex-item-main"> + {{if .Repository.IsArchived}} + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.unarchive.header"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.unarchive.text"}}</div> + {{else}} + <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.archive.header"}}</div> + <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.archive.text"}}</div> + {{end}} + </div> + <div class="flex-item-trailing"> + <button class="ui basic red show-modal button" data-modal="#archive-repo-modal"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.button"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.button"}} + {{end}} + </button> + </div> + </div> + {{end}} + </div> + </div> + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} + +{{if .Permission.IsOwner}} + {{if .Repository.IsMirror}} + <div class="ui small modal" id="convert-mirror-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.convert"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.convert_notices_1"}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="convert"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required maxlength="100"> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_confirm"}}</button> + </div> + </form> + </div> + </div> + {{end}} + {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}} + <div class="ui small modal" id="convert-fork-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.convert_fork"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.convert_fork_notices_1"}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="convert_fork"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_fork_confirm"}}</button> + </div> + </form> + </div> + </div> + {{end}} + <div class="ui small modal" id="transfer-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.transfer.modal.title"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.transfer_notices_1"}} <br> + {{ctx.Locale.Tr "repo.settings.transfer_notices_2"}} <br> + {{ctx.Locale.Tr "repo.settings.transfer_notices_3"}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="transfer"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + <div class="required field"> + <label for="new_owner_name">{{ctx.Locale.Tr "repo.settings.transfer_owner"}}</label> + <input id="new_owner_name" name="new_owner_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_perform"}}</button> + </div> + </form> + </div> + </div> + + <div class="ui small modal" id="delete-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.delete"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br> + {{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName}} + {{if .Repository.NumForks}}<br> + {{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}} + {{end}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="delete"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label for="repo_name_to_delete">{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input id="repo_name_to_delete" name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button> + </div> + </form> + </div> + </div> + + {{if .Repository.UnitEnabled $.Context $.UnitTypeWiki}} + <div class="ui small modal" id="delete-wiki-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.wiki_delete"}} + </div> + <div class="content"> + <div class="ui warning message"> + {{ctx.Locale.Tr "repo.settings.delete_notices_1"}}<br> + {{ctx.Locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name}} + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="delete-wiki"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_delete"}}</button> + </div> + </form> + </div> + </div> + {{if ne $.Repository.GetWikiBranchName .DefaultWikiBranchName}} + <div class="ui small modal" id="rename-wiki-branch-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main"}} + </div> + <div class="content"> + <div class="ui warning message"> + <ul> + <li>{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_notices_1"}}</li> + <li>{{ctx.Locale.Tr "repo.settings.wiki_rename_branch_main_notices_2" .Repository.Name}}</li> + </ul> + </div> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="rename-wiki-branch"> + <div class="field"> + <label> + {{ctx.Locale.Tr "repo.settings.enter_repo_name"}} + <span class="text red">{{.Repository.FullName}}</span> + </label> + </div> + <div class="required field"> + <label>{{ctx.Locale.Tr "repo.settings.confirmation_string"}}</label> + <input name="repo_name" required> + </div> + + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_branch_rename"}}</button> + </div> + </form> + </div> + </div> + {{end}} + {{end}} + + {{if not .Repository.IsMirror}} + <div class="ui g-modal-confirm modal" id="archive-repo-modal"> + <div class="header"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.header"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.header"}} + {{end}} + </div> + <div class="content"> + <div class="ui warning message"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.text"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.text"}} + {{end}} + </div> + <form action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="{{if .Repository.IsArchived}}unarchive{{else}}archive{{end}}"> + <input type="hidden" name="repo_id" value="{{.Repository.ID}}"> + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button> + <button class="ui red button"> + {{if .Repository.IsArchived}} + {{ctx.Locale.Tr "repo.settings.unarchive.button"}} + {{else}} + {{ctx.Locale.Tr "repo.settings.archive.button"}} + {{end}} + </button> + </div> + </form> + </div> + </div> + {{end}} +{{end}} + +{{template "repo/settings/push_mirror_sync_modal" .}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl new file mode 100644 index 00000000..a991e68e --- /dev/null +++ b/templates/repo/settings/protected_branch.tmpl @@ -0,0 +1,279 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings branches")}} + <div class="repo-setting-content"> + <form class="ui form" action="{{.Link}}" method="post"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}} + </h4> + <div class="ui attached segment branch-protection"> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.protect_patterns"}}</h5> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern"}}</label> + <input name="rule_name" type="text" value="{{.Rule.RuleName}}"> + <input name="rule_id" type="hidden" value="{{.Rule.ID}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_branch_name_pattern_desc"}}</p> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_protected_file_patterns"}}</label> + <input name="protected_file_patterns" type="text" value="{{.Rule.ProtectedFilePatterns}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_protected_file_patterns_desc"}}</p> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_unprotected_file_patterns"}}</label> + <input name="unprotected_file_patterns" type="text" value="{{.Rule.UnprotectedFilePatterns}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_unprotected_file_patterns_desc"}}</p> + </div> + + {{.CsrfTokenHtml}} + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_push"}}</h5> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_push" type="radio" value="none" class="toggle-target-disabled" data-target="#whitelist_box" {{if not .Rule.CanPush}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_disable_push"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_disable_push_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_push" type="radio" value="all" class="toggle-target-disabled" data-target="#whitelist_box" {{if and (.Rule.CanPush) (not .Rule.EnableWhitelist)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_enable_push"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_enable_push_desc"}}</p> + </div> + </div> + <div class="grouped fields"> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_push" type="radio" value="whitelist" class="toggle-target-enabled" data-target="#whitelist_box" {{if and (.Rule.CanPush) (.Rule.EnableWhitelist)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_committers"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_whitelist_committers_desc"}}</p> + </div> + </div> + <div id="whitelist_box" class="grouped fields {{if not .Rule.EnableWhitelist}}disabled{{end}}"> + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="whitelist_users" value="{{.whitelist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="whitelist_teams" value="{{.whitelist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + <div class="checkbox-sub-item field"> + <div class="ui checkbox"> + <input type="checkbox" name="whitelist_deploy_keys" {{if .Rule.WhitelistDeployKeys}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_whitelist_deploy_keys"}}</label> + </div> + </div> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="require_signed_commits" type="checkbox" {{if .Rule.RequireSignedCommits}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.require_signed_commits"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.require_signed_commits_desc"}}</p> + </div> + </div> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_pull_request_approvals"}}</h5> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_required_approvals"}}</label> + <input name="required_approvals" type="number" value="{{.Rule.RequiredApprovals}}"> + <p class="help tw-ml-0">{{ctx.Locale.Tr "repo.settings.protect_required_approvals_desc"}}</p> + </div> + <div class="grouped fields"> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_approvals_whitelist" type="checkbox" class="toggle-target-enabled" data-target="#approvals_whitelist_box" {{if .Rule.EnableApprovalsWhitelist}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_enabled"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_enabled_desc"}}</p> + </div> + </div> + <div id="approvals_whitelist_box" class="grouped fields {{if not .Rule.EnableApprovalsWhitelist}}disabled{{end}}"> + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="approvals_whitelist_users" value="{{.approvals_whitelist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_approvals_whitelist_teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="approvals_whitelist_teams" value="{{.approvals_whitelist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input id="dismiss_stale_approvals" name="dismiss_stale_approvals" type="checkbox" {{if .Rule.DismissStaleApprovals}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.dismiss_stale_approvals"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.dismiss_stale_approvals_desc"}}</p> + </div> + </div> + <div id="ignore_stale_approvals_box" class="field {{if .Rule.DismissStaleApprovals}}disabled{{end}}"> + <div class="ui checkbox"> + <input id="ignore_stale_approvals" name="ignore_stale_approvals" type="checkbox" {{if .Rule.IgnoreStaleApprovals}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.ignore_stale_approvals"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.ignore_stale_approvals_desc"}}</p> + </div> + </div> + <div class="grouped fields"> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_status_check" type="checkbox" class="toggle-target-enabled" data-target="#statuscheck_contexts_box" {{if .Rule.EnableStatusCheck}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_check_status_contexts"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_check_status_contexts_desc"}}</p> + </div> + </div> + <div id="statuscheck_contexts_box" class="checkbox-sub-item field {{if not .Rule.EnableStatusCheck}}disabled{{end}}"> + <label>{{ctx.Locale.Tr "repo.settings.protect_status_check_patterns"}}</label> + <textarea id="status_check_contexts" name="status_check_contexts" rows="3">{{.status_check_contexts}}</textarea> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_status_check_patterns_desc"}}</p> + <table class="ui celled table"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "repo.settings.protect_check_status_contexts_list"}}</th> + </tr> + </thead> + <tbody> + {{range $.recent_status_checks}} + <tr> + <td> + <span>{{.}}</span> + <span class="status-check-matched-mark tw-hidden" data-status-check="{{.}}">{{ctx.Locale.Tr "repo.settings.protect_status_check_matched"}}</span> + </td> + </tr> + {{else}} + <tr><td>-</td></tr> + {{end}} + </tbody> + </table> + </div> + </div> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_pull_request_merge"}}</h5> + <div class="grouped fields"> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_merge_whitelist" type="radio" value="false" class="toggle-target-disabled" data-target="#merge_whitelist_box" {{if not .Rule.EnableMergeWhitelist}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_enable_merge"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_enable_merge_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input name="enable_merge_whitelist" type="radio" value="true" class="toggle-target-enabled" data-target="#merge_whitelist_box" {{if .Rule.EnableMergeWhitelist}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_committers"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_committers_desc"}}</p> + </div> + </div> + <div id="merge_whitelist_box" class="grouped fields {{if not .Rule.EnableMergeWhitelist}}disabled{{end}}"> + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="merge_whitelist_users" value="{{.merge_whitelist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="checkbox-sub-item field"> + <label>{{ctx.Locale.Tr "repo.settings.protect_merge_whitelist_teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="merge_whitelist_teams" value="{{.merge_whitelist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="block_on_rejected_reviews" type="checkbox" {{if .Rule.BlockOnRejectedReviews}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.block_rejected_reviews"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.block_rejected_reviews_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="block_on_official_review_requests" type="checkbox" {{if .Rule.BlockOnOfficialReviewRequests}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.block_on_official_review_requests"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.block_on_official_review_requests_desc"}}</p> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="block_on_outdated_branch" type="checkbox" {{if .Rule.BlockOnOutdatedBranch}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.block_outdated_branch"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.block_outdated_branch_desc"}}</p> + </div> + </div> + <h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.event_pull_request_enforcement"}}</h5> + <div class="field"> + <div class="ui checkbox"> + <input name="apply_to_admins" type="checkbox" {{if .Rule.ApplyToAdmins}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.enforce_on_admins"}}</label> + <p class="help">{{ctx.Locale.Tr "repo.settings.enforce_on_admins_desc"}}</p> + </div> + </div> + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.protected_branch.save_rule"}}</button> + </div> + </div> + </form> + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/push_mirror_sync_modal.tmpl b/templates/repo/settings/push_mirror_sync_modal.tmpl new file mode 100644 index 00000000..e8dad61a --- /dev/null +++ b/templates/repo/settings/push_mirror_sync_modal.tmpl @@ -0,0 +1,32 @@ +<div class="ui small modal" id="push-mirror-edit-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}} + </div> + <div class="content"> + <form class="ui form ignore-dirty" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="push-mirror-update"> + <input type="hidden" name="push_mirror_id" id="push-mirror-edit-id"> + <div class="field"> + <label for="name">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label> + <div class="ui small input"> + <input id="push-mirror-edit-address" readonly> + </div> + </div> + <div class="inline field"> + <label for="push-mirror-edit-interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label> + <input id="push-mirror-edit-interval" name="push_mirror_interval" autofocus> + </div> + <div class="actions"> + <button class="ui small basic cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "cancel"}} + </button> + <button class="ui primary small approve button"> + {{svg "fontawesome-save"}} + {{ctx.Locale.Tr "save"}} + </button> + </div> + </form> + </div> +</div> diff --git a/templates/repo/settings/runner_edit.tmpl b/templates/repo/settings/runner_edit.tmpl new file mode 100644 index 00000000..8b76aead --- /dev/null +++ b/templates/repo/settings/runner_edit.tmpl @@ -0,0 +1,5 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings runners")}} + <div class="repo-setting-content"> + {{template "shared/actions/runner_edit" .}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/secrets.tmpl b/templates/repo/settings/secrets.tmpl new file mode 100644 index 00000000..0b89639e --- /dev/null +++ b/templates/repo/settings/secrets.tmpl @@ -0,0 +1,5 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings")}} + <div class="repo-setting-content"> + {{template "shared/secrets/add_list" .}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl new file mode 100644 index 00000000..c9efb7b6 --- /dev/null +++ b/templates/repo/settings/tags.tmpl @@ -0,0 +1,126 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings edit")}} + <div class="repo-setting-content"> + {{if .Repository.IsArchived}} + <div class="ui warning message tw-text-center"> + {{ctx.Locale.Tr "repo.settings.archive.tagsettings_unavailable"}} + </div> + {{else}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.tags.protection"}} + </h4> + + <div class="ui attached segment"> + <div class="ui grid"> + <div class="sixteen wide column"> + <div class="ui segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.tags.protection.pattern"}}</label> + <div id="search-tag-box" class="ui search"> + <div class="ui input"> + <input class="prompt" name="name_pattern" autocomplete="off" value="{{.name_pattern}}" placeholder="v*" autofocus required> + </div> + <div class="help">{{ctx.Locale.Tr "repo.settings.tags.protection.pattern.description"}}</div> + </div> + </div> + <div class="whitelist field"> + <label>{{ctx.Locale.Tr "repo.settings.tags.protection.allowed.users"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="allowlist_users" value="{{.allowlist_users}}"> + <div class="default text">{{ctx.Locale.Tr "search.user_kind"}}</div> + <div class="menu"> + {{range .Users}} + <div class="item" data-value="{{.ID}}"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}} + </div> + {{end}} + </div> + </div> + </div> + {{if .Owner.IsOrganization}} + <div class="whitelist field"> + <label>{{ctx.Locale.Tr "repo.settings.tags.protection.allowed.teams"}}</label> + <div class="ui multiple search selection dropdown"> + <input type="hidden" name="allowlist_teams" value="{{.allowlist_teams}}"> + <div class="default text">{{ctx.Locale.Tr "search.team_kind"}}</div> + <div class="menu"> + {{range .Teams}} + <div class="item" data-value="{{.ID}}"> + {{svg "octicon-people"}} + {{.Name}} + </div> + {{end}} + </div> + </div> + </div> + {{end}} + <div class="field"> + {{if .PageIsEditProtectedTag}} + <button class="ui primary button"> + {{ctx.Locale.Tr "save"}} + </button> + <a class="ui primary button" href="{{$.RepoLink}}/settings/tags"> + {{ctx.Locale.Tr "cancel"}} + </a> + {{else}} + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.settings.tags.protection.create"}} + </button> + {{end}} + </div> + </form> + </div> + </div> + + <div class="sixteen wide column"> + <table class="ui single line table"> + <thead> + <th>{{ctx.Locale.Tr "repo.settings.tags.protection.pattern"}}</th> + <th>{{ctx.Locale.Tr "repo.settings.tags.protection.allowed"}}</th> + <th></th> + </thead> + <tbody> + {{range .ProtectedTags}} + <tr> + <td><pre>{{.NamePattern}}</pre></td> + <td> + {{if or .AllowlistUserIDs (and $.Owner.IsOrganization .AllowlistTeamIDs)}} + {{$userIDs := .AllowlistUserIDs}} + {{range $.Users}} + {{if SliceUtils.Contains $userIDs .ID}} + <a class="ui basic label" href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 26}} {{.GetDisplayName}}</a> + {{end}} + {{end}} + {{if $.Owner.IsOrganization}} + {{$teamIDs := .AllowlistTeamIDs}} + {{range $.Teams}} + {{if SliceUtils.Contains $teamIDs .ID}} + <a class="ui basic label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a> + {{end}} + {{end}} + {{end}} + {{else}} + {{ctx.Locale.Tr "repo.settings.tags.protection.allowed.noone"}} + {{end}} + </td> + <td class="right aligned"> + <a class="ui tiny primary button" href="{{$.RepoLink}}/settings/tags/{{.ID}}">{{ctx.Locale.Tr "edit"}}</a> + <form class="tw-inline-block" action="{{$.RepoLink}}/settings/tags/delete" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{.ID}}"> + <button class="ui tiny red button">{{ctx.Locale.Tr "remove"}}</button> + </form> + </td> + </tr> + {{else}} + <tr class="center aligned"><td colspan="3">{{ctx.Locale.Tr "repo.settings.tags.protection.none"}}</td></tr> + {{end}} + </tbody> + </table> + </div> + </div> + </div> + {{end}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/units.tmpl b/templates/repo/settings/units.tmpl new file mode 100644 index 00000000..66ed0359 --- /dev/null +++ b/templates/repo/settings/units.tmpl @@ -0,0 +1,13 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}} +<div class="user-main-content twelve wide column"> + <form class="ui form" method="post" action="{{.RepoLink}}/settings/units"> + {{.CsrfTokenHtml}} + {{template "repo/settings/units/overview" .}} + {{template "repo/settings/units/issues" .}} + {{if not .IsMirror}} + {{template "repo/settings/units/pulls" .}} + {{end}} + {{template "repo/settings/units/wiki" .}} + </form> +</div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/units/issues.tmpl b/templates/repo/settings/units/issues.tmpl new file mode 100644 index 00000000..b4217ddf --- /dev/null +++ b/templates/repo/settings/units/issues.tmpl @@ -0,0 +1,102 @@ +<h4 class="ui top attached header" id="issues"> + {{ctx.Locale.Tr "repo.issues"}} +</h4> +<div class="ui attached segment"> + {{$isIssuesEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeIssues) (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}} + {{$isIssuesGlobalDisabled := .UnitTypeIssues.UnitGlobalDisabled}} + {{$isExternalTrackerGlobalDisabled := .UnitTypeExternalTracker.UnitGlobalDisabled}} + {{$isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.issues"}}</label> + <div class="ui checkbox{{if $isIssuesAndExternalGlobalDisabled}} disabled{{end}}"{{if $isIssuesAndExternalGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if $isIssuesEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.issues_desc"}}</label> + </div> + </div> + <div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box"> + <div class="field"> + <div class="ui radio checkbox{{if $isIssuesGlobalDisabled}} disabled{{end}}"{{if $isIssuesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_internal_issue_tracker"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}disabled{{end}}" id="internal_issue_box"> + {{if .Repository.CanEnableTimetracker}} + <div class="field"> + <div class="ui checkbox"> + <input name="enable_timetracker" class="enable-system" data-target="#only_contributors" type="checkbox" {{if .Repository.IsTimetrackerEnabled $.Context}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.enable_timetracker"}}</label> + </div> + </div> + <div class="field {{if not (.Repository.IsTimetrackerEnabled $.Context)}}disabled{{end}}" id="only_contributors"> + <div class="ui checkbox"> + <input name="allow_only_contributors_to_track_time" type="checkbox" {{if .Repository.AllowOnlyContributorsToTrackTime $.Context}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.allow_only_contributors_to_track_time"}}</label> + </div> + </div> + {{end}} + <div class="field"> + <div class="ui checkbox"> + <input name="enable_issue_dependencies" type="checkbox" {{if (.Repository.IsDependenciesEnabled $.Context)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.issues.dependency.setting"}}</label> + </div> + </div> + <div class="ui checkbox"> + <input name="enable_close_issues_via_commit_in_any_branch" type="checkbox" {{if .Repository.CloseIssuesViaCommitInAnyBranch}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.admin_enable_close_issues_via_commit_in_any_branch"}}</label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox{{if $isExternalTrackerGlobalDisabled}} disabled{{end}}"{{if $isExternalTrackerGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_external_issue_tracker"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}disabled{{end}}" id="external_issue_box"> + <div class="field"> + <label for="external_tracker_url">{{ctx.Locale.Tr "repo.settings.external_tracker_url"}}</label> + <input id="external_tracker_url" name="external_tracker_url" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerURL}}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.external_tracker_url_desc"}}</p> + </div> + <div class="field"> + <label for="tracker_url_format">{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}</label> + <input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="https://github.com/{user}/{repo}/issues/{index}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc"}}</p> + </div> + <div class="inline fields"> + <label for="issue_style">{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}</label> + <div class="field"> + <div class="ui radio checkbox"> + {{$externalTracker := (.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker)}} + {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}} + <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="numeric" {{if eq $externalTrackerStyle "numeric"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.numeric"}} <span class="ui light grey text">#1234</span></label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="alphanumeric" {{if eq $externalTrackerStyle "alphanumeric"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.alphanumeric"}} <span class="ui light grey text">ABC-123 , DEFG-234</span></label> + </div> + </div> + <div class="field"> + <div class="ui radio checkbox"> + <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="regexp" {{if eq $externalTrackerStyle "regexp"}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp"}} <span class="ui light grey text">(ISSUE-\d+) , ISSUE-(\d+)</span></label> + </div> + </div> + </div> + <div class="field {{if ne $externalTrackerStyle "regexp"}}disabled{{end}}" id="tracker-issue-style-regex-box"> + <label for="external_tracker_regexp_pattern">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}</label> + <input id="external_tracker_regexp_pattern" name="external_tracker_regexp_pattern" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerRegexpPattern}}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc"}}</p> + </div> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/units/overview.tmpl b/templates/repo/settings/units/overview.tmpl new file mode 100644 index 00000000..a851c66d --- /dev/null +++ b/templates/repo/settings/units/overview.tmpl @@ -0,0 +1,62 @@ +<h4 class="ui top attached header" id="overview"> + {{ctx.Locale.Tr "repo.settings.units.overview"}} +</h4> +<div class="ui attached segment"> + {{$isCodeEnabled := .Repository.UnitEnabled $.Context $.UnitTypeCode}} + {{$isCodeGlobalDisabled := .UnitTypeCode.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.code"}}</label> + <div class="ui checkbox{{if $isCodeGlobalDisabled}} disabled{{end}}"{{if $isCodeGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_code" type="checkbox"{{if $isCodeEnabled}} checked{{end}}> + <label>{{ctx.Locale.Tr "repo.code.desc"}}</label> + </div> + </div> + + {{$isProjectsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeProjects}} + {{$isProjectsGlobalDisabled := .UnitTypeProjects.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.projects"}}</label> + <div class="ui checkbox{{if $isProjectsGlobalDisabled}} disabled{{end}}"{{if $isProjectsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_projects" type="checkbox" {{if $isProjectsEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.projects_desc"}}</label> + </div> + </div> + + {{$isReleasesEnabled := .Repository.UnitEnabled $.Context $.UnitTypeReleases}} + {{$isReleasesGlobalDisabled := .UnitTypeReleases.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.releases"}}</label> + <div class="ui checkbox{{if $isReleasesGlobalDisabled}} disabled{{end}}"{{if $isReleasesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_releases" type="checkbox" {{if $isReleasesEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.releases_desc"}}</label> + </div> + </div> + + {{$isPackagesEnabled := .Repository.UnitEnabled $.Context $.UnitTypePackages}} + {{$isPackagesGlobalDisabled := .UnitTypePackages.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.packages"}}</label> + <div class="ui checkbox{{if $isPackagesGlobalDisabled}} disabled{{end}}"{{if $isPackagesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_packages" type="checkbox" {{if $isPackagesEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.packages_desc"}}</label> + </div> + </div> + + {{if .EnableActions}} + {{$isActionsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeActions}} + {{$isActionsGlobalDisabled := .UnitTypeActions.UnitGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "actions.actions"}}</label> + <div class="ui checkbox{{if $isActionsGlobalDisabled}} disabled{{end}}"{{if $isActionsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_actions" type="checkbox" {{if $isActionsEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.actions_desc"}}</label> + </div> + </div> + {{end}} + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/units/pulls.tmpl b/templates/repo/settings/units/pulls.tmpl new file mode 100644 index 00000000..4e9c53e0 --- /dev/null +++ b/templates/repo/settings/units/pulls.tmpl @@ -0,0 +1,132 @@ +<h4 class="ui top attached header" id="pulls"> + {{ctx.Locale.Tr "repo.pulls"}} +</h4> +<div class="ui attached segment"> + {{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}} + {{$pullRequestGlobalDisabled := .UnitTypePullRequests.UnitGlobalDisabled}} + {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.pulls"}}</label> + <div class="ui checkbox{{if $pullRequestGlobalDisabled}} disabled{{end}}"{{if $pullRequestGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if $pullRequestEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls_desc"}}</label> + </div> + </div> + <div class="field{{if not $pullRequestEnabled}} disabled{{end}}" id="pull_box"> + <div class="field"> + <p> + {{ctx.Locale.Tr "repo.settings.merge_style_desc"}} + </p> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_rebase" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebase)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_rebase_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_squash" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowSquash)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_fast_forward_only" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowFastForwardOnly)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowManualMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.pulls.merge_manually"}}</label> + </div> + </div> + + <div class="field"> + <p> + {{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}} + </p> + <div class="ui dropdown selection"> + <select name="pulls_default_merge_style"> + <option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</option> + <option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option> + <option value="rebase-merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</option> + <option value="squash" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</option> + <option value="fast-forward-only" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</option> + </select>{{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="default text"> + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}} + {{ctx.Locale.Tr "repo.pulls.merge_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}} + {{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}} + {{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}} + {{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}} + {{end}} + {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "fast-forward-only")}} + {{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}} + {{end}} + </div> + <div class="menu"> + <div class="item" data-value="merge">{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</div> + <div class="item" data-value="rebase">{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</div> + <div class="item" data-value="rebase-merge">{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div> + <div class="item" data-value="squash">{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</div> + <div class="item" data-value="fast-forward-only">{{ctx.Locale.Tr "repo.pulls.fast_forward_only_merge_pull_request"}}</div> + </div> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="default_allow_maintainer_edit" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultAllowMaintainerEdit)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label> + </div> + </div> + </div> + + <div class="divider"></div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/units/wiki.tmpl b/templates/repo/settings/units/wiki.tmpl new file mode 100644 index 00000000..23df294b --- /dev/null +++ b/templates/repo/settings/units/wiki.tmpl @@ -0,0 +1,51 @@ +<h4 class="ui top attached header" id="wiki"> + {{ctx.Locale.Tr "repo.wiki"}} +</h4> +<div class="ui attached segment"> + {{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}} + {{$isWikiGlobalDisabled := .UnitTypeWiki.UnitGlobalDisabled}} + {{$isExternalWikiGlobalDisabled := .UnitTypeExternalWiki.UnitGlobalDisabled}} + {{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}} + <div class="inline field"> + <label>{{ctx.Locale.Tr "repo.wiki"}}</label> + <div class="ui checkbox{{if $isBothWikiGlobalDisabled}} disabled{{end}}"{{if $isBothWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if $isWikiEnabled}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.wiki_desc"}}</label> + </div> + </div> + <div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box"> + <div class="field"> + <div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_wiki" type="radio" value="false" data-context="#globally_writeable_checkbox" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_internal_wiki"}}</label> + </div> + </div> + {{if (not .Repository.IsPrivate)}} + <div class="field {{if (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}disabled{{end}}" id="globally_writeable_checkbox"> + <div class="field tw-pl-4"> + <div class="ui checkbox"> + <input name="globally_writeable_wiki" type="checkbox" {{if .Permission.IsGloballyWriteable $.UnitTypeWiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.wiki_globally_editable"}}</label> + </div> + </div> + </div> + {{end}} + <div class="field"> + <div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}> + <input class="enable-system-radio" name="enable_external_wiki" type="radio" value="true" data-context="#globally_writeable_checkbox" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.use_external_wiki"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}disabled{{end}}" id="external_wiki_box"> + <label for="external_wiki_url">{{ctx.Locale.Tr "repo.settings.external_wiki_url"}}</label> + <input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}"> + <p class="help">{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}</p> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button> + </div> +</div> diff --git a/templates/repo/settings/webhook/base.tmpl b/templates/repo/settings/webhook/base.tmpl new file mode 100644 index 00000000..d5247224 --- /dev/null +++ b/templates/repo/settings/webhook/base.tmpl @@ -0,0 +1,5 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings webhooks")}} + <div class="repo-setting-content"> + {{template "repo/settings/webhook/list" .}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/webhook/base_list.tmpl b/templates/repo/settings/webhook/base_list.tmpl new file mode 100644 index 00000000..36e75a7e --- /dev/null +++ b/templates/repo/settings/webhook/base_list.tmpl @@ -0,0 +1,26 @@ +<h4 class="ui top attached header"> + {{.Title}} + <div class="ui right"> + <div class="ui jump dropdown"> + <div class="ui primary tiny button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</div> + {{template "repo/settings/webhook/link_menu" .}} + </div> + </div> +</h4> +<div class="ui attached segment"> + <div class="ui list"> + <div class="item"> + {{.Description}} + </div> + {{range .Webhooks}} + <div class="item truncated-item-container"> + <span class="text {{if eq .LastStatus 1}}green{{else if eq .LastStatus 2}}red{{else}}grey{{end}} tw-mr-2">{{svg "octicon-dot-fill" 22}}</span> + <div class="text truncate tw-flex-1 tw-mr-2"> + <a title="{{.URL}}" href="{{$.BaseLink}}/{{.ID}}">{{.URL}}</a> + </div> + <a class="muted tw-p-2" href="{{$.BaseLink}}/{{.ID}}">{{svg "octicon-pencil"}}</a> + <a class="delete-button tw-p-2" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}}</a> + </div> + {{end}} + </div> +</div> diff --git a/templates/repo/settings/webhook/delete_modal.tmpl b/templates/repo/settings/webhook/delete_modal.tmpl new file mode 100644 index 00000000..9955ed3a --- /dev/null +++ b/templates/repo/settings/webhook/delete_modal.tmpl @@ -0,0 +1,10 @@ +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.webhook_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl new file mode 100644 index 00000000..8ee1446a --- /dev/null +++ b/templates/repo/settings/webhook/history.tmpl @@ -0,0 +1,90 @@ +{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}} +{{if .PageIsSettingsHooksEdit}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.recent_deliveries"}} + {{if .Permission.IsAdmin}} + <div class="ui right"> + <!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button --> + <span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}"> + <button class="ui teal tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}"> + <span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span> + </button> + </span> + </div> + {{end}} + </h4> + <div class="ui attached segment"> + <div class="ui list"> + {{range .History}} + <div class="item"> + <div class="flex-text-block tw-justify-between"> + <div class="flex-text-inline"> + {{if .IsSucceed}} + <span class="text green">{{svg "octicon-check"}}</span> + {{else if not .IsDelivered}} + <span class="text orange">{{svg "octicon-stopwatch"}}</span> + {{else}} + <span class="text red">{{svg "octicon-alert"}}</span> + {{end}} + <a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a> + </div> + <span class="text grey"> + {{TimeSince .Delivered.AsTime ctx.Locale}} + </span> + </div> + <div class="info tw-hidden" id="info-{{.ID}}"> + <div class="ui top attached tabular menu"> + <a class="item active" data-tab="request-{{.ID}}">{{ctx.Locale.Tr "repo.settings.webhook.request"}}</a> + <a class="item" data-tab="response-{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.webhook.response"}} + {{if .ResponseInfo}} + {{if .IsSucceed}} + <span class="ui green label">{{.ResponseInfo.Status}}</span> + {{else}} + <span class="ui red label">{{.ResponseInfo.Status}}</span> + {{end}} + {{else}} + <span class="ui label">-</span> + {{end}} + </a> + {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}} + <div class="right menu"> + <form class="item" action="{{$.Link}}/replay/{{.UUID}}" method="post"> + {{$.CsrfTokenHtml}} + <span data-tooltip-content="{{if $.Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description_disabled"}}{{end}}"> + <button class="ui tiny button{{if not $.Webhook.IsActive}} disabled{{end}}">{{svg "octicon-sync"}}</button> + </span> + </form> + </div> + {{end}} + </div> + <div class="ui bottom attached tab segment active" data-tab="request-{{.ID}}"> + {{if .RequestInfo}} + <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5> + <pre class="webhook-info"><strong>Request URL:</strong> {{.RequestInfo.URL}} +<strong>Request method:</strong> {{if .RequestInfo.HTTPMethod}}{{.RequestInfo.HTTPMethod}}{{else}}POST{{end}} +{{range $key, $val := .RequestInfo.Headers}}<strong>{{$key}}:</strong> {{$val}} +{{end}}</pre> + <h5>{{ctx.Locale.Tr "repo.settings.webhook.payload"}}</h5> + <pre class="webhook-info"><code class="json">{{or .RequestInfo.Body .PayloadContent}}</code></pre> + {{else}} + - + {{end}} + </div> + <div class="ui bottom attached tab segment" data-tab="response-{{.ID}}"> + {{if .ResponseInfo}} + <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5> + <pre class="webhook-info">{{range $key, $val := .ResponseInfo.Headers}}<strong>{{$key}}:</strong> {{$val}} +{{end}}</pre> + <h5>{{ctx.Locale.Tr "repo.settings.webhook.body"}}</h5> + <pre class="webhook-info"><code>{{.ResponseInfo.Body}}</code></pre> + {{else}} + - + {{end}} + </div> + </div> + </div> + {{end}} + </div> + </div> +{{end}} diff --git a/templates/repo/settings/webhook/link_menu.tmpl b/templates/repo/settings/webhook/link_menu.tmpl new file mode 100644 index 00000000..2edc5af4 --- /dev/null +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -0,0 +1,12 @@ +{{$size := 20}} +{{if .Size}} + {{$size = .Size}} +{{end}} +<div class="menu"> + {{range .WebhookList}} + <a class="item" href="{{$.BaseLinkNew}}/{{.Type}}/new"> + {{.Icon $size}} + {{ctx.Locale.Tr (print "repo.settings.web_hook_name_" .Type)}} + </a> + {{end}} +</div> diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl new file mode 100644 index 00000000..b24159fc --- /dev/null +++ b/templates/repo/settings/webhook/list.tmpl @@ -0,0 +1,4 @@ + +{{template "repo/settings/webhook/base_list" .}} + +{{template "repo/settings/webhook/delete_modal" .}} diff --git a/templates/repo/settings/webhook/new.tmpl b/templates/repo/settings/webhook/new.tmpl new file mode 100644 index 00000000..b04a4421 --- /dev/null +++ b/templates/repo/settings/webhook/new.tmpl @@ -0,0 +1,7 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings new webhook")}} + <div class="repo-setting-content"> + {{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}} + {{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}} + {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/shabox_badge.tmpl b/templates/repo/shabox_badge.tmpl new file mode 100644 index 00000000..939292ba --- /dev/null +++ b/templates/repo/shabox_badge.tmpl @@ -0,0 +1,15 @@ +<div class="ui detail icon button"> + {{if .verification.Verified}} + <div title="{{if eq .verification.TrustStatus "trusted"}}{{else if eq .verification.TrustStatus "untrusted"}}{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.verification.Reason}}"> + {{if ne .verification.SigningUser.ID 0}} + {{svg "gitea-lock"}} + {{ctx.AvatarUtils.Avatar .verification.SigningUser 28 "signature"}} + {{else}} + <span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span> + {{ctx.AvatarUtils.AvatarByEmail .verification.SigningEmail "" 28 "signature"}} + {{end}} + </div> + {{else}} + <span title="{{ctx.Locale.Tr .verification.Reason}}">{{svg "gitea-unlock"}}</span> + {{end}} +</div> diff --git a/templates/repo/star_unstar.tmpl b/templates/repo/star_unstar.tmpl new file mode 100644 index 00000000..a407aa62 --- /dev/null +++ b/templates/repo/star_unstar.tmpl @@ -0,0 +1,14 @@ +<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star"> + <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.star_guest_user"}}"{{end}}> + <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}> + {{if $.IsStaringRepo}} + {{svg "octicon-star-fill"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.unstar"}}</span> + {{else}} + {{svg "octicon-star"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.star"}}</span> + {{end}} + </button> + <a hx-boost="false" class="ui basic label" href="{{$.RepoLink}}/stars"> + {{CountFmt .Repository.NumStars}} + </a> + </div> +</form> diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl new file mode 100644 index 00000000..ddf01b33 --- /dev/null +++ b/templates/repo/sub_menu.tmpl @@ -0,0 +1,45 @@ +{{if and (not .HideRepoInfo) (not .IsBlame)}} +<div class="ui segments repository-summary tw-mt-1 tw-mb-0"> + <div class="ui segment sub-menu repository-menu"> + {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo)}} + <a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}"> + {{svg "octicon-history"}} {{ctx.Locale.TrN .CommitsCount "repo.n_commit_one" "repo.n_commit_few" (printf "<b>%d</b>" .CommitsCount | SafeHTML)}} + </a> + <a class="item muted {{if .PageIsBranches}}active{{end}}" href="{{.RepoLink}}/branches"> + {{svg "octicon-git-branch"}} {{ctx.Locale.TrN .BranchesCount "repo.n_branch_one" "repo.n_branch_few" (printf "<b>%d</b>" .BranchesCount | SafeHTML)}} + </a> + {{if $.Permission.CanRead $.UnitTypeCode}} + <a class="item muted {{if .PageIsTagList}}active{{end}}" href="{{.RepoLink}}/tags"> + {{svg "octicon-tag"}} {{ctx.Locale.TrN .NumTags "repo.n_tag_one" "repo.n_tag_few" (printf "<b>%d</b>" .NumTags | SafeHTML)}} + </a> + {{end}} + <span class="item not-mobile" {{if not (eq .Repository.Size 0)}}data-tooltip-content="{{.Repository.SizeDetailsString ctx.Locale}}"{{end}}> + {{$fileSizeFields := ctx.Locale.TrSize .Repository.Size}} + {{svg "octicon-database"}} <b>{{$fileSizeFields.PrettyNumber}}</b> {{$fileSizeFields.TranslatedUnit}} + </span> + {{end}} + </div> + {{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats}} + <div class="ui segment sub-menu language-stats-details tw-hidden"> + {{range .LanguageStats}} + <div class="item"> + <i class="color-icon" style="background-color: {{.Color}}"></i> + <span class="tw-font-semibold"> + {{if eq .Language "other"}} + {{ctx.Locale.Tr "repo.language_other"}} + {{else}} + {{.Language}} + {{end}} + </span> + {{.Percentage}}% + </div> + {{end}} + </div> + <a class="ui segment language-stats show-panel toggle" data-panel=".repository-summary > .sub-menu"> + {{range .LanguageStats}} + <div class="bar" style="width: {{.Percentage}}%; background-color: {{.Color}}" data-tooltip-placement="top" data-tooltip-content={{.Language}} data-tooltip-follow-cursor="horizontal"></div> + {{end}} + </a> + {{end}} +</div> +{{end}} diff --git a/templates/repo/tag/list.tmpl b/templates/repo/tag/list.tmpl new file mode 100644 index 00000000..82f3dc04 --- /dev/null +++ b/templates/repo/tag/list.tmpl @@ -0,0 +1,79 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository tags"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{template "repo/release_tag_header" .}} + <h4 class="ui top attached header"> + <div class="five wide column tw-flex tw-items-center"> + {{svg "octicon-tag" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.release.tags"}} + </div> + </h4> + {{$canReadReleases := $.Permission.CanRead $.UnitTypeReleases}} + <div class="ui attached table segment"> + <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"> + <h3 class="release-tag-name tw-mb-2 tw-flex"> + {{if $canReadReleases}} + <a class="tw-flex tw-items-center" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{else}} + <a class="tw-flex tw-items-center" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{end}} + {{template "repo/tag/verification_box" (dict "ctxData" $ "release" $release)}} + </h3> + <div class="download tw-flex tw-items-center"> + {{if $.Permission.CanRead $.UnitTypeCode}} + {{if .CreatedUnix}} + <span class="tw-mr-2">{{svg "octicon-clock" 16 "tw-mr-1"}}{{TimeSinceUnix .CreatedUnix ctx.Locale}}</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> + + {{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 (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 ($.Permission.CanWrite $.UnitTypeCode) $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 $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> + </div> + + {{template "base/paginate" .}} + </div> +</div> + +{{if $.Permission.CanWrite $.UnitTypeCode}} +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.release.delete_tag"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.release.deletion_tag_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> +{{end}} + +{{template "base/footer" .}} diff --git a/templates/repo/tag/verification_box.tmpl b/templates/repo/tag/verification_box.tmpl new file mode 100644 index 00000000..3cf88ac2 --- /dev/null +++ b/templates/repo/tag/verification_box.tmpl @@ -0,0 +1,27 @@ +{{$v := call .ctxData.VerifyTag .release}} +{{if call .ctxData.HasSignature $v}} + {{$class := "isSigned"}} + {{$href := ""}} + {{if $v.Verified}} + {{$href = $v.SigningUser.HomeLink}} + {{$class = (print $class " isVerified")}} + {{else}} + {{$class = (print $class " isWarning")}} + {{end}} + + <a {{if $href}}href="{{$href}}"{{end}} class="ui label tw-ml-2 {{$class}}"> + {{if $v.Verified}} + <div title="{{$v.Reason}}"> + {{if ne $v.SigningUser.ID 0}} + {{svg "gitea-lock"}} + {{ctx.AvatarUtils.Avatar $v.SigningUser 28 "signature"}} + {{else}} + <span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span> + {{ctx.AvatarUtils.AvatarByEmail $v.Verification.SigningEmail "" 28 "signature"}} + {{end}} + </div> + {{else}} + <span title="{{ctx.Locale.Tr $v.Reason}}">{{svg "gitea-unlock"}}</span> + {{end}} + </a> +{{end}} diff --git a/templates/repo/tag/verification_line.tmpl b/templates/repo/tag/verification_line.tmpl new file mode 100644 index 00000000..5f8335ab --- /dev/null +++ b/templates/repo/tag/verification_line.tmpl @@ -0,0 +1,80 @@ +{{$v := call .ctxData.VerifyTag .release}} +{{if call .ctxData.HasSignature $v}} + {{$class := "isSigned"}} + {{$href := ""}} + {{if $v.Verified}} + {{$href = $v.SigningUser.HomeLink}} + {{$class = (print $class " isVerified")}} + {{else}} + {{$class = (print $class " isWarning")}} + {{end}} + + <div class="ui attached message tw-text-left tw-flex tw-content-center tw-justify-between tag-signature-row tw-flex-wrap {{$class}}"> + <div class="tw-flex tw-content-center"> + {{if $v.Verified}} + {{if ne $v.SigningUser.ID 0}} + {{svg "gitea-lock" 16 "tw-mr-2"}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}</span> + {{ctx.AvatarUtils.Avatar $v.SigningUser 28 "tw-mr-2"}} + <a href="{{$v.SigningUser.HomeLink}}"><strong>{{$v.SigningUser.GetDisplayName}}</strong></a> + {{else}} + <span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "tw-mr-2"}}</span> + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span> + {{ctx.AvatarUtils.AvatarByEmail $v.SigningEmail "" 28 "tw-mr-2"}} + <strong>{{$v.SigningUser.GetDisplayName}}</strong> + {{end}} + {{else}} + {{svg "gitea-unlock" 16 "tw-mr-2"}} + <span class="ui text">{{ctx.Locale.Tr $v.Reason}}</span> + {{end}} + </div> + + <div class="tw-flex tw-content-center"> + {{if $v.Verified}} + {{if ne $v.SigningUser.ID 0}} + {{svg "octicon-verified" 16 "tw-mr-2"}} + {{if $v.SigningSSHKey}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{$v.SigningSSHKey.Fingerprint}} + {{else}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{$v.SigningKey.PaddedKeyID}} + {{end}} + {{else}} + {{svg "octicon-unverified" 16 "tw-mr-2"}} + {{if $v.SigningSSHKey}} + <span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{$v.SigningSSHKey.Fingerprint}} + {{else}} + <span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{$v.SigningKey.PaddedKeyID}} + {{end}} + {{end}} + {{else if $v.Warning}} + {{svg "octicon-unverified" 16 "tw-mr-2"}} + {{if $v.SigningSSHKey}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{$v.SigningSSHKey.Fingerprint}} + {{else}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{$v.SigningKey.PaddedKeyID}} + {{end}} + {{else}} + {{if $v.SigningKey}} + {{if ne $v.SigningKey.KeyID ""}} + {{svg "octicon-verified" 16 "tw-mr-2"}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span> + {{$v.SigningKey.PaddedKeyID}} + {{end}} + {{end}} + {{if $v.SigningSSHKey}} + {{if ne $v.SigningSSHKey.Fingerprint ""}} + {{svg "octicon-verified" 16 "tw-mr-2"}} + <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> + {{$v.SigningSSHKey.Fingerprint}} + {{end}} + {{end}} + {{end}} + </div> + </div> +{{end}} diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl new file mode 100644 index 00000000..8bceafa8 --- /dev/null +++ b/templates/repo/unicode_escape_prompt.tmpl @@ -0,0 +1,22 @@ +{{if .EscapeStatus}} + {{if .EscapeStatus.HasInvisible}} + <div class="ui warning message unicode-escape-prompt tw-text-left"> + <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> + {{if .EscapeStatus.HasAmbiguous}} + <p>{{ctx.Locale.Tr "repo.ambiguous_runes_description"}}</p> + {{end}} + </div> + {{else if .EscapeStatus.HasAmbiguous}} + <div class="ui warning message unicode-escape-prompt tw-text-left"> + <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> + {{end}} +{{end}} diff --git a/templates/repo/upload.tmpl b/templates/repo/upload.tmpl new file mode 100644 index 00000000..eef51994 --- /dev/null +++ b/templates/repo/upload.tmpl @@ -0,0 +1,15 @@ +<div + class="ui dropzone" + data-link-url="{{.UploadLinkUrl}}" + data-upload-url="{{.UploadUrl}}" + data-remove-url="{{.UploadRemoveUrl}}" + data-accepts="{{.UploadAccepts}}" + data-max-file="{{.UploadMaxFiles}}" + data-max-size="{{.UploadMaxSize}}" + data-default-message="{{ctx.Locale.Tr "dropzone.default_message"}}" + data-invalid-input-type="{{ctx.Locale.Tr "dropzone.invalid_input_type"}}" + data-file-too-big="{{ctx.Locale.Tr "dropzone.file_too_big"}}" + data-remove-file="{{ctx.Locale.Tr "dropzone.remove_file"}}" +> + <div class="files"></div> +</div> diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl new file mode 100644 index 00000000..9061b177 --- /dev/null +++ b/templates/repo/user_cards.tmpl @@ -0,0 +1,29 @@ +<div class="user-cards"> + {{if .CardsTitle}} + <h2 class="tw-mb-0"> + {{.CardsTitle}} + </h2> + {{end}} + <ul class="list"> + {{range .Cards}} + <li class="item ui segment"> + <a href="{{.HomeLink}}"> + {{ctx.AvatarUtils.Avatar .}} + </a> + <h3 class="name"><a href="{{.HomeLink}}">{{.DisplayName}}</a></h3> + + <div class="meta"> + {{if .Website}} + {{svg "octicon-link"}} <a href="{{.Website}}" target="_blank" rel="noopener noreferrer">{{.Website}}</a> + {{else if .Location}} + {{svg "octicon-location"}} {{.Location}} + {{else}} + {{svg "octicon-calendar"}} {{ctx.Locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix)}} + {{end}} + </div> + </li> + {{end}} + </ul> + + {{template "base/paginate" .}} +</div> diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl new file mode 100644 index 00000000..d127c2ef --- /dev/null +++ b/templates/repo/view_file.tmpl @@ -0,0 +1,158 @@ +<div {{if .ReadmeInList}}id="readme" {{end}}class="{{TabSizeClass .Editorconfig .FileName}} non-diff-file-content"> + {{- if .FileError}} + <div class="ui error message"> + <div class="text left tw-whitespace-pre">{{.FileError}}</div> + </div> + {{end}} + {{- if .FileWarning}} + <div class="ui warning message"> + <div class="text left tw-whitespace-pre">{{.FileWarning}}</div> + </div> + {{end}} + + {{if not .ReadmeInList}} + <div id="repo-file-commit-box" class="ui segment list-header tw-mb-4 tw-flex tw-justify-between"> + <div class="latest-commit"> + {{template "repo/latest_commit" .}} + </div> + {{if .LatestCommit}} + {{if .LatestCommit.Committer}} + <div class="text grey age"> + {{TimeSince .LatestCommit.Committer.When ctx.Locale}} + </div> + {{end}} + {{end}} + </div> + {{end}} + + <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"> + {{if .ReadmeInList}} + {{svg "octicon-book" 16 "tw-mr-2"}} + <strong><a class="default-link muted" href="#readme">{{.FileName}}</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}} + {{if not .ReadmeInList}} + <div class="ui buttons tw-mr-1"> + {{if .SymlinkURL}} + <a class="ui mini basic button" href="{{$.SymlinkURL}}" data-kind="follow-symlink">{{ctx.Locale.Tr "repo.file_follow"}}</a> + {{end}} + <a class="ui mini basic button" href="{{$.RawFileLink}}">{{ctx.Locale.Tr "repo.file_raw"}}</a> + {{if not .IsViewCommit}} + <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> + {{end}} + <a class="ui mini basic button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{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 href="{{$.RawFileLink}}"><span class="btn-octicon" data-tooltip-content="{{ctx.Locale.Tr "repo.download_file"}}">{{svg "octicon-download"}}</span></a> + <a href="#" 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" 14}}</a> + {{if .EnableFeed}} + {{if .IsViewBranch}} + <a class="btn-octicon" href="{{$.FeedURL}}/rss/{{$.BranchNameSubURL}}/{{PathEscapeSegments .TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}"> + {{svg "octicon-rss" 14}} + </a> + {{else}} + <span class="btn-octicon disabled" data-tooltip-content="{{ctx.Locale.Tr "repo.rss.must_be_on_branch"}}"> + {{svg "octicon-rss" 14}} + </span> + {{end}} + {{end}} + {{if .Repository.CanEnableEditor}} + {{if .CanEditFile}} + <a href="{{.RepoLink}}/_edit/{{PathEscapeSegments .BranchName}}/{{PathEscapeSegments .TreePath}}"><span class="btn-octicon" data-tooltip-content="{{.EditFileTooltip}}">{{svg "octicon-pencil"}}</span></a> + {{else}} + <span class="btn-octicon disabled" data-tooltip-content="{{.EditFileTooltip}}">{{svg "octicon-pencil"}}</span> + {{end}} + {{if .CanDeleteFile}} + <a href="{{.RepoLink}}/_delete/{{PathEscapeSegments .BranchName}}/{{PathEscapeSegments .TreePath}}"><span class="btn-octicon btn-octicon-danger" data-tooltip-content="{{.DeleteFileTooltip}}">{{svg "octicon-trash"}}</span></a> + {{else}} + <span class="btn-octicon disabled" data-tooltip-content="{{.DeleteFileTooltip}}">{{svg "octicon-trash"}}</span> + {{end}} + {{end}} + {{else if .EscapeStatus.Escaped}} + <button class="ui mini basic button unescape-button tw-mr-1 tw-hidden">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button> + <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> + {{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" $}} + {{end}} + <div class="file-view{{if .IsMarkup}} markup {{.MarkupType}}{{else if .IsPlainText}} plain-text{{else if .IsTextSource}} code-view{{end}}"> + {{if .IsMarkup}} + {{if .FileContent}}{{.FileContent}}{{end}} + {{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">{{ctx.Locale.Tr "repo.file_view_raw"}}</a> + {{end}} + </div> + {{else if .FileSize}} + {{if .IsFileTooLarge}} + <table> + <tbody> + <tr> + <td><strong>{{ctx.Locale.Tr "repo.file_too_large"}}</strong></td> + </tr> + </tbody> + </table> + {{else}} + <table> + <tbody> + {{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> + {{if $.EscapeStatus.Escaped}} + <td class="lines-escape">{{if (index $.LineEscapeStatus $idx).Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{if (index $.LineEscapeStatus $idx).HasInvisible}}{{ctx.Locale.Tr "repo.invisible_runes_line"}} {{end}}{{if (index $.LineEscapeStatus $idx).HasAmbiguous}}{{ctx.Locale.Tr "repo.ambiguous_runes_line"}}{{end}}"></button>{{end}}</td> + {{end}} + <td rel="L{{$line}}" class="lines-code chroma"><code class="code-inner">{{$code}}</code></td> + </tr> + {{end}} + </tbody> + </table> + <div class="code-line-menu tippy-target"> + {{if $.Permission.CanRead $.UnitTypeIssues}} + <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> + {{end}} + {{end}} + </div> + </div> +</div> diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl new file mode 100644 index 00000000..7ec9acc8 --- /dev/null +++ b/templates/repo/view_list.tmpl @@ -0,0 +1,73 @@ +<table id="repo-files-table" class="ui single line table tw-mt-0" {{if .HasFilesWithoutLatestCommit}}hx-indicator="tr.notready td.message span" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}> + <thead> + <tr class="commit-list"> + <th class="tw-overflow-hidden" colspan="2"> + <div class="tw-flex"> + <div class="latest-commit"> + {{template "repo/latest_commit" .}} + </div> + </div> + </th> + <th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When ctx.Locale}}{{end}}{{end}}</th> + </tr> + </thead> + <tbody> + {{if .HasParentPath}} + <tr class="has-parent"> + <td colspan="3">{{svg "octicon-reply"}}<a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a></td> + </tr> + {{end}} + {{range $item := .Files}} + {{$entry := $item.Entry}} + {{$commit := $item.Commit}} + {{$subModuleFile := $item.SubModuleFile}} + <tr data-entryname="{{$entry.Name}}" data-ready="{{if $commit}}true{{else}}false{{end}}" class="{{if not $commit}}not{{end}}ready entry"> + <td class="name four wide"> + <span class="truncate"> + {{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> + {{else}} + {{$entry.Name}}<span class="at">@</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}}"> + {{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}} + {{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}} + {{if eq $subJumpablePathFieldLast 0}} + {{$subJumpablePathName}} + {{else}} + {{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}} + <span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}} + {{end}} + </a> + {{else}} + {{svg (printf "octicon-%s" (EntryIcon $entry))}} + <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> + {{end}} + {{end}} + </span> + </td> + <td class="message nine wide"> + <span class="truncate"> + {{if $commit}} + {{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}} + {{RenderCommitMessageLinkSubject $.Context $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}} + {{else}} + <div class="ui active tiny slow centered inline"></div> + {{end}} + </span> + </td> + <td class="text right age three wide">{{if $commit}}{{TimeSince $commit.Committer.When ctx.Locale}}{{end}}</td> + </tr> + {{end}} + </tbody> +</table> +{{if and .ReadmeExist (or .IsMarkup .IsPlainText)}} + {{template "repo/view_file" .}} +{{end}} diff --git a/templates/repo/watch_unwatch.tmpl b/templates/repo/watch_unwatch.tmpl new file mode 100644 index 00000000..3fea509e --- /dev/null +++ b/templates/repo/watch_unwatch.tmpl @@ -0,0 +1,14 @@ +<form hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch"> + <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.watch_guest_user"}}"{{end}}> + <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}> + {{if $.IsWatchingRepo}} + {{svg "octicon-eye-closed" 16}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.unwatch"}}</span> + {{else}} + {{svg "octicon-eye"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.watch"}}</span> + {{end}} + </button> + <a hx-boost="false" class="ui basic label" href="{{.RepoLink}}/watchers"> + {{CountFmt .Repository.NumWatches}} + </a> + </div> +</form> diff --git a/templates/repo/watchers.tmpl b/templates/repo/watchers.tmpl new file mode 100644 index 00000000..1828544c --- /dev/null +++ b/templates/repo/watchers.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository watchers"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "repo/user_cards" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl new file mode 100644 index 00000000..81433db0 --- /dev/null +++ b/templates/repo/wiki/new.tmpl @@ -0,0 +1,48 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository wiki new"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + <div class="ui header flex-text-block tw-justify-between"> + {{ctx.Locale.Tr "repo.wiki.new_page"}} + {{if .PageIsWikiEdit}} + <a class="ui tiny primary button" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.new_page_button"}}</a> + {{end}} + </div> + <form class="ui form" action="?action={{if .PageIsWikiEdit}}_edit{{else}}_new{{end}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Title}}error{{end}}"> + <input name="title" value="{{.title}}" aria-label="{{ctx.Locale.Tr "repo.wiki.page_title"}}" placeholder="{{ctx.Locale.Tr "repo.wiki.page_title"}}" autofocus required> + </div> + <div class="help"> + {{ctx.Locale.Tr "repo.wiki.page_name_desc"}} + </div> + + {{$content := .content}} + {{if not .PageIsWikiEdit}} + {{$content = ctx.Locale.Tr "repo.wiki.welcome"}} + {{end}} + {{template "shared/combomarkdowneditor" (dict + "MarkdownPreviewUrl" (print .Repository.Link "/markup") + "MarkdownPreviewContext" .RepoLink + "TextareaName" "content" + "TextareaPlaceholder" (ctx.Locale.Tr "repo.wiki.page_content") + "TextareaAriaLabel" (ctx.Locale.Tr "repo.wiki.page_content") + "TextareaContent" $content + "EasyMDE" true + )}} + + <div class="field tw-mt-4"> + <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"> + <button class="ui primary button"> + {{ctx.Locale.Tr "repo.wiki.save_page"}} + </button> + <a class="ui button red" href="{{.Link}}">{{ctx.Locale.Tr "repo.wiki.cancel"}}</a> + </div> + </form> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/wiki/pages.tmpl b/templates/repo/wiki/pages.tmpl new file mode 100644 index 00000000..42c36a9f --- /dev/null +++ b/templates/repo/wiki/pages.tmpl @@ -0,0 +1,30 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository wiki pages"> + {{template "repo/header" .}} + <div class="ui container"> + <h2 class="ui header tw-flex tw-items-center tw-justify-between"> + <span>{{ctx.Locale.Tr "repo.wiki.pages"}}</span> + <span> + {{if and .CanWriteWiki (not .Repository.IsMirror)}} + <a class="ui small primary button" href="{{.RepoLink}}/wiki?action=_new">{{ctx.Locale.Tr "repo.wiki.new_page_button"}}</a> + {{end}} + </span> + </h2> + <table class="ui table wiki-pages-list"> + <tbody> + {{range .Pages}} + <tr> + <td> + {{svg "octicon-file"}} + <a href="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</a> + <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 := TimeSinceUnix .UpdatedUnix ctx.Locale}} + <td class="text right">{{ctx.Locale.Tr "repo.wiki.last_updated" $timeSince}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/wiki/revision.tmpl b/templates/repo/wiki/revision.tmpl new file mode 100644 index 00000000..7fca7038 --- /dev/null +++ b/templates/repo/wiki/revision.tmpl @@ -0,0 +1,40 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository wiki revisions"> + {{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> + {{$title}} + <div class="ui sub header tw-break-anywhere"> + {{$timeSince := TimeSince .Author.When ctx.Locale}} + {{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince}} + </div> + </div> + </div> + <div class="ui eight wide column text right"> + <div class="clone-panel ui action small input"> + {{template "repo/clone_buttons" .}} + {{template "repo/clone_script" .}} + </div> + </div> + </div> + <h2 class="ui top header">{{ctx.Locale.Tr "repo.wiki.wiki_page_revisions"}}</h2> + <div class="tw-mt-4"> + <h4 class="ui top attached header"> + <div class="ui stackable grid"> + <div class="sixteen wide column"> + {{.CommitCount}} {{ctx.Locale.Tr "repo.commits.commits"}} + </div> + </div> + </h4> + {{if and .Commits (gt .CommitCount 0)}} + {{template "repo/commits_list" .}} + {{end}} + {{template "base/paginate" .}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/wiki/search.tmpl b/templates/repo/wiki/search.tmpl new file mode 100644 index 00000000..88b12b08 --- /dev/null +++ b/templates/repo/wiki/search.tmpl @@ -0,0 +1,12 @@ +{{if .Results}} + {{range .Results}} + <a class="item" href="{{$.RepoLink}}/wiki/{{.Filename}}"> + <b class="tw-block tw-mb-2">{{.Filename}}</b> + {{range .LineCodes}} + <p class="tw-my-0">{{.}}</p> + {{end}} + </a> + {{end}} +{{else}} + <div class="item muted">{{ctx.Locale.Tr "repo.wiki.no_search_results"}}</div> +{{end}} diff --git a/templates/repo/wiki/start.tmpl b/templates/repo/wiki/start.tmpl new file mode 100644 index 00000000..1b3c3d53 --- /dev/null +++ b/templates/repo/wiki/start.tmpl @@ -0,0 +1,15 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository wiki start"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="ui center segment tw-py-8"> + {{svg "octicon-book" 48}} + <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> + {{end}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl new file mode 100644 index 00000000..19b69687 --- /dev/null +++ b/templates/repo/wiki/view.tmpl @@ -0,0 +1,124 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository wiki view"> + {{template "repo/header" .}} + {{$title := .title}} + <div class="ui container"> + <div class="repo-button-row"> + <div class="tw-flex tw-items-center"> + <div class="ui floating filter dropdown" data-no-results="{{ctx.Locale.Tr "repo.pulls.no_results"}}"> + <div class="ui basic small button"> + <span class="text"> + {{ctx.Locale.Tr "repo.wiki.page"}}: + <strong>{{$title}}</strong> + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-filter" 16}}</i> + <input name="search" placeholder="{{ctx.Locale.Tr "repo.wiki.filter_page"}}..."> + </div> + <div class="scrolling menu"> + <a class="item muted" href="{{.RepoLink}}/wiki/?action=_pages">{{ctx.Locale.Tr "repo.wiki.pages"}}</a> + <div class="divider"></div> + {{range .Pages}} + <a class="item {{if eq $.Title .Name}}selected{{end}}" href="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</a> + {{end}} + </div> + </div> + </div> + </div> + <div class="clone-panel ui action small input"> + {{template "repo/clone_buttons" .}} + {{template "repo/clone_script" .}} + </div> + <div class="ui floating dropdown jump"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search"}}</i> + <input type="search" name="q" hx-get="{{$.RepoLink}}/wiki/search" hx-target="#wiki-search" hx-swap="innerHTML" hx-trigger="keyup changed delay:.5s" placeholder="{{ctx.Locale.Tr "repo.wiki.search"}}..." /> + </div> + <div id="wiki-search" class="menu tw-absolute tw-mt-3 tw-rounded right"> + <div class="item muted">{{ctx.Locale.Tr "repo.wiki.no_search_results"}}</div> + </div> + </div> + </div> + <div class="ui dividing header"> + <div class="ui stackable grid"> + <div class="eight wide column"> + <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> + {{$title}} + <div class="ui sub header"> + {{$timeSince := TimeSince .Author.When ctx.Locale}} + {{ctx.Locale.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince}} + </div> + </div> + <div class="eight wide right aligned column"> + {{if .EscapeStatus.Escaped}} + <a class="ui small button unescape-button tw-hidden">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</a> + <a class="ui small button escape-button">{{ctx.Locale.Tr "repo.escape_control_characters"}}</a> + {{end}} + {{if and .CanWriteWiki (not .Repository.IsMirror)}} + <div class="ui right"> + <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> + </div> + {{end}} + </div> + </div> + </div> + {{if .FormatWarning}} + <div class="ui negative message"> + <p>{{.FormatWarning}}</p> + </div> + {{end}} + + <div class="wiki-content-parts"> + {{if .sidebarTocContent}} + <div class="markup wiki-content-sidebar wiki-content-toc"> + {{.sidebarTocContent | SafeHTML}} + </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> + + {{if .sidebarPresent}} + <div class="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}} + </div> + {{end}} + + <div class="tw-clear-both"></div> + + {{if .footerPresent}} + <div class="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}} + </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> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "base/footer" .}} diff --git a/templates/shared/actions/runner_edit.tmpl b/templates/shared/actions/runner_edit.tmpl new file mode 100644 index 00000000..d60f10b7 --- /dev/null +++ b/templates/shared/actions/runner_edit.tmpl @@ -0,0 +1,96 @@ +<div class="runner-container"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.runners.runner_title"}} {{.Runner.ID}} {{.Runner.Name}} + </h4> + <div class="ui attached segment"> + <form class="ui form" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <div class="runner-basic-info"> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.status"}}</label> + <span class="ui {{if .Runner.IsOnline}}green{{else}}basic{{end}} label">{{.Runner.StatusLocaleName ctx.Locale}}</span> + </div> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.last_online"}}</label> + <span>{{if .Runner.LastOnline}}{{TimeSinceUnix .Runner.LastOnline ctx.Locale}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</span> + </div> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.labels"}}</label> + <span> + {{range .Runner.AgentLabels}} + <span class="ui label">{{.}}</span> + {{end}} + </span> + </div> + <div class="field tw-inline-block tw-mr-4"> + <label>{{ctx.Locale.Tr "actions.runners.owner_type"}}</label> + <span data-tooltip-content="{{.Runner.BelongsToOwnerName}}">{{.Runner.BelongsToOwnerType.LocaleString ctx.Locale}}</span> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <label for="description">{{ctx.Locale.Tr "actions.runners.description"}}</label> + <input id="description" name="description" value="{{.Runner.Description}}"> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button" data-url="{{.Link}}">{{ctx.Locale.Tr "actions.runners.update_runner"}}</button> + <button class="ui red button delete-button show-modal" data-url="{{.Link}}/delete" data-modal="#runner-delete-modal"> + {{ctx.Locale.Tr "actions.runners.delete_runner"}}</button> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.runners.task_list"}} + </h4> + <div class="ui attached segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th>{{ctx.Locale.Tr "actions.runners.task_list.run"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.status"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.repository"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.commit"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.task_list.done_at"}}</th> + </tr> + </thead> + <tbody> + {{range .Tasks}} + <tr> + <td><a href="{{.GetRunLink}}" target="_blank">{{.ID}}</a></td> + <td><span class="ui label task-status-{{.Status.String}}">{{.Status.LocaleString ctx.Locale}}</span></td> + <td><a href="{{.GetRepoLink}}" target="_blank">{{.GetRepoName}}</a></td> + <td> + <strong><a href="{{.GetCommitLink}}" target="_blank">{{ShortSha .CommitSHA}}</a></strong> + </td> + <td>{{if .IsStopped}} + <span>{{TimeSinceUnix .Stopped ctx.Locale}}</span> + {{else}}-{{end}}</td> + </tr> + {{end}} + {{if not .Tasks}} + <tr> + <td colspan="5">{{ctx.Locale.Tr "actions.runners.task_list.no_tasks"}}</td> + </tr> + {{end}} + </tbody> + </table> + {{template "base/paginate" .}} + </div> + <div class="ui g-modal-confirm delete modal" id="runner-delete-modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "actions.runners.delete_runner_header"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "actions.runners.delete_runner_notice"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl new file mode 100644 index 00000000..abbf2204 --- /dev/null +++ b/templates/shared/actions/runner_list.tmpl @@ -0,0 +1,95 @@ +<div class="runner-container"> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.runners.runner_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}}) + <div class="ui right"> + <div class="ui top right pointing dropdown"> + <button class="ui primary tiny button"> + {{ctx.Locale.Tr "actions.runners.new"}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </button> + <div class="menu"> + <div class="item"> + <a href="https://forgejo.org/docs/next/admin/actions/#forgejo-runner">{{ctx.Locale.Tr "actions.runners.new_notice"}}</a> + </div> + <div class="divider"></div> + <div class="header"> + Registration Token + </div> + <div class="ui input"> + <input type="text" value="{{.RegistrationToken}}"> + <button class="ui basic label button" aria-label="{{ctx.Locale.Tr "copy"}}" data-clipboard-text="{{.RegistrationToken}}"> + {{svg "octicon-copy" 14}} + </button> + </div> + <div class="divider"></div> + <div class="item"> + <a href="{{$.Link}}/reset_registration_token">{{ctx.Locale.Tr "actions.runners.reset_registration_token"}}</a> + </div> + </div> + </div> + + </div> + </h4> + <div class="ui attached segment"> + <form class="ui form ignore-dirty" id="user-list-search-form" action="{{$.Link}}"> + {{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.runner_kind")}} + </form> + </div> + <div class="ui attached table segment"> + <table class="ui very basic striped table unstackable"> + <thead> + <tr> + <th data-sortt-asc="online" data-sortt-desc="offline"> + {{ctx.Locale.Tr "actions.runners.status"}} + {{SortArrow "online" "offline" .SortType false}} + </th> + <th data-sortt-asc="newest" data-sortt-desc="oldest"> + {{ctx.Locale.Tr "actions.runners.id"}} + {{SortArrow "oldest" "newest" .SortType false}} + </th> + <th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically"> + {{ctx.Locale.Tr "actions.runners.name"}} + {{SortArrow "alphabetically" "reversealphabetically" .SortType false}} + </th> + <th>{{ctx.Locale.Tr "actions.runners.version"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.owner_type"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.labels"}}</th> + <th>{{ctx.Locale.Tr "actions.runners.last_online"}}</th> + <th>{{ctx.Locale.Tr "edit"}}</th> + </tr> + </thead> + <tbody> + {{if .Runners}} + {{range .Runners}} + <tr> + <td> + <span class="ui {{if .IsOnline}}green{{end}} label">{{.StatusLocaleName ctx.Locale}}</span> + </td> + <td>{{.ID}}</td> + <td><p data-tooltip-content="{{.Description}}">{{.Name}}</p></td> + <td>{{if .Version}}{{.Version}}{{else}}{{ctx.Locale.Tr "unknown"}}{{end}}</td> + <td><span data-tooltip-content="{{.BelongsToOwnerName}}">{{.BelongsToOwnerType.LocaleString ctx.Locale}}</span></td> + <td class="tw-flex tw-flex-wrap tw-gap-2 runner-tags"> + {{range .AgentLabels}}<span class="ui label">{{.}}</span>{{end}} + </td> + <td>{{if .LastOnline}}{{TimeSinceUnix .LastOnline ctx.Locale}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</td> + <td class="runner-ops"> + {{if .Editable $.RunnerOwnerID $.RunnerRepoID}} + <a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a> + {{end}} + </td> + </tr> + {{end}} + {{else}} + <tr> + <td class="center aligned" colspan="8">{{ctx.Locale.Tr "actions.runners.none"}}</td> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{template "base/paginate" .}} + +</div> diff --git a/templates/shared/blocked_users_list.tmpl b/templates/shared/blocked_users_list.tmpl new file mode 100644 index 00000000..409b7f4a --- /dev/null +++ b/templates/shared/blocked_users_list.tmpl @@ -0,0 +1,28 @@ +<div class="flex-list"> + {{range .BlockedUsers}} + <div class="flex-item flex-item-center"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar . 48}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{template "shared/user/name" .}} + </div> + <div class="flex-item-body"> + <span>{{ctx.Locale.Tr "settings.blocked_since" (DateTime "short" .CreatedUnix)}}</span> + </div> + </div> + <div class="flex-item-trailing"> + <form action="{{$.Link}}/unblock" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="user_id" value="{{.ID}}"> + <button class="ui red button">{{ctx.Locale.Tr "user.unblock"}}</button> + </form> + </div> + </div> + {{else}} + <div class="flex-item"> + <span class="text grey italic">{{ctx.Locale.Tr "settings.blocked_users_none"}}</span> + </div> + {{end}} +</div> diff --git a/templates/shared/combomarkdowneditor.tmpl b/templates/shared/combomarkdowneditor.tmpl new file mode 100644 index 00000000..48f72b69 --- /dev/null +++ b/templates/shared/combomarkdowneditor.tmpl @@ -0,0 +1,64 @@ +{{/* +Template Attributes: +* ContainerId: id attribute for the container element +* ContainerClasses: additional classes for the container element +* MarkdownPreviewUrl: preview url for the preview tab +* MarkdownPreviewContext: preview context for the preview tab +* TextareaName: name attribute for the textarea +* TextareaContent: content for the textarea +* TextareaPlaceholder: placeholder attribute for the textarea +* TextareaAriaLabel: aria-label attribute for the textarea +* DropzoneParentContainer: container for file upload (leave it empty if no upload) +* DisableAutosize: whether to disable automatic height resizing +* EasyMDE: whether to display button for switching to legacy editor +*/}} +<div {{if .ContainerId}}id="{{.ContainerId}}"{{end}} class="combo-markdown-editor {{.ContainerClasses}}" data-dropzone-parent-container="{{.DropzoneParentContainer}}"> + {{if .MarkdownPreviewUrl}} + <div class="ui top tabular menu"> + <a href="#" class="active item" data-tab-for="markdown-writer">{{ctx.Locale.Tr "write"}}</a> + <a href="#" class="item" data-tab-for="markdown-previewer" data-preview-url="{{.MarkdownPreviewUrl}}" data-preview-context="{{.MarkdownPreviewContext}}">{{ctx.Locale.Tr "preview"}}</a> + </div> + {{end}} + <div class="ui tab active" data-tab-panel="markdown-writer"> + <markdown-toolbar> + <div class="markdown-toolbar-group"> + <md-header class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.heading.tooltip"}}">{{svg "octicon-heading"}}</md-header> + <md-bold class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.bold.tooltip"}}">{{svg "octicon-bold"}}</md-bold> + <md-italic class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.italic.tooltip"}}">{{svg "octicon-italic"}}</md-italic> + </div> + <div class="markdown-toolbar-group"> + <md-quote class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.quote.tooltip"}}">{{svg "octicon-quote"}}</md-quote> + <md-code class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.code.tooltip"}}">{{svg "octicon-code"}}</md-code> + <md-link class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.link.tooltip"}}">{{svg "octicon-link"}}</md-link> + </div> + <div class="markdown-toolbar-group"> + <md-unordered-list class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.list.unordered.tooltip"}}">{{svg "octicon-list-unordered"}}</md-unordered-list> + <md-ordered-list class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.list.ordered.tooltip"}}">{{svg "octicon-list-ordered"}}</md-ordered-list> + <md-task-list class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.list.task.tooltip"}}">{{svg "octicon-tasklist"}}</md-task-list> + <button type="button" class="markdown-toolbar-button" data-md-button data-md-action="unindent" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.unindent.tooltip"}}">{{svg "octicon-arrow-left"}}</button> + <button type="button" class="markdown-toolbar-button" data-md-button data-md-action="indent" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.indent.tooltip"}}">{{svg "octicon-arrow-right"}}</button> + </div> + <div class="markdown-toolbar-group"> + <md-mention class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.mention.tooltip"}}">{{svg "octicon-mention"}}</md-mention> + <md-ref class="markdown-toolbar-button" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.ref.tooltip"}}">{{svg "octicon-cross-reference"}}</md-ref> + </div> + <div class="markdown-toolbar-group"> + <button class="markdown-toolbar-button markdown-switch-monospace" role="switch" data-enable-text="{{ctx.Locale.Tr "editor.buttons.enable_monospace_font"}}" data-disable-text="{{ctx.Locale.Tr "editor.buttons.disable_monospace_font"}}">{{svg "octicon-typography"}}</button> + {{if .EasyMDE}} + <button class="markdown-toolbar-button markdown-switch-easymde" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.switch_to_legacy.tooltip"}}">{{svg "octicon-arrow-switch"}}</button> + {{end}} + </div> + </markdown-toolbar> + <text-expander keys=": @" suffix=""> + <textarea class="markdown-text-editor js-quick-submit"{{if .TextareaName}} name="{{.TextareaName}}"{{end}}{{if .TextareaPlaceholder}} placeholder="{{.TextareaPlaceholder}}"{{end}}{{if .TextareaAriaLabel}} aria-label="{{.TextareaAriaLabel}}"{{end}}{{if .DisableAutosize}} data-disable-autosize="{{.DisableAutosize}}"{{end}}>{{.TextareaContent}}</textarea> + </text-expander> + <script> + if (localStorage?.getItem('markdown-editor-monospace') === 'true') { + document.querySelector('.markdown-text-editor').classList.add('tw-font-mono'); + } + </script> + </div> + <div class="ui tab markup" data-tab-panel="markdown-previewer"> + {{ctx.Locale.Tr "loading"}} + </div> +</div> diff --git a/templates/shared/issueicon.tmpl b/templates/shared/issueicon.tmpl new file mode 100644 index 00000000..a62714e9 --- /dev/null +++ b/templates/shared/issueicon.tmpl @@ -0,0 +1,25 @@ +{{if .IsPull}} + {{if not .PullRequest}} + No PullRequest + {{else}} + {{if .IsClosed}} + {{if .PullRequest.HasMerged}} + {{svg "octicon-git-merge" 16 "text purple"}} + {{else}} + {{svg "octicon-git-pull-request" 16 "text red"}} + {{end}} + {{else}} + {{if .PullRequest.IsWorkInProgress ctx}} + {{svg "octicon-git-pull-request-draft" 16 "text grey"}} + {{else}} + {{svg "octicon-git-pull-request" 16 "text green"}} + {{end}} + {{end}} + {{end}} +{{else}} + {{if .IsClosed}} + {{svg "octicon-issue-closed" 16 "text red"}} + {{else}} + {{svg "octicon-issue-opened" 16 "text green"}} + {{end}} +{{end}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl new file mode 100644 index 00000000..78bfca1c --- /dev/null +++ b/templates/shared/issuelist.tmpl @@ -0,0 +1,163 @@ +<div id="issue-list" class="flex-list"> + {{$approvalCounts := .ApprovalCounts}} + {{range .Issues}} + <div class="flex-item"> + + <div class="flex-item-icon"> + {{if $.CanWriteIssuesOrPulls}} + <input type="checkbox" autocomplete="off" class="issue-checkbox tw-mr-4" data-issue-id={{.ID}} aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}} "{{.Title}}""> + {{end}} + {{template "shared/issueicon" .}} + </div> + + <div class="flex-item-main"> + <div class="flex-item-header"> + <div class="flex-item-title"> + <a class="tw-no-underline issue-title" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{RenderEmoji $.Context .Title | RenderCodeBlock}}</a> + {{if .IsPull}} + {{if (index $.CommitStatuses .PullRequest.ID)}} + {{template "repo/commit_statuses" dict "Status" (index $.CommitLastStatus .PullRequest.ID) "Statuses" (index $.CommitStatuses .PullRequest.ID)}} + {{end}} + {{end}} + <span class="labels-list tw-ml-1"> + {{range .Labels}} + <a href="?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}{{if ne $.listType "milestone"}}&milestone={{$.MilestoneID}}{{end}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{RenderLabel $.Context ctx.Locale .}}</a> + {{end}} + </span> + </div> + {{if or .TotalTrackedTime .Assignees .NumComments}} + <div class="flex-item-trailing"> + {{if .TotalTrackedTime}} + <div class="text grey flex-text-block"> + {{svg "octicon-clock" 16}} + {{.TotalTrackedTime | Sec2Time}} + </div> + {{end}} + {{if .Assignees}} + <div class="text grey"> + {{range .Assignees}} + <a class="ui assignee tw-no-underline" href="{{.HomeLink}}" data-tooltip-content="{{.GetDisplayName}}"> + {{ctx.AvatarUtils.Avatar . 20}} + </a> + {{end}} + </div> + {{end}} + {{if .NumComments}} + <div class="text grey"> + <a class="tw-no-underline muted flex-text-block" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> + {{svg "octicon-comment" 16}}{{.NumComments}} + </a> + </div> + {{end}} + </div> + {{end}} + </div> + <div class="flex-item-body"> + <a class="index" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}"> + {{if eq $.listType "dashboard"}} + {{.Repo.FullName}}#{{.Index}} + {{else}} + #{{.Index}} + {{end}} + </a> + {{$timeStr := TimeSinceUnix .GetLastEventTimestamp ctx.Locale}} + {{if .OriginalAuthor}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}} + {{else if gt .Poster.ID 0}} + {{ctx.Locale.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.GetDisplayName}} + {{else}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .Poster.GetDisplayName}} + {{end}} + {{if .IsPull}} + <div class="branches flex-text-inline"> + <div class="branch"> + <a href="{{.PullRequest.BaseRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.BaseBranch}}"> + {{/* inline to remove the spaces between spans */}} + {{if ne .RepoID .PullRequest.BaseRepoID}}<span class="truncated-name">{{.PullRequest.BaseRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.BaseBranch}}</span> + </a> + </div> + {{svg "gitea-double-chevron-left" 12}} + {{if .PullRequest.HeadRepo}} + <div class="branch"> + <a href="{{.PullRequest.HeadRepo.Link}}/src/branch/{{PathEscapeSegments .PullRequest.HeadBranch}}"> + {{/* inline to remove the spaces between spans */}} + {{if ne .RepoID .PullRequest.HeadRepoID}}<span class="truncated-name">{{.PullRequest.HeadRepo.OwnerName}}</span>:{{end}}<span class="truncated-name">{{.PullRequest.HeadBranch}}</span> + </a> + </div> + {{end}} + </div> + {{end}} + {{if and .Milestone (ne $.listType "milestone")}} + <a class="milestone flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}"{{else}}href="{{.Repo.Link}}/milestone/{{.Milestone.ID}}"{{end}}> + {{svg "octicon-milestone" 14}} + <span class="gt-ellipsis">{{.Milestone.Name}}</span> + </a> + {{end}} + {{if .Project}} + <a class="project flex-text-inline tw-max-w-[300px]" href="{{.Project.Link ctx}}"> + {{svg .Project.IconName 14}} + <span class="gt-ellipsis">{{.Project.Title}}</span> + </a> + {{end}} + {{if .Ref}} + <a class="ref flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{.Repo.Link}}{{index $.IssueRefURLs .ID}}"{{end}}> + {{svg "octicon-git-branch" 14}} + <span class="gt-ellipsis">{{index $.IssueRefEndNames .ID}}</span> + </a> + {{end}} + {{$tasks := .GetTasks}} + {{if gt $tasks 0}} + {{$tasksDone := .GetTasksDone}} + <span class="checklist flex-text-inline"> + {{svg "octicon-checklist" 14}}{{$tasksDone}} / {{$tasks}} + <progress value="{{$tasksDone}}" max="{{$tasks}}"></progress> + </span> + {{end}} + {{if ne .DeadlineUnix 0}} + <span class="due-date flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.due_date"}}"> + <span{{if .IsOverdue}} class="text red"{{end}}> + {{svg "octicon-calendar" 14}} + {{DateTime "short" (.DeadlineUnix.FormatDate)}} + </span> + </span> + {{end}} + {{if .IsPull}} + {{$approveOfficial := call $approvalCounts .ID "approve"}} + {{$rejectOfficial := call $approvalCounts .ID "reject"}} + {{$waitingOfficial := call $approvalCounts .ID "waiting"}} + {{if gt $approveOfficial 0}} + <span class="approvals green flex-text-inline"> + {{svg "octicon-check" 14}} + {{ctx.Locale.TrN $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n" $approveOfficial}} + </span> + {{end}} + {{if gt $rejectOfficial 0}} + <span class="rejects red flex-text-inline"> + {{svg "octicon-diff" 14}} + {{ctx.Locale.TrN $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n" $rejectOfficial}} + </span> + {{end}} + {{if gt $waitingOfficial 0}} + <span class="waiting flex-text-inline"> + {{svg "octicon-eye" 14}} + {{ctx.Locale.TrN $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n" $waitingOfficial}} + </span> + {{end}} + {{if and (not .PullRequest.HasMerged) .PullRequest.ConflictedFiles}} + <span class="conflicting flex-text-inline"> + {{svg "octicon-x" 14}} + {{ctx.Locale.TrN (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n" (len .PullRequest.ConflictedFiles)}} + </span> + {{end}} + {{end}} + </div> + </div> + </div> + {{end}} + {{if .IssueIndexerUnavailable}} + <div class="ui error message"> + <p>{{ctx.Locale.Tr "search.keyword_search_unavailable"}}</p> + </div> + {{end}} +</div> +{{template "base/paginate" .}} diff --git a/templates/shared/label_filter.tmpl b/templates/shared/label_filter.tmpl new file mode 100644 index 00000000..2269271a --- /dev/null +++ b/templates/shared/label_filter.tmpl @@ -0,0 +1,50 @@ +<!-- Label --> +<div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item label-filter"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_label"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_label"}}"> + </div> + <div class="ui checkbox compact archived-label-filter"> + <input name="archived" type="checkbox" + id="archived-filter-checkbox" + {{if .ShowArchivedLabels}}checked{{end}} + > + <label for="archived-filter-checkbox"> + {{ctx.Locale.Tr "repo.issues.label_archived_filter"}} + <i class="tw-ml-1" data-tooltip-content={{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}> + {{svg "octicon-info"}} + </i> + </label> + </div> + <span class="info">{{ctx.Locale.Tr "repo.issues.filter_label_exclude"}}</span> + <div class="divider"></div> + <a rel="nofollow" class="{{if .AllLabels}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels=&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_label_no_select"}}</a> + <a rel="nofollow" class="{{if .NoLabel}}active selected {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels=0&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a> + {{$previousExclusiveScope := "_no_scope"}} + {{range .Labels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope $exclusiveScope)}} + <div class="divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a rel="nofollow" class="item label-filter-item tw-flex tw-items-center" {{if .IsArchived}}data-is-archived{{end}} href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&labels={{.QueryString}}&state={{$.State}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}" data-label-id="{{.ID}}"> + {{if .IsExcluded}} + {{svg "octicon-circle-slash"}} + {{else if .IsSelected}} + {{if $exclusiveScope}} + {{svg "octicon-dot-fill"}} + {{else}} + {{svg "octicon-check"}} + {{end}} + {{end}} + {{RenderLabel $.Context ctx.Locale .}} + <p class="tw-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p> + </a> + {{end}} + </div> +</div> diff --git a/templates/shared/repo_search.tmpl b/templates/shared/repo_search.tmpl new file mode 100644 index 00000000..d08d6017 --- /dev/null +++ b/templates/shared/repo_search.tmpl @@ -0,0 +1,69 @@ +<div class="ui small secondary filter menu"> + <form id="repo-search-form" class="ui form ignore-dirty tw-flex-1 tw-flex tw-flex-row tw-gap-x-2 tw-items-center"> + {{if .Language}}<input hidden name="language" value="{{.Language}}">{{end}} + {{if .TopicOnly}}<input hidden name="topic" value="{{.TopicOnly}}">{{end}} + <div class="ui small fluid action input tw-flex-1"> + {{template "shared/search/input" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.repo_kind")}} + {{if .PageIsExploreRepositories}} + <input type="hidden" name="only_show_relevant" value="{{.OnlyShowRelevant}}"> + {{else if .TabName}} + <input type="hidden" name="tab" value="{{.TabName}}"> + {{end}} + {{template "shared/search/button"}} + </div> + <!-- Filter --> + <div class="ui small dropdown type jump item tw-mr-0"> + <span class="text"> + {{ctx.Locale.Tr "filter"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <label class="item"><input type="radio" name="clear-filter"> {{ctx.Locale.Tr "filter.clear"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="archived" {{if .IsArchived.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_archived"}}</label> + <label class="item"><input type="radio" name="archived" {{if (not (.IsArchived.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_archived"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="fork" {{if .IsFork.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_fork"}}</label> + <label class="item"><input type="radio" name="fork" {{if (not (.IsFork.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_fork"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="mirror" {{if .IsMirror.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_mirror"}}</label> + <label class="item"><input type="radio" name="mirror" {{if (not (.IsMirror.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_mirror"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="template" {{if .IsTemplate.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.is_template"}}</label> + <label class="item"><input type="radio" name="template" {{if (not (.IsTemplate.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.not_template"}}</label> + <div class="divider"></div> + <label class="item"><input type="radio" name="private" {{if .IsPrivate.Value}}checked{{end}} value="1"> {{ctx.Locale.Tr "filter.private"}}</label> + <label class="item"><input type="radio" name="private" {{if (not (.IsPrivate.ValueOrDefault true))}}checked{{end}} value="0"> {{ctx.Locale.Tr "filter.public"}}</label> + </div> + </div> + <!-- Sort --> + <div class="ui small dropdown type jump item tw-mr-0"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <label class="{{if eq .SortType "newest"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "newest"}}checked{{end}} value="newest"> {{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</label> + <label class="{{if eq .SortType "oldest"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "oldest"}}checked{{end}} value="oldest"> {{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</label> + <label class="{{if eq .SortType "alphabetically"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "alphabetically"}}checked{{end}} value="alphabetically"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</label> + <label class="{{if eq .SortType "reversealphabetically"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "reversealphabetically"}}checked{{end}} value="reversealphabetically"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</label> + <label class="{{if eq .SortType "recentupdate"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "recentupdate"}}checked{{end}} value="recentupdate"> {{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</label> + <label class="{{if eq .SortType "leastupdate"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "leastupdate"}}checked{{end}} value="leastupdate"> {{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</label> + {{if not .DisableStars}} + <label class="{{if eq .SortType "moststars"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "moststars"}}checked{{end}} value="moststars"> {{ctx.Locale.Tr "repo.issues.filter_sort.moststars"}}</label> + <label class="{{if eq .SortType "feweststars"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "feweststars"}}checked{{end}} value="feweststars"> {{ctx.Locale.Tr "repo.issues.filter_sort.feweststars"}}</label> + {{end}} + <label class="{{if eq .SortType "mostforks"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "mostforks"}}checked{{end}} value="mostforks"> {{ctx.Locale.Tr "repo.issues.filter_sort.mostforks"}}</label> + <label class="{{if eq .SortType "fewestforks"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "fewestforks"}}checked{{end}} value="fewestforks"> {{ctx.Locale.Tr "repo.issues.filter_sort.fewestforks"}}</label> + <label class="{{if eq .SortType "size"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "size"}}checked{{end}} value="size"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.by_size"}}</label> + <label class="{{if eq .SortType "reversesize"}}active {{end}}item"><input hidden type="radio" name="sort" {{if eq .SortType "reversesize"}}checked{{end}} value="reversesize"> {{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_by_size"}}</label> + </div> + </div> + </form> +</div> +{{if and .PageIsExploreRepositories .OnlyShowRelevant}} + <div class="ui message explore-relevancy-note"> + <span data-tooltip-content="{{ctx.Locale.Tr "explore.relevant_repositories_tooltip"}}">{{ctx.Locale.Tr "explore.relevant_repositories" (printf "?only_show_relevant=0&sort=%s&q=%s&language=%s" $.SortType (QueryEscape $.Keyword) (QueryEscape $.Language))}}</span> + </div> +{{end}} +<div class="divider"></div> diff --git a/templates/shared/search/button.tmpl b/templates/shared/search/button.tmpl new file mode 100644 index 00000000..7bb1662e --- /dev/null +++ b/templates/shared/search/button.tmpl @@ -0,0 +1,3 @@ +{{/* Disable (optional) - if search button has to be disabled */}} +{{/* Tooltip (optional) - a tooltip to be displayed on hover */}} +<button class="ui small icon button" aria-label="{{ctx.Locale.Tr "search.search"}}" {{with .Tooltip}}data-tooltip-content="{{.}}"{{end}}{{if .Disabled}} disabled{{end}}>{{svg "octicon-search"}}</button> diff --git a/templates/shared/search/code/results.tmpl b/templates/shared/search/code/results.tmpl new file mode 100644 index 00000000..50d4a35c --- /dev/null +++ b/templates/shared/search/code/results.tmpl @@ -0,0 +1,41 @@ +<div class="flex-text-block tw-flex-wrap"> + {{range $term := .SearchResultLanguages}} + <a class="ui {{if eq $.Language $term.Language}}primary{{end}} basic label tw-m-0" + href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&fuzzy={{$.IsFuzzy}}"> + <i class="color-icon tw-mr-2" style="background-color: {{$term.Color}}"></i> + {{$term.Language}} + <div class="detail">{{$term.Count}}</div> + </a> + {{end}} +</div> +<div class="repository search"> + {{range $result := .SearchResults}} + {{$repo := or $.Repo (index $.RepoMaps .RepoID)}} + <details class="tw-group diff-file-box diff-box file-content non-diff-file-content repo-search-result" open> + <summary class="tw-list-none"> + <h4 class="ui top attached header tw-font-normal tw-flex tw-flex-wrap tw-transform-reset"> + <span class="tw-h-4 tw-transition -tw-rotate-90 group-open:tw-rotate-0"> + {{svg "octicon-chevron-down"}} + </span> + {{if not $.Repo}} + <span class="file tw-flex-1 tw-ml-2"> + <a rel="nofollow" href="{{$repo.Link}}">{{$repo.FullName}}</a> + {{if $repo.IsArchived}} + <span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span> + {{end}} + - {{.Filename}} + </span> + {{else}} + <span class="file tw-flex-1 tw-ml-2">{{.Filename}}</span> + {{end}} + <a role="button" class="ui basic tiny button" rel="nofollow" href="{{$repo.Link}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a> + </h4> + </summary> + <div class="ui attached table segment"> + {{template "shared/searchfile" dict "RepoLink" $repo.Link "SearchResult" .}} + </div> + {{template "shared/searchbottom" dict "root" $ "result" .}} + </details> + {{end}} +</div> +{{template "base/paginate" .}} diff --git a/templates/shared/search/code/search.tmpl b/templates/shared/search/code/search.tmpl new file mode 100644 index 00000000..37a23dc3 --- /dev/null +++ b/templates/shared/search/code/search.tmpl @@ -0,0 +1,22 @@ +<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")}} +</form> +<div class="divider"></div> +<div class="ui user list"> + {{if .CodeIndexerUnavailable}} + <div class="ui error message"> + <p>{{ctx.Locale.Tr "search.code_search_unavailable"}}</p> + </div> + {{else}} + {{if .CodeIndexerDisabled}} + <div class="ui message" data-test-tag="grep"> + <p>{{ctx.Locale.Tr "search.code_search_by_git_grep"}}</p> + </div> + {{end}} + {{if .SearchResults}} + {{template "shared/search/code/results" .}} + {{else if .Keyword}} + <div>{{ctx.Locale.Tr "search.no_results"}}</div> + {{end}} + {{end}} +</div> diff --git a/templates/shared/search/combo.tmpl b/templates/shared/search/combo.tmpl new file mode 100644 index 00000000..788db95c --- /dev/null +++ b/templates/shared/search/combo.tmpl @@ -0,0 +1,8 @@ +{{/* Value - value of the search field (for search results page) */}} +{{/* Disabled (optional) - if search field/button has to be disabled */}} +{{/* Placeholder (optional) - placeholder text to be used */}} +{{/* Tooltip (optional) - a tooltip to be displayed on button hover */}} +<div class="ui small fluid action input"> + {{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}} + {{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}} +</div> diff --git a/templates/shared/search/combo_fuzzy.tmpl b/templates/shared/search/combo_fuzzy.tmpl new file mode 100644 index 00000000..3540a89e --- /dev/null +++ b/templates/shared/search/combo_fuzzy.tmpl @@ -0,0 +1,10 @@ +{{/* 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 new file mode 100644 index 00000000..5c09d3c1 --- /dev/null +++ b/templates/shared/search/fuzzy.tmpl @@ -0,0 +1,10 @@ +{{/* 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/search/input.tmpl b/templates/shared/search/input.tmpl new file mode 100644 index 00000000..195cefc2 --- /dev/null +++ b/templates/shared/search/input.tmpl @@ -0,0 +1,4 @@ +{{/* Value - value of the search field (for search results page) */}} +{{/* Disabled (optional) - if search field has to be disabled */}} +{{/* Placeholder (optional) - placeholder text to be used */}} +<input type="search" spellcheck="false" name="q" maxlength="255" placeholder="{{with .Placeholder}}{{.}}{{else}}{{ctx.Locale.Tr "search.search"}}{{end}}"{{with .Value}} value="{{.}}"{{end}}{{if .Disabled}} disabled{{end}}> diff --git a/templates/shared/searchbottom.tmpl b/templates/shared/searchbottom.tmpl new file mode 100644 index 00000000..bee03972 --- /dev/null +++ b/templates/shared/searchbottom.tmpl @@ -0,0 +1,14 @@ +{{if or .result.Language (not .result.UpdatedUnix.IsZero)}} +<div class="ui bottom attached table segment tw-flex tw-items-center tw-justify-between"> + <div class="tw-flex tw-items-center tw-ml-4"> + {{if .result.Language}} + <i class="color-icon tw-mr-2" style="background-color: {{.result.Color}}"></i>{{.result.Language}} + {{end}} + </div> + <div class="tw-mr-4"> + {{if not .result.UpdatedUnix.IsZero}} + <span class="ui grey text">{{ctx.Locale.Tr "explore.code_last_indexed_at" (TimeSinceUnix .result.UpdatedUnix ctx.Locale)}}</span> + {{end}} + </div> +</div> +{{end}} diff --git a/templates/shared/searchfile.tmpl b/templates/shared/searchfile.tmpl new file mode 100644 index 00000000..280584e4 --- /dev/null +++ b/templates/shared/searchfile.tmpl @@ -0,0 +1,14 @@ +<div class="file-body file-code code-view"> + <table> + <tbody> + {{range .SearchResult.Lines}} + <tr> + <td class="lines-num"> + <a href="{{$.RepoLink}}/src/commit/{{PathEscape $.SearchResult.CommitID}}/{{PathEscapeSegments $.SearchResult.Filename}}#L{{.Num}}"><span>{{.Num}}</span></a> + </td> + <td class="lines-code chroma"><code class="code-inner">{{.FormattedContent}}</code></td> + </tr> + {{end}} + </tbody> + </table> +</div> diff --git a/templates/shared/secrets/add_list.tmpl b/templates/shared/secrets/add_list.tmpl new file mode 100644 index 00000000..ea594590 --- /dev/null +++ b/templates/shared/secrets/add_list.tmpl @@ -0,0 +1,81 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "secrets.management"}} + <div class="ui right"> + <button class="ui primary tiny button show-modal" + data-modal="#add-secret-modal" + data-modal-form.action="{{.Link}}" + data-modal-header="{{ctx.Locale.Tr "secrets.creation"}}" + > + {{ctx.Locale.Tr "secrets.creation"}} + </button> + </div> +</h4> +<div class="ui attached segment"> + {{if .Secrets}} + <div class="flex-list"> + {{range .Secrets}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "octicon-key" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{.Name}} + </div> + <div class="flex-item-body"> + ****** + </div> + </div> + <div class="flex-item-trailing"> + <span class="color-text-light-2"> + {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} + </span> + <button class="ui btn interact-bg link-action tw-p-2" + data-url="{{$.Link}}/delete?id={{.ID}}" + data-modal-confirm="{{ctx.Locale.Tr "secrets.deletion.description"}}" + data-tooltip-content="{{ctx.Locale.Tr "secrets.deletion"}}" + > + {{svg "octicon-trash"}} + </button> + </div> + </div> + {{end}} + </div> + {{else}} + {{ctx.Locale.Tr "secrets.none"}} + {{end}} +</div> + +{{/* Add secret dialog */}} +<div class="ui small modal" id="add-secret-modal"> + <div class="header"> + <span id="actions-modal-header"></span> + </div> + <form class="ui form form-fetch-action" method="post"> + <div class="content"> + {{.CsrfTokenHtml}} + <div class="field"> + {{ctx.Locale.Tr "secrets.description"}} + </div> + <div class="field"> + <label for="secret-name">{{ctx.Locale.Tr "name"}}</label> + <input autofocus required + id="secret-name" + name="name" + value="{{.name}}" + pattern="^(?!GITEA_|GITHUB_)[a-zA-Z_][a-zA-Z0-9_]*$" + placeholder="{{ctx.Locale.Tr "secrets.creation.name_placeholder"}}" + > + </div> + <div class="field"> + <label for="secret-data">{{ctx.Locale.Tr "value"}}</label> + <textarea required + id="secret-data" + name="data" + placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}" + ></textarea> + </div> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> +</div> diff --git a/templates/shared/user/authorlink.tmpl b/templates/shared/user/authorlink.tmpl new file mode 100644 index 00000000..d57a635b --- /dev/null +++ b/templates/shared/user/authorlink.tmpl @@ -0,0 +1 @@ +<a class="author text black tw-font-semibold muted"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a>{{if .IsBot}}<span class="ui basic label tw-p-1">bot</span>{{end}} diff --git a/templates/shared/user/avatarlink.tmpl b/templates/shared/user/avatarlink.tmpl new file mode 100644 index 00000000..5e3ed7a6 --- /dev/null +++ b/templates/shared/user/avatarlink.tmpl @@ -0,0 +1 @@ +<a class="avatar"{{if gt .user.ID 0}} href="{{.user.HomeLink}}"{{end}}>{{ctx.AvatarUtils.Avatar .user}}</a> diff --git a/templates/shared/user/blocked_users.tmpl b/templates/shared/user/blocked_users.tmpl new file mode 100644 index 00000000..e83a039e --- /dev/null +++ b/templates/shared/user/blocked_users.tmpl @@ -0,0 +1,83 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "user.block.title"}} +</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "user.block.info_1"}}</p> + <ul> + <li>{{ctx.Locale.Tr "user.block.info_2"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_3"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_4"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_5"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_6"}}</li> + <li>{{ctx.Locale.Tr "user.block.info_7"}}</li> + </ul> +</div> +<div class="ui segment"> + <form class="ui form ignore-dirty" action="{{$.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="block" /> + <div id="search-user-box" class="field ui fluid search input"> + <input class="prompt tw-mr-2" name="blockee" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" required> + <button class="ui red button">{{ctx.Locale.Tr "user.block.block"}}</button> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "user.block.note.title"}}</label> + <input name="note"> + <p class="help">{{ctx.Locale.Tr "user.block.note.info"}}</p> + </div> + </form> +</div> +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "user.block.list"}} +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + {{range .UserBlocks}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar .Blockee}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + <a class="item" href="{{.Blockee.HTMLURL}}">{{.Blockee.GetDisplayName}}</a> + </div> + {{if .Note}} + <div class="flex-item-body"> + <i>{{ctx.Locale.Tr "user.block.note"}}:</i> {{.Note}} + </div> + {{end}} + </div> + <div class="flex-item-trailing"> + <button class="ui compact mini button show-modal" data-modal="#block-user-note-modal" data-modal-modal-blockee="{{.Blockee.Name}}" data-modal-modal-note="{{.Note}}">{{ctx.Locale.Tr "user.block.note.edit"}}</button> + <form action="{{$.Link}}" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="action" value="unblock" /> + <input type="hidden" name="blockee" value="{{.Blockee.Name}}" /> + <button class="ui compact mini button">{{ctx.Locale.Tr "user.block.unblock"}}</button> + </form> + </div> + </div> + {{else}} + <div class="item">{{ctx.Locale.Tr "user.block.list.none"}}</div> + {{end}} + </div> +</div> +<div class="ui small modal" id="block-user-note-modal"> + <div class="header">{{ctx.Locale.Tr "user.block.note.edit"}}</div> + <div class="content"> + <form class="ui form" action="{{$.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="action" value="note" /> + <input type="hidden" name="blockee" class="modal-blockee" /> + <div class="field"> + <label>{{ctx.Locale.Tr "user.block.note.title"}}</label> + <input name="note" class="modal-note" /> + <p class="help">{{ctx.Locale.Tr "user.block.note.info"}}</p> + </div> + <div class="text right actions"> + <button class="ui cancel button">{{ctx.Locale.Tr "cancel"}}</button> + <button class="ui primary button">{{ctx.Locale.Tr "save"}}</button> + </div> + </form> + </div> +</div> diff --git a/templates/shared/user/name.tmpl b/templates/shared/user/name.tmpl new file mode 100644 index 00000000..896349fd --- /dev/null +++ b/templates/shared/user/name.tmpl @@ -0,0 +1 @@ +<a class="text muted" href="{{.HomeLink}}">{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}</a> diff --git a/templates/shared/user/namelink.tmpl b/templates/shared/user/namelink.tmpl new file mode 100644 index 00000000..a122f4f4 --- /dev/null +++ b/templates/shared/user/namelink.tmpl @@ -0,0 +1 @@ +<a{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{.GetDisplayName}}</a> diff --git a/templates/shared/user/org_profile_avatar.tmpl b/templates/shared/user/org_profile_avatar.tmpl new file mode 100644 index 00000000..c0abcabf --- /dev/null +++ b/templates/shared/user/org_profile_avatar.tmpl @@ -0,0 +1,16 @@ +{{with .ContextUser}} + <div class="ui container"> + <div class="ui vertically grid head"> + <div class="column"> + <div class="ui header tw-flex tw-items-center tw-break-anywhere"> + {{ctx.AvatarUtils.Avatar . 100}} + <span class="text grey"><a class="muted" href="{{.HomeLink}}">{{.DisplayName}}</a></span> + <span class="org-visibility"> + {{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} + {{if .Visibility.IsPrivate}}<div class="ui medium basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}} + </span> + </div> + </div> + </div> + </div> +{{end}} diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl new file mode 100644 index 00000000..3063aeac --- /dev/null +++ b/templates/shared/user/profile_big_avatar.tmpl @@ -0,0 +1,127 @@ +<div id="profile-avatar-card" class="ui card"> + <div id="profile-avatar" class="content tw-flex"> + {{if eq .SignedUserID .ContextUser.ID}} + <a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}"> + {{/* the size doesn't take affect (and no need to take affect), image size(width) should be controlled by the parent container since this is not a flex layout*/}} + {{ctx.AvatarUtils.Avatar .ContextUser 256}} + </a> + {{else}} + <span class="image"> + {{ctx.AvatarUtils.Avatar .ContextUser 256}} + </span> + {{end}} + </div> + <div class="content tw-break-anywhere profile-avatar-name"> + {{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}} + <span class="username text center">{{.ContextUser.Name}}{{if .ContextUser.Pronouns}} · {{.ContextUser.Pronouns}}{{end}} {{if .IsAdmin}} + <a class="muted" href="{{AppSubUrl}}/admin/users/{{.ContextUser.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}"> + {{svg "octicon-gear" 18}} + </a> + {{end}}</span> + <div class="tw-mt-2"> + <a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-people" 18 "tw-mr-1"}}{{ctx.Locale.TrN .NumFollowers "user.followers_one" "user.followers_few" .NumFollowers}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{ctx.Locale.TrN .NumFollowing "user.following_one" "user.following_few" .NumFollowing}}</a> + {{if and .EnableFeed (or .IsAdmin (eq .SignedUserID .ContextUser.ID) (not .ContextUser.KeepActivityPrivate))}} + <a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a> + {{end}} + </div> + </div> + <div class="extra content tw-break-anywhere"> + <ul> + {{if .ContextUser.Location}} + <li> + {{svg "octicon-location"}} + <span class="tw-flex-1">{{.ContextUser.Location}}</span> + {{if .ContextUserLocationMapURL}} + <a href="{{.ContextUserLocationMapURL}}" rel="nofollow noreferrer" data-tooltip-content="{{ctx.Locale.Tr "user.show_on_map"}}"> + {{svg "octicon-link-external"}} + </a> + {{end}} + </li> + {{end}} + {{if .ShowUserEmail}} + <li> + {{svg "octicon-mail"}} + <a class="tw-flex-1" href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a> + {{if (eq .SignedUserID .ContextUser.ID)}} + <a href="{{AppSubUrl}}/user/settings#privacy-user-settings"> + <i data-tooltip-content="{{ctx.Locale.Tr "user.email_visibility.limited"}}"> + {{svg "octicon-unlock"}} + </i> + </a> + {{end}} + </li> + {{end}} + {{if .ContextUser.Website}} + <li> + {{svg "octicon-link"}} + <a target="_blank" rel="noopener noreferrer me" href="{{.ContextUser.Website}}">{{.ContextUser.Website}}</a> + </li> + {{end}} + {{if $.RenderedDescription}} + <li> + <div class="render-content markup">{{$.RenderedDescription}}</div> + </li> + {{end}} + {{range .OpenIDs}} + {{if .Show}} + <li> + {{svg "fontawesome-openid"}} + <a target="_blank" rel="noopener noreferrer" href="{{.URI}}">{{.URI}}</a> + </li> + {{end}} + {{end}} + <li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix)}}</span></li> + {{if and .Orgs .HasOrgsVisible}} + <li> + <ul class="user-orgs"> + {{range .Orgs}} + {{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID ctx $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}} + <li> + <a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}"> + {{ctx.AvatarUtils.Avatar .}} + </a> + </li> + {{end}} + {{end}} + </ul> + </li> + {{end}} + {{if .Badges}} + <li> + <ul class="user-badges"> + {{range .Badges}} + <li> + <img width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}"> + </li> + {{end}} + </ul> + </li> + {{end}} + {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}} + <li class="follow" hx-target="#profile-avatar-card" hx-indicator="#profile-avatar-card" > + {{if $.IsFollowing}} + <button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}} + </button> + {{else}} + <button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}} + </button> + {{end}} + </li> + <li class="block"> + {{if $.IsBlocked}} + <button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unblock&redirect_to={{$.Link}}"> + {{svg "octicon-person"}} {{ctx.Locale.Tr "user.unblock"}} + </button> + {{else}} + <button type="submit" class="ui basic orange button delete-button" + data-modal-id="block-user" data-url="{{.ContextUser.HomeLink}}?action=block"> + {{svg "octicon-blocked"}} {{ctx.Locale.Tr "user.block"}} + </button> + {{end}} + </li> + {{end}} + </ul> + </div> +</div> diff --git a/templates/shared/variables/variable_list.tmpl b/templates/shared/variables/variable_list.tmpl new file mode 100644 index 00000000..06c71c06 --- /dev/null +++ b/templates/shared/variables/variable_list.tmpl @@ -0,0 +1,92 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "actions.variables.management"}} + <div class="ui right"> + <button class="ui primary tiny button show-modal" + data-modal="#edit-variable-modal" + data-modal-form.action="{{.Link}}/new" + data-modal-header="{{ctx.Locale.Tr "actions.variables.creation"}}" + data-modal-dialog-variable-name="" + data-modal-dialog-variable-data="" + > + {{ctx.Locale.Tr "actions.variables.creation"}} + </button> + </div> +</h4> +<div class="ui attached segment"> + {{if .Variables}} + <div class="flex-list"> + {{range .Variables}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "octicon-pencil" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title"> + {{.Name}} + </div> + <div class="flex-item-body"> + {{.Data}} + </div> + </div> + <div class="flex-item-trailing"> + <span class="color-text-light-2"> + {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} + </span> + <button class="btn interact-bg tw-p-2 show-modal" + data-tooltip-content="{{ctx.Locale.Tr "actions.variables.edit"}}" + data-modal="#edit-variable-modal" + data-modal-form.action="{{$.Link}}/{{.ID}}/edit" + data-modal-header="{{ctx.Locale.Tr "actions.variables.edit"}}" + data-modal-dialog-variable-name="{{.Name}}" + data-modal-dialog-variable-data="{{.Data}}" + > + {{svg "octicon-pencil"}} + </button> + <button class="btn interact-bg tw-p-2 link-action" + data-tooltip-content="{{ctx.Locale.Tr "actions.variables.deletion"}}" + data-url="{{$.Link}}/{{.ID}}/delete" + data-modal-confirm="{{ctx.Locale.Tr "actions.variables.deletion.description"}}" + > + {{svg "octicon-trash"}} + </button> + </div> + </div> + {{end}} + </div> + {{else}} + {{ctx.Locale.Tr "actions.variables.none"}} + {{end}} +</div> + +{{/** Edit variable dialog */}} +<div class="ui small modal" id="edit-variable-modal"> + <div class="header"></div> + <form class="ui form form-fetch-action" method="post"> + <div class="content"> + {{.CsrfTokenHtml}} + <div class="field"> + {{ctx.Locale.Tr "actions.variables.description"}} + </div> + <div class="field"> + <label for="dialog-variable-name">{{ctx.Locale.Tr "name"}}</label> + <input autofocus required + name="name" + id="dialog-variable-name" + value="{{.name}}" + pattern="^(?!GITEA_|GITHUB_)[a-zA-Z_][a-zA-Z0-9_]*$" + placeholder="{{ctx.Locale.Tr "secrets.creation.name_placeholder"}}" + > + </div> + <div class="field"> + <label for="dialog-variable-data">{{ctx.Locale.Tr "value"}}</label> + <textarea required + name="data" + id="dialog-variable-data" + placeholder="{{ctx.Locale.Tr "secrets.creation.value_placeholder"}}" + ></textarea> + </div> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} + </form> +</div> + diff --git a/templates/shared/webhook/icon.tmpl b/templates/shared/webhook/icon.tmpl new file mode 100644 index 00000000..3c84f117 --- /dev/null +++ b/templates/shared/webhook/icon.tmpl @@ -0,0 +1,29 @@ +{{$size := 26}} +{{if .Size}} + {{$size = .Size}} +{{end}} +{{if eq .HookType "forgejo"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/forgejo.svg"> +{{else if eq .HookType "gitea"}} + {{svg "gitea-gitea" $size "img"}} +{{else if eq .HookType "gogs"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gogs.ico"> +{{else if eq .HookType "slack"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/slack.png"> +{{else if eq .HookType "discord"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/discord.png"> +{{else if eq .HookType "dingtalk"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/dingtalk.ico"> +{{else if eq .HookType "telegram"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/telegram.png"> +{{else if eq .HookType "msteams"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/msteams.png"> +{{else if eq .HookType "feishu"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/feishu.png"> +{{else if eq .HookType "matrix"}} + {{svg "gitea-matrix" $size "img"}} +{{else if eq .HookType "wechatwork"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/wechatwork.png"> +{{else if eq .HookType "packagist"}} + <img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/packagist.png"> +{{end}} diff --git a/templates/status/404.tmpl b/templates/status/404.tmpl new file mode 100644 index 00000000..9e961e1b --- /dev/null +++ b/templates/status/404.tmpl @@ -0,0 +1,14 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content ui center tw-w-screen {{if .IsRepo}}repository{{end}}"> + {{if .IsRepo}}{{template "repo/header" .}}{{end}} + <div class="ui container center"> + <h1 style="margin-top: 100px" class="error-code">404</h1> + <p>{{if .NotFoundPrompt}}{{.NotFoundPrompt}}{{else}}{{ctx.Locale.Tr "error404"}}{{end}}</p> + {{if .NotFoundGoBackURL}}<a class="ui button green" href="{{.NotFoundGoBackURL}}">{{ctx.Locale.Tr "go_back"}}</a>{{end}} + + <div class="divider"></div> + <br> + {{if .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl new file mode 100644 index 00000000..e5fdaec0 --- /dev/null +++ b/templates/status/500.tmpl @@ -0,0 +1,71 @@ +{{/* This page should only depend the minimal template functions/variables, to avoid triggering new panics. +* base template functions: AppName, AssetUrlPrefix, AssetVersion, AppSubUrl, ThemeName +* ctx.Locale +* .Flash +* .ErrorMsg +* .SignedUser (optional) +*/}} +<!DOCTYPE html> +<html lang="{{ctx.Locale.Lang}}" data-theme="{{ThemeName .SignedUser}}"> +<head> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>{{ctx.Locale.Tr "error.server_internal"}} - {{AppDisplayName}}</title> + <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_style" .}} +</head> +<body> + <div class="full height"> + <nav class="ui secondary menu"> + <div class="ui container tw-flex"> + <div class="item tw-flex-1"> + <a href="{{AppSubUrl}}/" aria-label="{{ctx.Locale.Tr "home"}}"> + <img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true"> + </a> + </div> + <div class="item"> + <button class="ui icon button disabled">{{svg "octicon-three-bars"}}</button>{{/* a fake button to make the UI looks better*/}} + </div> + </div> + </nav> + <div class="divider tw-my-0"></div> + <div role="main" class="page-content status-page-500"> + <div class="ui container" > + <style> .ui.message.flash-message { text-align: left; } </style> + {{template "base/alert" .}} + </div> + <div class="ui container center"> + <h1 class="tw-mt-8 error-code">500</h1> + <p>{{ctx.Locale.Tr "error.server_internal"}}</p> + </div> + <div class="divider"></div> + <div class="ui container tw-my-8"> + {{if .ErrorMsg}} + <p>{{ctx.Locale.Tr "error.occurred"}}:</p> + <pre class="tw-whitespace-pre-wrap tw-break-all">{{.ErrorMsg}}</pre> + {{end}} + <div class="center tw-mt-8"> + {{if or .SignedUser.IsAdmin .ShowFooterVersion}}<p>{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}</p>{{end}} + {{if .SignedUser.IsAdmin}}<p>{{ctx.Locale.Tr "error.report_message"}}</p>{{end}} + </div> + </div> + </div> + </div> + + {{/* When a sub-template triggers an 500 error, its parent template has been partially rendered, then the 500 page + will be rendered after that partially rendered page, the HTML/JS are totally broken. Use this inline script to try to move it to main viewport. + And this page shouldn't include any other JS file, avoid duplicate JS execution (still due to the partial rendering).*/}} + <script type="module"> + const embedded = document.querySelector('.page-content .page-content.status-page-500'); + if (embedded) { + // move the 500 error page content to main view + const embeddedParent = embedded.parentNode; + let main = document.querySelector('.page-content'); + main = main ?? document.querySelector('body'); + main.prepend(document.createElement('hr')); + main.prepend(embedded); + embeddedParent.remove(); // remove the unrelated 500-page elements (eg: the duplicate nav bar) + } + </script> +</body> +</html> diff --git a/templates/swagger/forgejo-ui.tmpl b/templates/swagger/forgejo-ui.tmpl new file mode 100644 index 00000000..737e2459 --- /dev/null +++ b/templates/swagger/forgejo-ui.tmpl @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"> + <title>Forgejo API</title> + <link href="{{AssetUrlPrefix}}/css/swagger.css?v={{AssetVersion}}" rel="stylesheet"> + </head> + <body> + <a class="swagger-back-link" href="{{AppUrl}}">{{svg "octicon-reply"}}{{.locale.Tr "return_to_forgejo"}}</a> + <div id="swagger-ui" data-source="{{AssetUrlPrefix}}/forgejo/api.{{.APIVersion}}.yml"></div> + <script src="{{AssetUrlPrefix}}/js/forgejoswagger.js?v={{AssetVersion}}"></script> + </body> +</html> diff --git a/templates/swagger/ui.tmpl b/templates/swagger/ui.tmpl new file mode 100644 index 00000000..87b0cfb3 --- /dev/null +++ b/templates/swagger/ui.tmpl @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>Forgejo API</title> + <link href="{{AssetUrlPrefix}}/css/swagger.css?v={{AssetVersion}}" rel="stylesheet"> + </head> + <body> + <a class="swagger-back-link" href="{{AppSubUrl}}/">{{svg "octicon-reply"}}{{ctx.Locale.Tr "return_to_forgejo"}}</a> + <div id="swagger-ui" data-source="{{AppSubUrl}}/swagger.{{.APIJSONVersion}}.json"></div> + <script src="{{AssetUrlPrefix}}/js/swagger.js?v={{AssetVersion}}"></script> + </body> +</html> diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl new file mode 100644 index 00000000..dacec3ed --- /dev/null +++ b/templates/swagger/v1_json.tmpl @@ -0,0 +1,26802 @@ +{ + "consumes": [ + "application/json", + "text/plain" + ], + "produces": [ + "application/json", + "text/html" + ], + "schemes": [ + "https", + "http" + ], + "swagger": "2.0", + "info": { + "description": "This documentation describes the Forgejo API.", + "title": "Forgejo API", + "license": { + "name": "MIT", + "url": "http://opensource.org/licenses/MIT" + }, + "version": "{{AppVer | JSEscape}}" + }, + "basePath": "{{AppSubUrl | JSEscape}}/api/v1", + "paths": { + "/activitypub/repository-id/{repository-id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "activitypub" + ], + "summary": "Returns the Repository actor for a repo", + "operationId": "activitypubRepository", + "parameters": [ + { + "type": "integer", + "description": "repository ID of the repo", + "name": "repository-id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActivityPub" + } + } + } + }, + "/activitypub/repository-id/{repository-id}/inbox": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "activitypub" + ], + "summary": "Send to the inbox", + "operationId": "activitypubRepositoryInbox", + "parameters": [ + { + "type": "integer", + "description": "repository ID of the repo", + "name": "repository-id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/ForgeLike" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + } + } + } + }, + "/activitypub/user-id/{user-id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "activitypub" + ], + "summary": "Returns the Person actor for a user", + "operationId": "activitypubPerson", + "parameters": [ + { + "type": "integer", + "description": "user ID of the user", + "name": "user-id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActivityPub" + } + } + } + }, + "/activitypub/user-id/{user-id}/inbox": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "activitypub" + ], + "summary": "Send to the inbox", + "operationId": "activitypubPersonInbox", + "parameters": [ + { + "type": "integer", + "description": "user ID of the user", + "name": "user-id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + } + } + } + }, + "/admin/cron": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "List cron tasks", + "operationId": "adminCronList", + "parameters": [ + { + "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/CronList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, + "/admin/cron/{task}": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Run cron task", + "operationId": "adminCronRun", + "parameters": [ + { + "type": "string", + "description": "task to run", + "name": "task", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/admin/emails": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "List all emails", + "operationId": "adminGetAllEmails", + "parameters": [ + { + "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/EmailList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, + "/admin/emails/search": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Search all emails", + "operationId": "adminSearchEmails", + "parameters": [ + { + "type": "string", + "description": "keyword", + "name": "q", + "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/EmailList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, + "/admin/hooks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "List system's webhooks", + "operationId": "adminListHooks", + "parameters": [ + { + "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/HookList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Create a hook", + "operationId": "adminCreateHook", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateHookOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Hook" + } + } + } + }, + "/admin/hooks/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Get a hook", + "operationId": "adminGetHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Delete a hook", + "operationId": "adminDeleteHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Update a hook", + "operationId": "adminEditHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to update", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditHookOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + } + } + } + }, + "/admin/orgs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "List all organizations", + "operationId": "adminGetAllOrgs", + "parameters": [ + { + "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/OrganizationList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, + "/admin/runners/registration-token": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Get an global actions runner registration token", + "operationId": "adminGetRunnerRegistrationToken", + "responses": { + "200": { + "$ref": "#/responses/RegistrationToken" + } + } + } + }, + "/admin/unadopted": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "List unadopted repositories", + "operationId": "adminUnadoptedList", + "parameters": [ + { + "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" + }, + { + "type": "string", + "description": "pattern of repositories to search for", + "name": "pattern", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/StringSlice" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, + "/admin/unadopted/{owner}/{repo}": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Adopt unadopted files as a repository", + "operationId": "adminAdoptRepository", + "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": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Delete unadopted files", + "operationId": "adminDeleteUnadoptedRepository", + "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": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, + "/admin/users": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Search users according filter conditions", + "operationId": "adminSearchUsers", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "ID of the user's login source to search for", + "name": "source_id", + "in": "query" + }, + { + "type": "string", + "description": "user's login name to search for", + "name": "login_name", + "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/UserList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Create a user", + "operationId": "adminCreateUser", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateUserOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/User" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/admin/users/{username}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Delete a user", + "operationId": "adminDeleteUser", + "parameters": [ + { + "type": "string", + "description": "username of user to delete", + "name": "username", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "purge the user from the system completely", + "name": "purge", + "in": "query" + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Edit an existing user", + "operationId": "adminEditUser", + "parameters": [ + { + "type": "string", + "description": "username of user to edit", + "name": "username", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditUserOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/User" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/admin/users/{username}/keys": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Add a public key on behalf of a user", + "operationId": "adminCreatePublicKey", + "parameters": [ + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + }, + { + "name": "key", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateKeyOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/PublicKey" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/admin/users/{username}/keys/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Delete a user's public key", + "operationId": "adminDeleteUserPublicKey", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the key to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/admin/users/{username}/orgs": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Create an organization", + "operationId": "adminCreateOrg", + "parameters": [ + { + "type": "string", + "description": "username of the user that will own the created organization", + "name": "username", + "in": "path", + "required": true + }, + { + "name": "organization", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrgOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Organization" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/admin/users/{username}/rename": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Rename a user", + "operationId": "adminRenameUser", + "parameters": [ + { + "type": "string", + "description": "existing username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RenameUserOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/admin/users/{username}/repos": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "Create a repository on behalf of a user", + "operationId": "adminCreateRepo", + "parameters": [ + { + "type": "string", + "description": "username of the user. This user will own the created repository", + "name": "username", + "in": "path", + "required": true + }, + { + "name": "repository", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateRepoOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Repository" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/gitignore/templates": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns a list of all gitignore templates", + "operationId": "listGitignoresTemplates", + "responses": { + "200": { + "$ref": "#/responses/GitignoreTemplateList" + } + } + } + }, + "/gitignore/templates/{name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns information about a gitignore template", + "operationId": "getGitignoreTemplateInfo", + "parameters": [ + { + "type": "string", + "description": "name of the template", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/GitignoreTemplateInfo" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/label/templates": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns a list of all label templates", + "operationId": "listLabelTemplates", + "responses": { + "200": { + "$ref": "#/responses/LabelTemplateList" + } + } + } + }, + "/label/templates/{name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns all labels in a template", + "operationId": "getLabelTemplateInfo", + "parameters": [ + { + "type": "string", + "description": "name of the template", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/LabelTemplateInfo" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/licenses": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns a list of all license templates", + "operationId": "listLicenseTemplates", + "responses": { + "200": { + "$ref": "#/responses/LicenseTemplateList" + } + } + } + }, + "/licenses/{name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns information about a license template", + "operationId": "getLicenseTemplateInfo", + "parameters": [ + { + "type": "string", + "description": "name of the license", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/LicenseTemplateInfo" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/markdown": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "text/html" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Render a markdown document as HTML", + "operationId": "renderMarkdown", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/MarkdownOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/MarkdownRender" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/markdown/raw": { + "post": { + "consumes": [ + "text/plain" + ], + "produces": [ + "text/html" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Render raw markdown as HTML", + "operationId": "renderMarkdownRaw", + "parameters": [ + { + "description": "Request body to render", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/MarkdownRender" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/markup": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "text/html" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Render a markup document as HTML", + "operationId": "renderMarkup", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/MarkupOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/MarkupRender" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/nodeinfo": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns the nodeinfo of the Gitea application", + "operationId": "getNodeInfo", + "responses": { + "200": { + "$ref": "#/responses/NodeInfo" + } + } + } + }, + "/notifications": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "notification" + ], + "summary": "List users's notification threads", + "operationId": "notifyGetList", + "parameters": [ + { + "type": "boolean", + "description": "If true, show notifications marked as read. Default value is false", + "name": "all", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread \u0026 pinned.", + "name": "status-types", + "in": "query" + }, + { + "type": "array", + "items": { + "enum": [ + "issue", + "pull", + "commit", + "repository" + ], + "type": "string" + }, + "collectionFormat": "multi", + "description": "filter notifications by subject type", + "name": "subject-type", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show notifications updated after the given time. This is a timestamp in RFC 3339 format", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show notifications updated before the given time. This is a timestamp in RFC 3339 format", + "name": "before", + "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/NotificationThreadList" + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "notification" + ], + "summary": "Mark notification threads as read, pinned or unread", + "operationId": "notifyReadList", + "parameters": [ + { + "type": "string", + "format": "date-time", + "description": "Describes the last point that notifications were checked. Anything updated since this time will not be updated.", + "name": "last_read_at", + "in": "query" + }, + { + "type": "string", + "description": "If true, mark all notifications on this repo. Default value is false", + "name": "all", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.", + "name": "status-types", + "in": "query" + }, + { + "type": "string", + "description": "Status to mark notifications as, Defaults to read.", + "name": "to-status", + "in": "query" + } + ], + "responses": { + "205": { + "$ref": "#/responses/NotificationThreadList" + } + } + } + }, + "/notifications/new": { + "get": { + "tags": [ + "notification" + ], + "summary": "Check if unread notifications exist", + "operationId": "notifyNewAvailable", + "responses": { + "200": { + "$ref": "#/responses/NotificationCount" + } + } + } + }, + "/notifications/threads/{id}": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "notification" + ], + "summary": "Get notification thread by ID", + "operationId": "notifyGetThread", + "parameters": [ + { + "type": "string", + "description": "id of notification thread", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/NotificationThread" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "notification" + ], + "summary": "Mark notification thread as read by ID", + "operationId": "notifyReadThread", + "parameters": [ + { + "type": "string", + "description": "id of notification thread", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "default": "read", + "description": "Status to mark notifications as", + "name": "to-status", + "in": "query" + } + ], + "responses": { + "205": { + "$ref": "#/responses/NotificationThread" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/org/{org}/repos": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create a repository in an organization", + "operationId": "createOrgRepoDeprecated", + "deprecated": true, + "parameters": [ + { + "type": "string", + "description": "name of organization", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateRepoOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/orgs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get list of organizations", + "operationId": "orgGetAll", + "parameters": [ + { + "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/OrganizationList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create an organization", + "operationId": "orgCreate", + "parameters": [ + { + "name": "organization", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOrgOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Organization" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/orgs/{org}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get an organization", + "operationId": "orgGet", + "parameters": [ + { + "type": "string", + "description": "name of the organization to get", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Organization" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Delete an organization", + "operationId": "orgDelete", + "parameters": [ + { + "type": "string", + "description": "organization that is to be deleted", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Edit an organization", + "operationId": "orgEdit", + "parameters": [ + { + "type": "string", + "description": "name of the organization to edit", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/EditOrgOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Organization" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/actions/runners/registration-token": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get an organization's actions runner registration token", + "operationId": "orgGetRunnerRegistrationToken", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/RegistrationToken" + } + } + } + }, + "/orgs/{org}/actions/secrets": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's actions secrets", + "operationId": "orgListActionsSecrets", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/SecretList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/actions/secrets/{secretname}": { + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create or Update a secret value in an organization", + "operationId": "updateOrgSecret", + "parameters": [ + { + "type": "string", + "description": "name of organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the secret", + "name": "secretname", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateOrUpdateSecretOption" + } + } + ], + "responses": { + "201": { + "description": "response when creating a secret" + }, + "204": { + "description": "response when updating a secret" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Delete a secret in an organization", + "operationId": "deleteOrgSecret", + "parameters": [ + { + "type": "string", + "description": "name of organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the secret", + "name": "secretname", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "delete one secret of the organization" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/actions/variables": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get an org-level variables list", + "operationId": "getOrgVariablesList", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/VariableList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/actions/variables/{variablename}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get an org-level variable", + "operationId": "getOrgVariable", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActionVariable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Update an org-level variable", + "operationId": "updateOrgVariable", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateVariableOption" + } + } + ], + "responses": { + "201": { + "description": "response when updating an org-level variable" + }, + "204": { + "description": "response when updating an org-level variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create an org-level variable", + "operationId": "createOrgVariable", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateVariableOption" + } + } + ], + "responses": { + "201": { + "description": "response when creating an org-level variable" + }, + "204": { + "description": "response when creating an org-level variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Delete an org-level variable", + "operationId": "deleteOrgVariable", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActionVariable" + }, + "201": { + "description": "response when deleting a variable" + }, + "204": { + "description": "response when deleting a variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/activities/feeds": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's activity feeds", + "operationId": "orgListActivityFeeds", + "parameters": [ + { + "type": "string", + "description": "name of the org", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "date", + "description": "the date of the activities to be found", + "name": "date", + "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/ActivityFeedsList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/avatar": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Update Avatar", + "operationId": "orgUpdateAvatar", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateUserAvatarOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Delete Avatar", + "operationId": "orgDeleteAvatar", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/block/{username}": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Blocks a user from the organization", + "operationId": "orgBlockUser", + "parameters": [ + { + "type": "string", + "description": "name of the org", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/orgs/{org}/hooks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's webhooks", + "operationId": "orgListHooks", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/HookList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create a hook", + "operationId": "orgCreateHook", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateHookOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Hook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/hooks/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get a hook", + "operationId": "orgGetHook", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the hook to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Delete a hook", + "operationId": "orgDeleteHook", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the hook to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Update a hook", + "operationId": "orgEditHook", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the hook to update", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditHookOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/labels": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's labels", + "operationId": "orgListLabels", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/LabelList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create a label for an organization", + "operationId": "orgCreateLabel", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateLabelOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Label" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/orgs/{org}/labels/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get a single label", + "operationId": "orgGetLabel", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the label to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Label" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "organization" + ], + "summary": "Delete a label", + "operationId": "orgDeleteLabel", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the label to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Update a label", + "operationId": "orgEditLabel", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the label to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditLabelOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Label" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/orgs/{org}/list_blocked": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List the organization's blocked users", + "operationId": "orgListBlockedUsers", + "parameters": [ + { + "type": "string", + "description": "name of the org", + "name": "org", + "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/BlockedUserList" + } + } + } + }, + "/orgs/{org}/members": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's members", + "operationId": "orgListMembers", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/members/{username}": { + "get": { + "tags": [ + "organization" + ], + "summary": "Check if a user is a member of an organization", + "operationId": "orgIsMember", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "user is a member" + }, + "303": { + "description": "redirection to /orgs/{org}/public_members/{username}" + }, + "404": { + "description": "user is not a member" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Remove a member from an organization", + "operationId": "orgDeleteMember", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "member removed" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/public_members": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's public members", + "operationId": "orgListPublicMembers", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/public_members/{username}": { + "get": { + "tags": [ + "organization" + ], + "summary": "Check if a user is a public member of an organization", + "operationId": "orgIsPublicMember", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "user is a public member" + }, + "404": { + "description": "user is not a public member" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Publicize a user's membership", + "operationId": "orgPublicizeMember", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "membership publicized" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Conceal a user's membership", + "operationId": "orgConcealMember", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/repos": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's repos", + "operationId": "orgListRepos", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/RepositoryList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create a repository in an organization", + "operationId": "createOrgRepo", + "parameters": [ + { + "type": "string", + "description": "name of organization", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateRepoOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Repository" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/teams": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List an organization's teams", + "operationId": "orgListTeams", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "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/TeamList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Create a team", + "operationId": "orgCreateTeam", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateTeamOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Team" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/orgs/{org}/teams/search": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Search for teams within an organization", + "operationId": "teamSearch", + "parameters": [ + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "keywords to search", + "name": "q", + "in": "query" + }, + { + "type": "boolean", + "description": "include search within team description (defaults to true)", + "name": "include_desc", + "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": { + "description": "SearchResults of a successful search", + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/Team" + } + }, + "ok": { + "type": "boolean" + } + } + } + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/orgs/{org}/unblock/{username}": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Unblock a user from the organization", + "operationId": "orgUnblockUser", + "parameters": [ + { + "type": "string", + "description": "name of the org", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/packages/{owner}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "package" + ], + "summary": "Gets all packages of an owner", + "operationId": "listPackages", + "parameters": [ + { + "type": "string", + "description": "owner of the packages", + "name": "owner", + "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" + }, + { + "enum": [ + "alpine", + "cargo", + "chef", + "composer", + "conan", + "conda", + "container", + "cran", + "debian", + "generic", + "go", + "helm", + "maven", + "npm", + "nuget", + "pub", + "pypi", + "rpm", + "rubygems", + "swift", + "vagrant" + ], + "type": "string", + "description": "package type filter", + "name": "type", + "in": "query" + }, + { + "type": "string", + "description": "name filter", + "name": "q", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/PackageList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/packages/{owner}/{type}/{name}/{version}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "package" + ], + "summary": "Gets a package", + "operationId": "getPackage", + "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": "version of the package", + "name": "version", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Package" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "package" + ], + "summary": "Delete a package", + "operationId": "deletePackage", + "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": "version of the package", + "name": "version", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/packages/{owner}/{type}/{name}/{version}/files": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "package" + ], + "summary": "Gets all files of a package", + "operationId": "listPackageFiles", + "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": "version of the package", + "name": "version", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PackageFileList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/issues/search": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Search for issues across the repositories that the user has access to", + "operationId": "issueSearchIssues", + "parameters": [ + { + "type": "string", + "description": "whether issue is open or closed", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded", + "name": "labels", + "in": "query" + }, + { + "type": "string", + "description": "comma separated list of milestone names. Fetch only issues that have any of this milestones. Non existent are discarded", + "name": "milestones", + "in": "query" + }, + { + "type": "string", + "description": "search string", + "name": "q", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "repository to prioritize in the results", + "name": "priority_repo_id", + "in": "query" + }, + { + "type": "string", + "description": "filter by type (issues / pulls) if set", + "name": "type", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show notifications updated after the given time. This is a timestamp in RFC 3339 format", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show notifications updated before the given time. This is a timestamp in RFC 3339 format", + "name": "before", + "in": "query" + }, + { + "type": "boolean", + "description": "filter (issues / pulls) assigned to you, default is false", + "name": "assigned", + "in": "query" + }, + { + "type": "boolean", + "description": "filter (issues / pulls) created by you, default is false", + "name": "created", + "in": "query" + }, + { + "type": "boolean", + "description": "filter (issues / pulls) mentioning you, default is false", + "name": "mentioned", + "in": "query" + }, + { + "type": "boolean", + "description": "filter pulls requesting your review, default is false", + "name": "review_requested", + "in": "query" + }, + { + "type": "boolean", + "description": "filter pulls reviewed by you, default is false", + "name": "reviewed", + "in": "query" + }, + { + "type": "string", + "description": "filter by owner", + "name": "owner", + "in": "query" + }, + { + "type": "string", + "description": "filter by team (requires organization owner parameter to be provided)", + "name": "team", + "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/IssueList" + } + } + } + }, + "/repos/migrate": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Migrate a remote git repository", + "operationId": "repoMigrate", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/MigrateRepoOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "409": { + "description": "The repository with the same name already exists." + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/search": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Search for repositories", + "operationId": "repoSearch", + "parameters": [ + { + "type": "string", + "description": "keyword", + "name": "q", + "in": "query" + }, + { + "type": "boolean", + "description": "Limit search to repositories with keyword as topic", + "name": "topic", + "in": "query" + }, + { + "type": "boolean", + "description": "include search of keyword within repository description", + "name": "includeDesc", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "search only for repos that the user with the given id owns or contributes to", + "name": "uid", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "repo owner to prioritize in the results", + "name": "priority_owner_id", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "search only for repos that belong to the given team id", + "name": "team_id", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "search only for repos that the user with the given id has starred", + "name": "starredBy", + "in": "query" + }, + { + "type": "boolean", + "description": "include private repositories this user has access to (defaults to true)", + "name": "private", + "in": "query" + }, + { + "type": "boolean", + "description": "show only pubic, private or all repositories (defaults to all)", + "name": "is_private", + "in": "query" + }, + { + "type": "boolean", + "description": "include template repositories this user has access to (defaults to true)", + "name": "template", + "in": "query" + }, + { + "type": "boolean", + "description": "show only archived, non-archived or all repositories (defaults to all)", + "name": "archived", + "in": "query" + }, + { + "type": "string", + "description": "type of repository to search for. Supported values are \"fork\", \"source\", \"mirror\" and \"collaborative\"", + "name": "mode", + "in": "query" + }, + { + "type": "boolean", + "description": "if `uid` is given, search only for repos that the user owns", + "name": "exclusive", + "in": "query" + }, + { + "type": "string", + "description": "sort repos by attribute. Supported values are \"alpha\", \"created\", \"updated\", \"size\", \"git_size\", \"lfs_size\", \"stars\", \"forks\" and \"id\". Default is \"alpha\"", + "name": "sort", + "in": "query" + }, + { + "type": "string", + "description": "sort order, either \"asc\" (ascending) or \"desc\" (descending). Default is \"asc\", ignored if \"sort\" is not specified.", + "name": "order", + "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/SearchResults" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a repository", + "operationId": "repoGet", + "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/Repository" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a repository", + "operationId": "repoDelete", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to delete", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to delete", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Edit a repository's properties. Only fields that are set will be changed.", + "operationId": "repoEdit", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to edit", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to edit", + "name": "repo", + "in": "path", + "required": true + }, + { + "description": "Properties of a repo that you can edit", + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditRepoOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/actions/secrets": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List an repo's actions secrets", + "operationId": "repoListActionsSecrets", + "parameters": [ + { + "type": "string", + "description": "owner of the repository", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repository", + "name": "repo", + "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/SecretList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/secrets/{secretname}": { + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create or Update a secret value in a repository", + "operationId": "updateRepoSecret", + "parameters": [ + { + "type": "string", + "description": "owner of the repository", + "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 secret", + "name": "secretname", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateOrUpdateSecretOption" + } + } + ], + "responses": { + "201": { + "description": "response when creating a secret" + }, + "204": { + "description": "response when updating a secret" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a secret in a repository", + "operationId": "deleteRepoSecret", + "parameters": [ + { + "type": "string", + "description": "owner of the repository", + "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 secret", + "name": "secretname", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "delete one secret of the organization" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/tasks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's action tasks", + "operationId": "ListActionTasks", + "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", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results, default maximum page size is 50", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/TasksList" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/conflict" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/actions/variables": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get repo-level variables list", + "operationId": "getRepoVariablesList", + "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": "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/VariableList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/variables/{variablename}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a repo-level variable", + "operationId": "getRepoVariable", + "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 variable", + "name": "variablename", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActionVariable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Update a repo-level variable", + "operationId": "updateRepoVariable", + "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 variable", + "name": "variablename", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateVariableOption" + } + } + ], + "responses": { + "201": { + "description": "response when updating a repo-level variable" + }, + "204": { + "description": "response when updating a repo-level variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a repo-level variable", + "operationId": "createRepoVariable", + "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 variable", + "name": "variablename", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateVariableOption" + } + } + ], + "responses": { + "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" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a repo-level variable", + "operationId": "deleteRepoVariable", + "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 variable", + "name": "variablename", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActionVariable" + }, + "201": { + "description": "response when deleting a variable" + }, + "204": { + "description": "response when deleting a variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/actions/workflows/{workflowname}/dispatches": { + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Dispatches a workflow", + "operationId": "DispatchWorkflow", + "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": "name of the workflow", + "name": "workflowname", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/DispatchWorkflowOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/activities/feeds": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's activity feeds", + "operationId": "repoListActivityFeeds", + "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", + "format": "date", + "description": "the date of the activities to be found", + "name": "date", + "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/ActivityFeedsList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/archive/{archive}": { + "get": { + "produces": [ + "application/octet-stream", + "application/zip", + "application/gzip" + ], + "tags": [ + "repository" + ], + "summary": "Get an archive of a repository", + "operationId": "repoGetArchive", + "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 git reference for download with attached archive format (e.g. master.zip)", + "name": "archive", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "success" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/assignees": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Return all users that have write access and can be assigned to issues", + "operationId": "repoGetAssignees", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/avatar": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Update avatar", + "operationId": "repoUpdateAvatar", + "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/UpdateRepoAvatarOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete avatar", + "operationId": "repoDeleteAvatar", + "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": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/branch_protections": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List branch protections for a repository", + "operationId": "repoListBranchProtection", + "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/BranchProtectionList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a branch protections for a repository", + "operationId": "repoCreateBranchProtection", + "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/CreateBranchProtectionOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/BranchProtection" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/branch_protections/{name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a specific branch protection for the repository", + "operationId": "repoGetBranchProtection", + "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": "name of protected branch", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/BranchProtection" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a specific branch protection for the repository", + "operationId": "repoDeleteBranchProtection", + "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": "name of protected branch", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Edit a branch protections for a repository. Only fields that are set will be changed", + "operationId": "repoEditBranchProtection", + "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": "name of protected branch", + "name": "name", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditBranchProtectionOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/BranchProtection" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/branches": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's branches", + "operationId": "repoListBranches", + "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", + "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/BranchList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a branch", + "operationId": "repoCreateBranch", + "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/CreateBranchRepoOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Branch" + }, + "403": { + "description": "The branch is archived or a mirror." + }, + "404": { + "description": "The old branch does not exist." + }, + "409": { + "description": "The branch with the same name already exists." + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/branches/{branch}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Retrieve a specific branch from a repository, including its effective branch protection", + "operationId": "repoGetBranch", + "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": "branch to get", + "name": "branch", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Branch" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a specific branch from a repository", + "operationId": "repoDeleteBranch", + "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": "branch to delete", + "name": "branch", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/collaborators": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's collaborators", + "operationId": "repoListCollaborators", + "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", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/collaborators/{collaborator}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Check if a user is a collaborator of a repository", + "operationId": "repoCheckCollaborator", + "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": "username of the collaborator", + "name": "collaborator", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Add a collaborator to a repository", + "operationId": "repoAddCollaborator", + "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": "username of the collaborator to add", + "name": "collaborator", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/AddCollaboratorOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a collaborator from a repository", + "operationId": "repoDeleteCollaborator", + "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": "username of the collaborator to delete", + "name": "collaborator", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/collaborators/{collaborator}/permission": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get repository permissions for a user", + "operationId": "repoGetRepoPermissions", + "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": "username of the collaborator", + "name": "collaborator", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/RepoCollaboratorPermission" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/commits": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a list of all commits from a repository", + "operationId": "repoGetAllCommits", + "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": "SHA or branch to start listing commits from (usually 'master')", + "name": "sha", + "in": "query" + }, + { + "type": "string", + "description": "filepath of a file/dir", + "name": "path", + "in": "query" + }, + { + "type": "boolean", + "description": "include diff stats for every commit (disable for speedup, default 'true')", + "name": "stat", + "in": "query" + }, + { + "type": "boolean", + "description": "include verification for every commit (disable for speedup, default 'true')", + "name": "verification", + "in": "query" + }, + { + "type": "boolean", + "description": "include a list of affected files for every commit (disable for speedup, default 'true')", + "name": "files", + "in": "query" + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results (ignored if used with 'path')", + "name": "limit", + "in": "query" + }, + { + "type": "string", + "description": "commits that match the given specifier will not be listed.", + "name": "not", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/CommitList" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/EmptyRepository" + } + } + } + }, + "/repos/{owner}/{repo}/commits/{ref}/status": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a commit's combined status, by branch/tag/commit reference", + "operationId": "repoGetCombinedStatusByRef", + "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": "name of branch/tag/commit", + "name": "ref", + "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/CombinedStatus" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/commits/{ref}/statuses": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a commit's statuses, by branch/tag/commit reference", + "operationId": "repoListStatusesByRef", + "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": "name of branch/tag/commit", + "name": "ref", + "in": "path", + "required": true + }, + { + "enum": [ + "oldest", + "recentupdate", + "leastupdate", + "leastindex", + "highestindex" + ], + "type": "string", + "description": "type of sort", + "name": "sort", + "in": "query" + }, + { + "enum": [ + "pending", + "success", + "error", + "failure", + "warning" + ], + "type": "string", + "description": "type of state", + "name": "state", + "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/CommitStatusList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/commits/{sha}/pull": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get the pull request of the commit", + "operationId": "repoGetCommitPullRequest", + "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": "SHA of the commit to get", + "name": "sha", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullRequest" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/compare/{basehead}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get commit comparison information", + "operationId": "repoCompareDiff", + "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": "compare two branches or commits", + "name": "basehead", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Compare" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/contents": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets the metadata of all the entries of the root dir", + "operationId": "repoGetContentsList", + "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 the repository’s default branch (usually master)", + "name": "ref", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/ContentsListResponse" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Modify multiple files in a repository", + "operationId": "repoChangeFiles", + "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", + "required": true, + "schema": { + "$ref": "#/definitions/ChangeFilesOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/FilesResponse" + }, + "403": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/contents/{filepath}": { + "get": { + "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", + "operationId": "repoGetContents", + "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", + "name": "filepath", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag. Default the repository’s default branch (usually master)", + "name": "ref", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/ContentsResponse" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Update a file in a repository", + "operationId": "repoUpdateFile", + "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 file to update", + "name": "filepath", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateFileOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/FileResponse" + }, + "403": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a file in a repository", + "operationId": "repoCreateFile", + "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 file to create", + "name": "filepath", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateFileOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/FileResponse" + }, + "403": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a file in a repository", + "operationId": "repoDeleteFile", + "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 file to delete", + "name": "filepath", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DeleteFileOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/FileDeleteResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/diffpatch": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Apply diff patch to repository", + "operationId": "repoApplyDiffPatch", + "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", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateFileOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/FileResponse" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/editorconfig/{filepath}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get the EditorConfig definitions of a file in a repository", + "operationId": "repoGetEditorConfig", + "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": "filepath of file to get", + "name": "filepath", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag. Default the repository’s default branch (usually master)", + "name": "ref", + "in": "query" + } + ], + "responses": { + "200": { + "description": "success" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/flags": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's flags", + "operationId": "repoListFlags", + "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/StringSlice" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Replace all flags of a repository", + "operationId": "repoReplaceAllFlags", + "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/ReplaceFlagsOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Remove all flags from a repository", + "operationId": "repoDeleteAllFlags", + "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": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/flags/{flag}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Check if a repository has a given flag", + "operationId": "repoCheckFlag", + "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": "name of the flag", + "name": "flag", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Add a flag to a repository", + "operationId": "repoAddFlag", + "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": "name of the flag", + "name": "flag", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Remove a flag from a repository", + "operationId": "repoDeleteFlag", + "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": "name of the flag", + "name": "flag", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/forks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's forks", + "operationId": "listForks", + "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", + "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/RepositoryList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Fork a repository", + "operationId": "createFork", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to fork", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to fork", + "name": "repo", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateForkOption" + } + } + ], + "responses": { + "202": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "description": "The repository with the same name already exists." + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/git/blobs/{sha}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets the blob of a repository.", + "operationId": "GetBlob", + "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": "sha of the commit", + "name": "sha", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/GitBlobResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/git/commits/{sha}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a single commit from a repository", + "operationId": "repoGetSingleCommit", + "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": "a git ref or commit sha", + "name": "sha", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "include diff stats for every commit (disable for speedup, default 'true')", + "name": "stat", + "in": "query" + }, + { + "type": "boolean", + "description": "include verification for every commit (disable for speedup, default 'true')", + "name": "verification", + "in": "query" + }, + { + "type": "boolean", + "description": "include a list of affected files for every commit (disable for speedup, default 'true')", + "name": "files", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/Commit" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/git/commits/{sha}.{diffType}": { + "get": { + "produces": [ + "text/plain" + ], + "tags": [ + "repository" + ], + "summary": "Get a commit's diff or patch", + "operationId": "repoDownloadCommitDiffOrPatch", + "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": "SHA of the commit to get", + "name": "sha", + "in": "path", + "required": true + }, + { + "enum": [ + "diff", + "patch" + ], + "type": "string", + "description": "whether the output is diff or patch", + "name": "diffType", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/string" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/git/notes/{sha}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a note corresponding to a single commit from a repository", + "operationId": "repoGetNote", + "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": "a git ref or commit sha", + "name": "sha", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "include verification for every commit (disable for speedup, default 'true')", + "name": "verification", + "in": "query" + }, + { + "type": "boolean", + "description": "include a list of affected files for every commit (disable for speedup, default 'true')", + "name": "files", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/Note" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/git/refs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get specified ref or filtered repository's refs", + "operationId": "repoListAllGitRefs", + "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/ReferenceList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/git/refs/{ref}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get specified ref or filtered repository's refs", + "operationId": "repoListGitRefs", + "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": "part or full name of the ref", + "name": "ref", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ReferenceList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/git/tags/{sha}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets the tag object of an annotated tag (not lightweight tags)", + "operationId": "GetAnnotatedTag", + "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": "sha of the tag. The Git tags API only supports annotated tag objects, not lightweight tags.", + "name": "sha", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/AnnotatedTag" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/git/trees/{sha}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets the tree of a repository.", + "operationId": "GetTree", + "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": "sha of the commit", + "name": "sha", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "show all directories and files", + "name": "recursive", + "in": "query" + }, + { + "type": "integer", + "description": "page number; the 'truncated' field in the response will be true if there are still more items after this page, false if the last page", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "number of items per page", + "name": "per_page", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/GitTreeResponse" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/hooks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List the hooks in a repository", + "operationId": "repoListHooks", + "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", + "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/HookList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a hook", + "operationId": "repoCreateHook", + "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/CreateHookOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Hook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/hooks/git": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List the Git hooks in a repository", + "operationId": "repoListGitHooks", + "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/GitHookList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/hooks/git/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a Git hook", + "operationId": "repoGetGitHook", + "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 hook to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/GitHook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a Git hook in a repository", + "operationId": "repoDeleteGitHook", + "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 hook to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Edit a Git hook in a repository", + "operationId": "repoEditGitHook", + "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 hook to get", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditGitHookOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/GitHook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/hooks/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a hook", + "operationId": "repoGetHook", + "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": "id of the hook to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a hook in a repository", + "operationId": "repoDeleteHook", + "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": "id of the hook to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Edit a hook in a repository", + "operationId": "repoEditHook", + "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 hook", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditHookOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/hooks/{id}/tests": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Test a push webhook", + "operationId": "repoTestHook", + "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": "id of the hook to test", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag, indicates which commit will be loaded to the webhook payload.", + "name": "ref", + "in": "query" + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issue_config": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Returns the issue config for a repo", + "operationId": "repoGetIssueConfig", + "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/RepoIssueConfig" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issue_config/validate": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Returns the validation information for a issue config", + "operationId": "repoValidateIssueConfig", + "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/RepoIssueConfigValidation" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issue_templates": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get available issue templates for a repository", + "operationId": "repoGetIssueTemplates", + "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/IssueTemplates" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List a repository's issues", + "operationId": "issueListIssues", + "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 + }, + { + "enum": [ + "closed", + "open", + "all" + ], + "type": "string", + "description": "whether issue is open or closed", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "comma separated list of labels. Fetch only issues that have any of this labels. Non existent labels are discarded", + "name": "labels", + "in": "query" + }, + { + "type": "string", + "description": "search string", + "name": "q", + "in": "query" + }, + { + "enum": [ + "issues", + "pulls" + ], + "type": "string", + "description": "filter by type (issues / pulls) if set", + "name": "type", + "in": "query" + }, + { + "type": "string", + "description": "comma separated list of milestone names or ids. It uses names and fall back to ids. Fetch only issues that have any of this milestones. Non existent milestones are discarded", + "name": "milestones", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show items updated after the given time. This is a timestamp in RFC 3339 format", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show items updated before the given time. This is a timestamp in RFC 3339 format", + "name": "before", + "in": "query" + }, + { + "type": "string", + "description": "Only show items which were created by the given user", + "name": "created_by", + "in": "query" + }, + { + "type": "string", + "description": "Only show items for which the given user is assigned", + "name": "assigned_by", + "in": "query" + }, + { + "type": "string", + "description": "Only show items in which the given user was mentioned", + "name": "mentioned_by", + "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/IssueList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Create an issue. If using deadline only the date will be taken into account, and time of day ignored.", + "operationId": "issueCreateIssue", + "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/CreateIssueOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Issue" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "412": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List all comments in a repository", + "operationId": "issueGetRepoComments", + "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", + "format": "date-time", + "description": "if provided, only comments updated since the provided time are returned.", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "if provided, only comments updated before the provided time are returned.", + "name": "before", + "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/CommentList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments/{id}": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get a comment", + "operationId": "issueGetComment", + "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": "id of the comment", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Comment" + }, + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "issue" + ], + "summary": "Delete a comment", + "operationId": "issueDeleteComment", + "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": "id of comment to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Edit a comment", + "operationId": "issueEditComment", + "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": "id of the comment to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditIssueCommentOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Comment" + }, + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments/{id}/assets": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List comment's attachments", + "operationId": "issueListIssueCommentAttachments", + "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": "id of the comment", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/AttachmentList" + }, + "404": { + "$ref": "#/responses/error" + } + } + }, + "post": { + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Create a comment attachment", + "operationId": "issueCreateIssueCommentAttachment", + "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": "id of the comment", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the attachment", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "time of the attachment's creation. This is a timestamp in RFC 3339 format", + "name": "updated_at", + "in": "query" + }, + { + "type": "file", + "description": "attachment to upload", + "name": "attachment", + "in": "formData", + "required": true + } + ], + "responses": { + "201": { + "$ref": "#/responses/Attachment" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments/{id}/assets/{attachment_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get a comment attachment", + "operationId": "issueGetIssueCommentAttachment", + "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": "id of the comment", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to get", + "name": "attachment_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Attachment" + }, + "404": { + "$ref": "#/responses/error" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Delete a comment attachment", + "operationId": "issueDeleteIssueCommentAttachment", + "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": "id of the comment", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to delete", + "name": "attachment_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Edit a comment attachment", + "operationId": "issueEditIssueCommentAttachment", + "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": "id of the comment", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to edit", + "name": "attachment_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditAttachmentOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Attachment" + }, + "404": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/comments/{id}/reactions": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get a list of reactions from a comment of an issue", + "operationId": "issueGetCommentReactions", + "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": "id of the comment to edit", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ReactionList" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Add a reaction to a comment of an issue", + "operationId": "issuePostCommentReaction", + "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": "id of the comment to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "content", + "in": "body", + "schema": { + "$ref": "#/definitions/EditReactionOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Reaction" + }, + "201": { + "$ref": "#/responses/Reaction" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Remove a reaction from a comment of an issue", + "operationId": "issueDeleteCommentReaction", + "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": "id of the comment to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "content", + "in": "body", + "schema": { + "$ref": "#/definitions/EditReactionOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/pinned": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repo's pinned issues", + "operationId": "repoListPinnedIssues", + "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/IssueList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get an issue", + "operationId": "issueGetIssue", + "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 to get", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Issue" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "issue" + ], + "summary": "Delete an issue", + "operationId": "issueDelete", + "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 issue to delete", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Edit an issue. If using deadline only the date will be taken into account, and time of day ignored.", + "operationId": "issueEditIssue", + "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 to edit", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditIssueOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Issue" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "412": { + "$ref": "#/responses/error" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/assets": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List issue's attachments", + "operationId": "issueListIssueAttachments", + "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": { + "200": { + "$ref": "#/responses/AttachmentList" + }, + "404": { + "$ref": "#/responses/error" + } + } + }, + "post": { + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Create an issue attachment", + "operationId": "issueCreateIssueAttachment", + "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 + }, + { + "type": "string", + "description": "name of the attachment", + "name": "name", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "time of the attachment's creation. This is a timestamp in RFC 3339 format", + "name": "updated_at", + "in": "query" + }, + { + "type": "file", + "description": "attachment to upload", + "name": "attachment", + "in": "formData", + "required": true + } + ], + "responses": { + "201": { + "$ref": "#/responses/Attachment" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/assets/{attachment_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get an issue attachment", + "operationId": "issueGetIssueAttachment", + "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 + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to get", + "name": "attachment_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Attachment" + }, + "404": { + "$ref": "#/responses/error" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Delete an issue attachment", + "operationId": "issueDeleteIssueAttachment", + "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 + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to delete", + "name": "attachment_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Edit an issue attachment", + "operationId": "issueEditIssueAttachment", + "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 + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to edit", + "name": "attachment_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditAttachmentOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Attachment" + }, + "404": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/blocks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List issues that are blocked by this issue", + "operationId": "issueListBlocks", + "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": "index of the issue", + "name": "index", + "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/IssueList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Block the issue given in the body by the issue in path", + "operationId": "issueCreateIssueBlocking", + "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": "index of the issue", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/IssueMeta" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Issue" + }, + "404": { + "description": "the issue does not exist" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Unblock the issue given in the body by the issue in path", + "operationId": "issueRemoveIssueBlocking", + "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": "index of the issue", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/IssueMeta" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Issue" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/comments": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List all comments on an issue", + "operationId": "issueGetComments", + "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 + }, + { + "type": "string", + "format": "date-time", + "description": "if provided, only comments updated since the specified time are returned.", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "if provided, only comments updated before the provided time are returned.", + "name": "before", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/CommentList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Add a comment to an issue", + "operationId": "issueCreateComment", + "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/CreateIssueCommentOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Comment" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/comments/{id}": { + "delete": { + "tags": [ + "issue" + ], + "summary": "Delete a comment", + "operationId": "issueDeleteCommentDeprecated", + "deprecated": true, + "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", + "description": "this parameter is ignored", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of comment to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Edit a comment", + "operationId": "issueEditCommentDeprecated", + "deprecated": true, + "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", + "description": "this parameter is ignored", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the comment to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditIssueCommentOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Comment" + }, + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/deadline": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Set an issue deadline. If set to null, the deadline is deleted. If using deadline only the date will be taken into account, and time of day ignored.", + "operationId": "issueEditIssueDeadline", + "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 to create or update a deadline on", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditDeadlineOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/IssueDeadline" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/dependencies": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List an issue's dependencies, i.e all issues that block this issue.", + "operationId": "issueListIssueDependencies", + "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": "index of the issue", + "name": "index", + "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/IssueList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Make the issue in the url depend on the issue in the form.", + "operationId": "issueCreateIssueDependencies", + "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": "index of the issue", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/IssueMeta" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Issue" + }, + "404": { + "description": "the issue does not exist" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Remove an issue dependency", + "operationId": "issueRemoveIssueDependencies", + "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": "index of the issue", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/IssueMeta" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Issue" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/labels": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get an issue's labels", + "operationId": "issueGetLabels", + "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": { + "200": { + "$ref": "#/responses/LabelList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Replace an issue's labels", + "operationId": "issueReplaceLabels", + "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/IssueLabelsOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/LabelList" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Add a label to an issue", + "operationId": "issueAddLabel", + "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/IssueLabelsOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/LabelList" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Remove all labels from an issue", + "operationId": "issueClearLabels", + "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/DeleteLabelsOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/labels/{id}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Remove a label from an issue", + "operationId": "issueRemoveLabel", + "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 + }, + { + "type": "integer", + "format": "int64", + "description": "id of the label to remove", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/DeleteLabelsOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/pin": { + "post": { + "tags": [ + "issue" + ], + "summary": "Pin an Issue", + "operationId": "pinIssue", + "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 issue to pin", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "issue" + ], + "summary": "Unpin an Issue", + "operationId": "unpinIssue", + "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 issue to unpin", + "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/{position}": { + "patch": { + "tags": [ + "issue" + ], + "summary": "Moves the Pin to the given Position", + "operationId": "moveIssuePin", + "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 issue", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "the new position", + "name": "position", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/reactions": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get a list reactions of an issue", + "operationId": "issueGetIssueReactions", + "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 + }, + { + "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/ReactionList" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Add a reaction to an issue", + "operationId": "issuePostIssueReaction", + "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": "content", + "in": "body", + "schema": { + "$ref": "#/definitions/EditReactionOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Reaction" + }, + "201": { + "$ref": "#/responses/Reaction" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Remove a reaction from an issue", + "operationId": "issueDeleteIssueReaction", + "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": "content", + "in": "body", + "schema": { + "$ref": "#/definitions/EditReactionOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/stopwatch/delete": { + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Delete an issue's existing stopwatch.", + "operationId": "issueDeleteStopWatch", + "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 to stop the stopwatch on", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "description": "Not repo writer, user does not have rights to toggle stopwatch" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "description": "Cannot cancel a non existent stopwatch" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/stopwatch/start": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Start stopwatch on an issue.", + "operationId": "issueStartStopWatch", + "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 to create the stopwatch on", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "$ref": "#/responses/empty" + }, + "403": { + "description": "Not repo writer, user does not have rights to toggle stopwatch" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "description": "Cannot start a stopwatch again if it already exists" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/stopwatch/stop": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Stop an issue's existing stopwatch.", + "operationId": "issueStopStopWatch", + "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 to stop the stopwatch on", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "$ref": "#/responses/empty" + }, + "403": { + "description": "Not repo writer, user does not have rights to toggle stopwatch" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "description": "Cannot stop a non existent stopwatch" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/subscriptions": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get users who subscribed on an issue.", + "operationId": "issueSubscriptions", + "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 + }, + { + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/subscriptions/check": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Check if user is subscribed to an issue", + "operationId": "issueCheckSubscription", + "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": { + "200": { + "$ref": "#/responses/WatchInfo" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/subscriptions/{user}": { + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Subscribe user to issue", + "operationId": "issueAddSubscription", + "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 + }, + { + "type": "string", + "description": "user to subscribe", + "name": "user", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Already subscribed" + }, + "201": { + "description": "Successfully Subscribed" + }, + "304": { + "description": "User can only subscribe itself if he is no admin" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Unsubscribe user from issue", + "operationId": "issueDeleteSubscription", + "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 + }, + { + "type": "string", + "description": "user witch unsubscribe", + "name": "user", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Already unsubscribed" + }, + "201": { + "description": "Successfully Unsubscribed" + }, + "304": { + "description": "User can only subscribe itself if he is no admin" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/timeline": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List all comments and events on an issue", + "operationId": "issueGetCommentsAndTimeline", + "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 + }, + { + "type": "string", + "format": "date-time", + "description": "if provided, only comments updated since the specified time are returned.", + "name": "since", + "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" + }, + { + "type": "string", + "format": "date-time", + "description": "if provided, only comments updated before the provided time are returned.", + "name": "before", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/TimelineList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/times": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "List an issue's tracked times", + "operationId": "issueTrackedTimes", + "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 + }, + { + "type": "string", + "description": "optional filter by user (available for issue managers)", + "name": "user", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show times updated after the given time. This is a timestamp in RFC 3339 format", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show times updated before the given time. This is a timestamp in RFC 3339 format", + "name": "before", + "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/TrackedTimeList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Add tracked time to a issue", + "operationId": "issueAddTime", + "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/AddTimeOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/TrackedTime" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Reset a tracked time of an issue", + "operationId": "issueResetTime", + "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 to add tracked time to", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/issues/{index}/times/{id}": { + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Delete specific tracked time", + "operationId": "issueDeleteTime", + "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 + }, + { + "type": "integer", + "format": "int64", + "description": "id of time to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/keys": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's keys", + "operationId": "repoListKeys", + "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", + "description": "the key_id to search for", + "name": "key_id", + "in": "query" + }, + { + "type": "string", + "description": "fingerprint of the key", + "name": "fingerprint", + "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/DeployKeyList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Add a key to a repository", + "operationId": "repoCreateKey", + "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/CreateKeyOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/DeployKey" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/keys/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a repository's key by id", + "operationId": "repoGetKey", + "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": "id of the key to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/DeployKey" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "repository" + ], + "summary": "Delete a key from a repository", + "operationId": "repoDeleteKey", + "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": "id of the key to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/labels": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get all of a repository's labels", + "operationId": "issueListLabels", + "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", + "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/LabelList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Create a label", + "operationId": "issueCreateLabel", + "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/CreateLabelOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Label" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/labels/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get a single label", + "operationId": "issueGetLabel", + "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": "id of the label to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Label" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "issue" + ], + "summary": "Delete a label", + "operationId": "issueDeleteLabel", + "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": "id of the label to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Update a label", + "operationId": "issueEditLabel", + "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": "id of the label to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditLabelOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Label" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/languages": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get languages and number of bytes of code written", + "operationId": "repoGetLanguages", + "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/LanguageStatistics" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/media/{filepath}": { + "get": { + "tags": [ + "repository" + ], + "summary": "Get a file or it's LFS object from a repository", + "operationId": "repoGetRawFileOrLFS", + "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": "filepath of the file to get", + "name": "filepath", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag. Default the repository’s default branch (usually master)", + "name": "ref", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Returns raw file content." + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/milestones": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get all of a repository's opened milestones", + "operationId": "issueGetMilestonesList", + "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": "Milestone state, Recognized values are open, closed and all. Defaults to \"open\"", + "name": "state", + "in": "query" + }, + { + "type": "string", + "description": "filter by milestone name", + "name": "name", + "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/MilestoneList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Create a milestone", + "operationId": "issueCreateMilestone", + "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/CreateMilestoneOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Milestone" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/milestones/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Get a milestone", + "operationId": "issueGetMilestone", + "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 milestone to get, identified by ID and if not available by name", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Milestone" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "issue" + ], + "summary": "Delete a milestone", + "operationId": "issueDeleteMilestone", + "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 milestone to delete, identified by ID and if not available by name", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "issue" + ], + "summary": "Update a milestone", + "operationId": "issueEditMilestone", + "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 milestone to edit, identified by ID and if not available by name", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditMilestoneOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Milestone" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/mirror-sync": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Sync a mirrored repository", + "operationId": "repoMirrorSync", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to sync", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to sync", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/new_pin_allowed": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Returns if new Issue Pins are allowed", + "operationId": "repoNewPinAllowed", + "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/RepoNewIssuePinsAllowed" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/notifications": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "notification" + ], + "summary": "List users's notification threads on a specific repo", + "operationId": "notifyGetRepoList", + "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": "boolean", + "description": "If true, show notifications marked as read. Default value is false", + "name": "all", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread \u0026 pinned", + "name": "status-types", + "in": "query" + }, + { + "type": "array", + "items": { + "enum": [ + "issue", + "pull", + "commit", + "repository" + ], + "type": "string" + }, + "collectionFormat": "multi", + "description": "filter notifications by subject type", + "name": "subject-type", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show notifications updated after the given time. This is a timestamp in RFC 3339 format", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show notifications updated before the given time. This is a timestamp in RFC 3339 format", + "name": "before", + "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/NotificationThreadList" + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "notification" + ], + "summary": "Mark notification threads as read, pinned or unread on a specific repo", + "operationId": "notifyReadRepoList", + "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": "If true, mark all notifications on this repo. Default value is false", + "name": "all", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "description": "Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.", + "name": "status-types", + "in": "query" + }, + { + "type": "string", + "description": "Status to mark notifications as. Defaults to read.", + "name": "to-status", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Describes the last point that notifications were checked. Anything updated since this time will not be updated.", + "name": "last_read_at", + "in": "query" + } + ], + "responses": { + "205": { + "$ref": "#/responses/NotificationThreadList" + } + } + } + }, + "/repos/{owner}/{repo}/pulls": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repo's pull requests", + "operationId": "repoListPullRequests", + "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 + }, + { + "enum": [ + "closed", + "open", + "all" + ], + "type": "string", + "description": "State of pull request: open or closed (optional)", + "name": "state", + "in": "query" + }, + { + "enum": [ + "oldest", + "recentupdate", + "leastupdate", + "mostcomment", + "leastcomment", + "priority" + ], + "type": "string", + "description": "Type of sort", + "name": "sort", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "ID of the milestone", + "name": "milestone", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "collectionFormat": "multi", + "description": "Label IDs", + "name": "labels", + "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/PullRequestList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a pull request", + "operationId": "repoCreatePullRequest", + "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/CreatePullRequestOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/PullRequest" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/pinned": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repo's pinned pull requests", + "operationId": "repoListPinnedPullRequests", + "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/PullRequestList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{base}/{head}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a pull request by base and head", + "operationId": "repoGetPullRequestByBaseHead", + "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": "base of the pull request to get", + "name": "base", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "head of the pull request to get", + "name": "head", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullRequest" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a pull request", + "operationId": "repoGetPullRequest", + "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 pull request to get", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullRequest" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Update a pull request. If using deadline only the date will be taken into account, and time of day ignored.", + "operationId": "repoEditPullRequest", + "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 pull request to edit", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditPullRequestOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/PullRequest" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/error" + }, + "412": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}.{diffType}": { + "get": { + "produces": [ + "text/plain" + ], + "tags": [ + "repository" + ], + "summary": "Get a pull request diff or patch", + "operationId": "repoDownloadPullDiffOrPatch", + "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 pull request to get", + "name": "index", + "in": "path", + "required": true + }, + { + "enum": [ + "diff", + "patch" + ], + "type": "string", + "description": "whether the output is diff or patch", + "name": "diffType", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "whether to include binary file changes. if true, the diff is applicable with `git apply`", + "name": "binary", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/string" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/commits": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get commits for a pull request", + "operationId": "repoGetPullRequestCommits", + "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 pull request to get", + "name": "index", + "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" + }, + { + "type": "boolean", + "description": "include verification for every commit (disable for speedup, default 'true')", + "name": "verification", + "in": "query" + }, + { + "type": "boolean", + "description": "include a list of affected files for every commit (disable for speedup, default 'true')", + "name": "files", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/CommitList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/files": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get changed files for a pull request", + "operationId": "repoGetPullRequestFiles", + "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 pull request to get", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "skip to given file", + "name": "skip-to", + "in": "query" + }, + { + "enum": [ + "ignore-all", + "ignore-change", + "ignore-eol", + "show-all" + ], + "type": "string", + "description": "whitespace behavior", + "name": "whitespace", + "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/ChangedFileList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/merge": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Check if a pull request has been merged", + "operationId": "repoPullRequestIsMerged", + "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 pull request", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "pull request has been merged" + }, + "404": { + "description": "pull request has not been merged" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Merge a pull request", + "operationId": "repoMergePullRequest", + "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 pull request to merge", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/MergePullRequestOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "405": { + "$ref": "#/responses/empty" + }, + "409": { + "$ref": "#/responses/error" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Cancel the scheduled auto merge for the given pull request", + "operationId": "repoCancelScheduledAutoMerge", + "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 pull request to merge", + "name": "index", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/requested_reviewers": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "create review requests for a pull request", + "operationId": "repoCreatePullReviewRequests", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PullReviewRequestOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/PullReviewList" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "cancel review requests for a pull request", + "operationId": "repoDeletePullReviewRequests", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PullReviewRequestOptions" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/reviews": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List all reviews for a pull request", + "operationId": "repoListPullReviews", + "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 pull request", + "name": "index", + "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/PullReviewList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a review to an pull request", + "operationId": "repoCreatePullReview", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreatePullReviewOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReview" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/reviews/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a specific review for a pull request", + "operationId": "repoGetPullReview", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReview" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Submit a pending review to an pull request", + "operationId": "repoSubmitPullReview", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SubmitPullReviewOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReview" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a specific review from a pull request", + "operationId": "repoDeletePullReview", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a specific review for a pull request", + "operationId": "repoGetPullReviewComments", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReviewCommentList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Add a new comment to a pull request review", + "operationId": "repoCreatePullReviewComment", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreatePullReviewCommentOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReviewComment" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/comments/{comment}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a pull review comment", + "operationId": "repoGetPullReviewComment", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the comment", + "name": "comment", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReviewComment" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a pull review comment", + "operationId": "repoDeletePullReviewComment", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the comment", + "name": "comment", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/dismissals": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Dismiss a review for a pull request", + "operationId": "repoDismissPullReview", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DismissPullReviewOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReview" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/reviews/{id}/undismissals": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Cancel to dismiss a review for a pull request", + "operationId": "repoUnDismissPullReview", + "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 pull request", + "name": "index", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the review", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PullReview" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/pulls/{index}/update": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Merge PR's baseBranch into headBranch", + "operationId": "repoUpdatePullRequest", + "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 pull request to get", + "name": "index", + "in": "path", + "required": true + }, + { + "enum": [ + "merge", + "rebase" + ], + "type": "string", + "description": "how to update pull request", + "name": "style", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/push_mirrors": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get all push mirrors of the repository", + "operationId": "repoListPushMirrors", + "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", + "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/PushMirrorList" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "add a push mirror to the repository", + "operationId": "repoAddPushMirror", + "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/CreatePushMirrorOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/PushMirror" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/push_mirrors-sync": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Sync all push mirrored repository", + "operationId": "repoPushMirrorSync", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to sync", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to sync", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/empty" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/push_mirrors/{name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get push mirror of the repository by remoteName", + "operationId": "repoGetPushMirrorByRemoteName", + "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": "remote name of push mirror", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PushMirror" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "deletes a push mirror from a repository by remoteName", + "operationId": "repoDeletePushMirror", + "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": "remote name of the pushMirror", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/raw/{filepath}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a file from a repository", + "operationId": "repoGetRawFile", + "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": "filepath of the file to get", + "name": "filepath", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the commit/branch/tag. Default the repository’s default branch (usually master)", + "name": "ref", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Returns raw file content." + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/releases": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repo's releases", + "operationId": "repoListReleases", + "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": "boolean", + "description": "filter (exclude / include) drafts, if you dont have repo write access none will show", + "name": "draft", + "in": "query" + }, + { + "type": "boolean", + "description": "filter (exclude / include) pre-releases", + "name": "pre-release", + "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/ReleaseList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a release", + "operationId": "repoCreateRelease", + "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/CreateReleaseOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Release" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/releases/latest": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Gets the most recent non-prerelease, non-draft release of a repository, sorted by created_at", + "operationId": "repoGetLatestRelease", + "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/Release" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/releases/tags/{tag}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a release by tag name", + "operationId": "repoGetReleaseByTag", + "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": "tag name of the release to get", + "name": "tag", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Release" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "repository" + ], + "summary": "Delete a release by tag name", + "operationId": "repoDeleteReleaseByTag", + "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": "tag name of the release to delete", + "name": "tag", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/releases/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a release", + "operationId": "repoGetRelease", + "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": "id of the release to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Release" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "repository" + ], + "summary": "Delete a release", + "operationId": "repoDeleteRelease", + "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": "id of the release to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Update a release", + "operationId": "repoEditRelease", + "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": "id of the release to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditReleaseOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Release" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/releases/{id}/assets": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List release's attachments", + "operationId": "repoListReleaseAttachments", + "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": "id of the release", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/AttachmentList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "multipart/form-data", + "application/octet-stream" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a release attachment", + "operationId": "repoCreateReleaseAttachment", + "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": "id of the release", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the attachment", + "name": "name", + "in": "query" + }, + { + "type": "file", + "description": "attachment to upload", + "name": "attachment", + "in": "formData" + } + ], + "responses": { + "201": { + "$ref": "#/responses/Attachment" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a release attachment", + "operationId": "repoGetReleaseAttachment", + "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": "id of the release", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to get", + "name": "attachment_id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Attachment" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a release attachment", + "operationId": "repoDeleteReleaseAttachment", + "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": "id of the release", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to delete", + "name": "attachment_id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Edit a release attachment", + "operationId": "repoEditReleaseAttachment", + "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": "id of the release", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "integer", + "format": "int64", + "description": "id of the attachment to edit", + "name": "attachment_id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditAttachmentOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Attachment" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/reviewers": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Return all users that can be requested to review in this repo", + "operationId": "repoGetReviewers", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/runners/registration-token": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a repository's actions runner registration token", + "operationId": "repoGetRunnerRegistrationToken", + "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}/signing-key.gpg": { + "get": { + "produces": [ + "text/plain" + ], + "tags": [ + "repository" + ], + "summary": "Get signing-key.gpg for given repository", + "operationId": "repoSigningKey", + "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": "GPG armored public key", + "schema": { + "type": "string" + } + } + } + } + }, + "/repos/{owner}/{repo}/stargazers": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repo's stargazers", + "operationId": "repoListStargazers", + "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", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/statuses/{sha}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a commit's statuses", + "operationId": "repoListStatuses", + "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": "sha of the commit", + "name": "sha", + "in": "path", + "required": true + }, + { + "enum": [ + "oldest", + "recentupdate", + "leastupdate", + "leastindex", + "highestindex" + ], + "type": "string", + "description": "type of sort", + "name": "sort", + "in": "query" + }, + { + "enum": [ + "pending", + "success", + "error", + "failure", + "warning" + ], + "type": "string", + "description": "type of state", + "name": "state", + "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/CommitStatusList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a commit status", + "operationId": "repoCreateStatus", + "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": "sha of the commit", + "name": "sha", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateStatusOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/CommitStatus" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/subscribers": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repo's watchers", + "operationId": "repoListSubscribers", + "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", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/subscription": { + "get": { + "tags": [ + "repository" + ], + "summary": "Check if the current user is watching a repo", + "operationId": "userCurrentCheckSubscription", + "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/WatchInfo" + }, + "404": { + "description": "User is not watching this repo or repo do not exist" + } + } + }, + "put": { + "tags": [ + "repository" + ], + "summary": "Watch a repo", + "operationId": "userCurrentPutSubscription", + "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/WatchInfo" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "repository" + ], + "summary": "Unwatch a repo", + "operationId": "userCurrentDeleteSubscription", + "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": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/tag_protections": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List tag protections for a repository", + "operationId": "repoListTagProtection", + "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/TagProtectionList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a tag protections for a repository", + "operationId": "repoCreateTagProtection", + "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/CreateTagProtectionOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/TagProtection" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/tag_protections/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a specific tag protection for the repository", + "operationId": "repoGetTagProtection", + "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", + "description": "id of the tag protect to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/TagProtection" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a specific tag protection for the repository", + "operationId": "repoDeleteTagProtection", + "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", + "description": "id of protected tag", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Edit a tag protections for a repository. Only fields that are set will be changed", + "operationId": "repoEditTagProtection", + "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", + "description": "id of protected tag", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditTagProtectionOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/TagProtection" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/tags": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's tags", + "operationId": "repoListTags", + "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", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "page size of results, default maximum page size is 50", + "name": "limit", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/TagList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a new git tag in a repository", + "operationId": "repoCreateTag", + "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/CreateTagOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Tag" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "405": { + "$ref": "#/responses/empty" + }, + "409": { + "$ref": "#/responses/conflict" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/tags/{tag}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get the tag of a repository by tag name", + "operationId": "repoGetTag", + "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": "name of tag", + "name": "tag", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Tag" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a repository's tag by name", + "operationId": "repoDeleteTag", + "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": "name of tag to delete", + "name": "tag", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "405": { + "$ref": "#/responses/empty" + }, + "409": { + "$ref": "#/responses/conflict" + }, + "422": { + "$ref": "#/responses/validationError" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/teams": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repository's teams", + "operationId": "repoListTeams", + "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/TeamList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/teams/{team}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Check if a team is assigned to a repository", + "operationId": "repoCheckTeam", + "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": "team name", + "name": "team", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Team" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "405": { + "$ref": "#/responses/error" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Add a team to a repository", + "operationId": "repoAddTeam", + "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": "team name", + "name": "team", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "405": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a team from a repository", + "operationId": "repoDeleteTeam", + "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": "team name", + "name": "team", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "405": { + "$ref": "#/responses/error" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/times": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a repo's tracked times", + "operationId": "repoTrackedTimes", + "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": "optional filter by user (available for issue managers)", + "name": "user", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show times updated after the given time. This is a timestamp in RFC 3339 format", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show times updated before the given time. This is a timestamp in RFC 3339 format", + "name": "before", + "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/TrackedTimeList" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/times/{user}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "List a user's tracked times in a repo", + "operationId": "userTrackedTimes", + "deprecated": true, + "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": "username of user", + "name": "user", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/TrackedTimeList" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/topics": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get list of topics that a repository has", + "operationId": "repoListTopics", + "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", + "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/TopicNames" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Replace list of topics for a repository", + "operationId": "repoUpdateTopics", + "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/RepoTopicOptions" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/invalidTopicsError" + } + } + } + }, + "/repos/{owner}/{repo}/topics/{topic}": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Add a topic to a repository", + "operationId": "repoAddTopic", + "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": "name of the topic to add", + "name": "topic", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/invalidTopicsError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Delete a topic from a repository", + "operationId": "repoDeleteTopic", + "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": "name of the topic to delete", + "name": "topic", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/invalidTopicsError" + } + } + } + }, + "/repos/{owner}/{repo}/transfer": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Transfer a repo ownership", + "operationId": "repoTransfer", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to transfer", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to transfer", + "name": "repo", + "in": "path", + "required": true + }, + { + "description": "Transfer Options", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/TransferRepoOption" + } + } + ], + "responses": { + "202": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repos/{owner}/{repo}/transfer/accept": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Accept a repo transfer", + "operationId": "acceptRepoTransfer", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to transfer", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to transfer", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "202": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/transfer/reject": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Reject a repo transfer", + "operationId": "rejectRepoTransfer", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to transfer", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to transfer", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/wiki/new": { + "post": { + "consumes": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a wiki page", + "operationId": "repoCreateWikiPage", + "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/CreateWikiPageOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/WikiPage" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/wiki/page/{pageName}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a wiki page", + "operationId": "repoGetWikiPage", + "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": "name of the page", + "name": "pageName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/WikiPage" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "repository" + ], + "summary": "Delete a wiki page", + "operationId": "repoDeleteWikiPage", + "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": "name of the page", + "name": "pageName", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Edit a wiki page", + "operationId": "repoEditWikiPage", + "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": "name of the page", + "name": "pageName", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateWikiPageOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/WikiPage" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "423": { + "$ref": "#/responses/repoArchivedError" + } + } + } + }, + "/repos/{owner}/{repo}/wiki/pages": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get all wiki pages", + "operationId": "repoGetWikiPages", + "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", + "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/WikiPageList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{owner}/{repo}/wiki/revisions/{pageName}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get revisions of a wiki page", + "operationId": "repoGetWikiPageRevisions", + "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": "name of the page", + "name": "pageName", + "in": "path", + "required": true + }, + { + "type": "integer", + "description": "page number of results to return (1-based)", + "name": "page", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/WikiCommitList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/repos/{template_owner}/{template_repo}/generate": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Create a repository using a template", + "operationId": "generateRepo", + "parameters": [ + { + "type": "string", + "description": "name of the template repository owner", + "name": "template_owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the template repository", + "name": "template_repo", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/GenerateRepoOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Repository" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "409": { + "description": "The repository with the same name already exists." + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/repositories/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "Get a repository by id", + "operationId": "repoGetByID", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the repo to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Repository" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/settings/api": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "settings" + ], + "summary": "Get instance's global settings for api", + "operationId": "getGeneralAPISettings", + "responses": { + "200": { + "$ref": "#/responses/GeneralAPISettings" + } + } + } + }, + "/settings/attachment": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "settings" + ], + "summary": "Get instance's global settings for Attachment", + "operationId": "getGeneralAttachmentSettings", + "responses": { + "200": { + "$ref": "#/responses/GeneralAttachmentSettings" + } + } + } + }, + "/settings/repository": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "settings" + ], + "summary": "Get instance's global settings for repositories", + "operationId": "getGeneralRepositorySettings", + "responses": { + "200": { + "$ref": "#/responses/GeneralRepoSettings" + } + } + } + }, + "/settings/ui": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "settings" + ], + "summary": "Get instance's global settings for ui", + "operationId": "getGeneralUISettings", + "responses": { + "200": { + "$ref": "#/responses/GeneralUISettings" + } + } + } + }, + "/signing-key.gpg": { + "get": { + "produces": [ + "text/plain" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Get default signing-key.gpg", + "operationId": "getSigningKey", + "responses": { + "200": { + "description": "GPG armored public key", + "schema": { + "type": "string" + } + } + } + } + }, + "/teams/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get a team", + "operationId": "orgGetTeam", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Team" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "organization" + ], + "summary": "Delete a team", + "operationId": "orgDeleteTeam", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "team deleted" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Edit a team", + "operationId": "orgEditTeam", + "parameters": [ + { + "type": "integer", + "description": "id of the team to edit", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditTeamOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Team" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/teams/{id}/activities/feeds": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List a team's activity feeds", + "operationId": "orgListTeamActivityFeeds", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "format": "date", + "description": "the date of the activities to be found", + "name": "date", + "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/ActivityFeedsList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/teams/{id}/members": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List a team's members", + "operationId": "orgListTeamMembers", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/teams/{id}/members/{username}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List a particular member of team", + "operationId": "orgListTeamMember", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the member to list", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/User" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Add a team member", + "operationId": "orgAddTeamMember", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user to add", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Remove a team member", + "operationId": "orgRemoveTeamMember", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of the user to remove", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/teams/{id}/repos": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List a team's repos", + "operationId": "orgListTeamRepos", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "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/RepositoryList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/teams/{id}/repos/{org}/{repo}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List a particular repo of team", + "operationId": "orgListTeamRepo", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "organization that owns the repo to list", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to list", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Repository" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Add a repository to a team", + "operationId": "orgAddTeamRepository", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "organization that owns the repo to add", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to add", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "description": "This does not delete the repository, it only removes the repository from the team.", + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Remove a repository from a team", + "operationId": "orgRemoveTeamRepository", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the team", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "organization that owns the repo to remove", + "name": "org", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to remove", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/topics/search": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "repository" + ], + "summary": "search topics via keyword", + "operationId": "topicSearch", + "parameters": [ + { + "type": "string", + "description": "keywords to search", + "name": "q", + "in": "query", + "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/TopicListResponse" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get the authenticated user", + "operationId": "userGetCurrent", + "responses": { + "200": { + "$ref": "#/responses/User" + } + } + } + }, + "/user/actions/runners/registration-token": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get an user's actions runner registration token", + "operationId": "userGetRunnerRegistrationToken", + "responses": { + "200": { + "$ref": "#/responses/RegistrationToken" + } + } + } + }, + "/user/actions/secrets/{secretname}": { + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create or Update a secret value in a user scope", + "operationId": "updateUserSecret", + "parameters": [ + { + "type": "string", + "description": "name of the secret", + "name": "secretname", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateOrUpdateSecretOption" + } + } + ], + "responses": { + "201": { + "description": "response when creating a secret" + }, + "204": { + "description": "response when updating a secret" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete a secret in a user scope", + "operationId": "deleteUserSecret", + "parameters": [ + { + "type": "string", + "description": "name of the secret", + "name": "secretname", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "delete one secret of the user" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/actions/variables": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get the user-level list of variables which is created by current doer", + "operationId": "getUserVariablesList", + "parameters": [ + { + "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/VariableList" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/actions/variables/{variablename}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get a user-level variable which is created by current doer", + "operationId": "getUserVariable", + "parameters": [ + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/ActionVariable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Update a user-level variable which is created by current doer", + "operationId": "updateUserVariable", + "parameters": [ + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateVariableOption" + } + } + ], + "responses": { + "201": { + "description": "response when updating a variable" + }, + "204": { + "description": "response when updating a variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create a user-level variable", + "operationId": "createUserVariable", + "parameters": [ + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateVariableOption" + } + } + ], + "responses": { + "201": { + "description": "response when creating a variable" + }, + "204": { + "description": "response when creating a variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete a user-level variable which is created by current doer", + "operationId": "deleteUserVariable", + "parameters": [ + { + "type": "string", + "description": "name of the variable", + "name": "variablename", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "response when deleting a variable" + }, + "204": { + "description": "response when deleting a variable" + }, + "400": { + "$ref": "#/responses/error" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/applications/oauth2": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's oauth2 applications", + "operationId": "userGetOAuth2Applications", + "parameters": [ + { + "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/OAuth2ApplicationList" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "creates a new OAuth2 application", + "operationId": "userCreateOAuth2Application", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOAuth2ApplicationOptions" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/OAuth2Application" + }, + "400": { + "$ref": "#/responses/error" + } + } + } + }, + "/user/applications/oauth2/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "get an OAuth2 Application", + "operationId": "userGetOAuth2Application", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "Application ID to be found", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/OAuth2Application" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "delete an OAuth2 Application", + "operationId": "userDeleteOAuth2Application", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "token to be deleted", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "patch": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "update an OAuth2 Application, this includes regenerating the client secret", + "operationId": "userUpdateOAuth2Application", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "application to be updated", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateOAuth2ApplicationOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/OAuth2Application" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/avatar": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Update Avatar", + "operationId": "userUpdateAvatar", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UpdateUserAvatarOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete Avatar", + "operationId": "userDeleteAvatar", + "responses": { + "204": { + "$ref": "#/responses/empty" + } + } + } + }, + "/user/block/{username}": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Blocks a user from the doer.", + "operationId": "userBlockUser", + "parameters": [ + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/user/emails": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's email addresses", + "operationId": "userListEmails", + "responses": { + "200": { + "$ref": "#/responses/EmailList" + } + } + }, + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Add email addresses", + "operationId": "userAddEmail", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateEmailOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/EmailList" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete email addresses", + "operationId": "userDeleteEmail", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/DeleteEmailOption" + } + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/followers": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's followers", + "operationId": "userCurrentListFollowers", + "parameters": [ + { + "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/UserList" + } + } + } + }, + "/user/following": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the users that the authenticated user is following", + "operationId": "userCurrentListFollowing", + "parameters": [ + { + "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/UserList" + } + } + } + }, + "/user/following/{username}": { + "get": { + "tags": [ + "user" + ], + "summary": "Check whether a user is followed by the authenticated user", + "operationId": "userCurrentCheckFollowing", + "parameters": [ + { + "type": "string", + "description": "username of followed user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "tags": [ + "user" + ], + "summary": "Follow a user", + "operationId": "userCurrentPutFollow", + "parameters": [ + { + "type": "string", + "description": "username of user to follow", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "user" + ], + "summary": "Unfollow a user", + "operationId": "userCurrentDeleteFollow", + "parameters": [ + { + "type": "string", + "description": "username of user to unfollow", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/gpg_key_token": { + "get": { + "produces": [ + "text/plain" + ], + "tags": [ + "user" + ], + "summary": "Get a Token to verify", + "operationId": "getVerificationToken", + "responses": { + "200": { + "$ref": "#/responses/string" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/gpg_key_verify": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Verify a GPG key", + "operationId": "userVerifyGPGKey", + "responses": { + "201": { + "$ref": "#/responses/GPGKey" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/user/gpg_keys": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's GPG keys", + "operationId": "userCurrentListGPGKeys", + "parameters": [ + { + "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/GPGKeyList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create a GPG key", + "operationId": "userCurrentPostGPGKey", + "parameters": [ + { + "name": "Form", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateGPGKeyOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/GPGKey" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/user/gpg_keys/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get a GPG key", + "operationId": "userCurrentGetGPGKey", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of key to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/GPGKey" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Remove a GPG key", + "operationId": "userCurrentDeleteGPGKey", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of key to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/hooks": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's webhooks", + "operationId": "userListHooks", + "parameters": [ + { + "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/HookList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create a hook", + "operationId": "userCreateHook", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateHookOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Hook" + } + } + } + }, + "/user/hooks/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get a hook", + "operationId": "userGetHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete a hook", + "operationId": "userDeleteHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + } + } + }, + "patch": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Update a hook", + "operationId": "userEditHook", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of the hook to update", + "name": "id", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/EditHookOption" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/Hook" + } + } + } + }, + "/user/keys": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's public keys", + "operationId": "userCurrentListKeys", + "parameters": [ + { + "type": "string", + "description": "fingerprint of the key", + "name": "fingerprint", + "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/PublicKeyList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create a public key", + "operationId": "userCurrentPostKey", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateKeyOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/PublicKey" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/user/keys/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get a public key", + "operationId": "userCurrentGetKey", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of key to get", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/PublicKey" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Delete a public key", + "operationId": "userCurrentDeleteKey", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "id of key to delete", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/list_blocked": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's blocked users", + "operationId": "userListBlockedUsers", + "parameters": [ + { + "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/BlockedUserList" + } + } + } + }, + "/user/orgs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List the current user's organizations", + "operationId": "orgListCurrentUserOrgs", + "parameters": [ + { + "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/OrganizationList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/repos": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the repos that the authenticated user owns", + "operationId": "userCurrentListRepos", + "parameters": [ + { + "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/RepositoryList" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "repository", + "user" + ], + "summary": "Create a repository", + "operationId": "createCurrentUserRepo", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateRepoOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/Repository" + }, + "400": { + "$ref": "#/responses/error" + }, + "409": { + "description": "The repository with the same name already exists." + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/user/settings": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get user settings", + "operationId": "getUserSettings", + "responses": { + "200": { + "$ref": "#/responses/UserSettings" + } + } + }, + "patch": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Update user settings", + "operationId": "updateUserSettings", + "parameters": [ + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/UserSettingsOptions" + } + } + ], + "responses": { + "200": { + "$ref": "#/responses/UserSettings" + } + } + } + }, + "/user/starred": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "The repos that the authenticated user has starred", + "operationId": "userCurrentListStarred", + "parameters": [ + { + "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/RepositoryList" + } + } + } + }, + "/user/starred/{owner}/{repo}": { + "get": { + "tags": [ + "user" + ], + "summary": "Whether the authenticated is starring the repo", + "operationId": "userCurrentCheckStarring", + "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": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "put": { + "tags": [ + "user" + ], + "summary": "Star the given repo", + "operationId": "userCurrentPutStar", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to star", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to star", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + }, + "delete": { + "tags": [ + "user" + ], + "summary": "Unstar the given repo", + "operationId": "userCurrentDeleteStar", + "parameters": [ + { + "type": "string", + "description": "owner of the repo to unstar", + "name": "owner", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the repo to unstar", + "name": "repo", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/user/stopwatches": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get list of all existing stopwatches", + "operationId": "userGetStopWatches", + "parameters": [ + { + "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/StopWatchList" + } + } + } + }, + "/user/subscriptions": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List repositories watched by the authenticated user", + "operationId": "userCurrentListSubscriptions", + "parameters": [ + { + "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/RepositoryList" + } + } + } + }, + "/user/teams": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List all the teams a user belongs to", + "operationId": "userListTeams", + "parameters": [ + { + "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/TeamList" + } + } + } + }, + "/user/times": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the current user's tracked times", + "operationId": "userCurrentTrackedTimes", + "parameters": [ + { + "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" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show times updated after the given time. This is a timestamp in RFC 3339 format", + "name": "since", + "in": "query" + }, + { + "type": "string", + "format": "date-time", + "description": "Only show times updated before the given time. This is a timestamp in RFC 3339 format", + "name": "before", + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/responses/TrackedTimeList" + } + } + } + }, + "/user/unblock/{username}": { + "put": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Unblocks a user from the doer.", + "operationId": "userUnblockUser", + "parameters": [ + { + "type": "string", + "description": "username of the user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/validationError" + } + } + } + }, + "/users/search": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Search for users", + "operationId": "userSearch", + "parameters": [ + { + "type": "string", + "description": "keyword", + "name": "q", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "description": "ID of the user to search for", + "name": "uid", + "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": { + "description": "SearchResults of a successful search", + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/User" + } + }, + "ok": { + "type": "boolean" + } + } + } + } + } + } + }, + "/users/{username}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get a user", + "operationId": "userGet", + "parameters": [ + { + "type": "string", + "description": "username of user to get", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/User" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/activities/feeds": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List a user's activity feeds", + "operationId": "userListActivityFeeds", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "type": "boolean", + "description": "if true, only show actions performed by the requested user", + "name": "only-performed-by", + "in": "query" + }, + { + "type": "string", + "format": "date", + "description": "the date of the activities to be found", + "name": "date", + "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/ActivityFeedsList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/followers": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the given user's followers", + "operationId": "userListFollowers", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/following": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the users that the given user is following", + "operationId": "userListFollowing", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "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/UserList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/following/{target}": { + "get": { + "tags": [ + "user" + ], + "summary": "Check if one user is following another user", + "operationId": "userCheckFollowing", + "parameters": [ + { + "type": "string", + "description": "username of following user", + "name": "username", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "username of followed user", + "name": "target", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/gpg_keys": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the given user's GPG keys", + "operationId": "userListGPGKeys", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "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/GPGKeyList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/heatmap": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Get a user's heatmap", + "operationId": "userGetHeatmapData", + "parameters": [ + { + "type": "string", + "description": "username of user to get", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/UserHeatmapData" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/keys": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the given user's public keys", + "operationId": "userListKeys", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "fingerprint of the key", + "name": "fingerprint", + "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/PublicKeyList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/orgs": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "List a user's organizations", + "operationId": "orgListUserOrgs", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "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/OrganizationList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/orgs/{org}/permissions": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "organization" + ], + "summary": "Get user permissions in organization", + "operationId": "orgGetUserPermissions", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "name of the organization", + "name": "org", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/OrganizationPermissions" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/repos": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the repos owned by the given user", + "operationId": "userListRepos", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "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/RepositoryList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/starred": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "The repos that the given user has starred", + "operationId": "userListStarred", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "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/RepositoryList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/subscriptions": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the repositories watched by a user", + "operationId": "userListSubscriptions", + "parameters": [ + { + "type": "string", + "description": "username of the user", + "name": "username", + "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/RepositoryList" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, + "/users/{username}/tokens": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "List the authenticated user's access tokens", + "operationId": "userGetTokens", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "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/AccessTokenList" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + }, + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Create an access token", + "operationId": "userCreateToken", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/CreateAccessTokenOption" + } + } + ], + "responses": { + "201": { + "$ref": "#/responses/AccessToken" + }, + "400": { + "$ref": "#/responses/error" + }, + "403": { + "$ref": "#/responses/forbidden" + } + } + } + }, + "/users/{username}/tokens/{token}": { + "delete": { + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "delete an access token", + "operationId": "userDeleteAccessToken", + "parameters": [ + { + "type": "string", + "description": "username of user", + "name": "username", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "token to be deleted, identified by ID and if not available by name", + "name": "token", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "$ref": "#/responses/empty" + }, + "403": { + "$ref": "#/responses/forbidden" + }, + "404": { + "$ref": "#/responses/notFound" + }, + "422": { + "$ref": "#/responses/error" + } + } + } + }, + "/version": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns the version of the Gitea application", + "operationId": "getVersion", + "responses": { + "200": { + "$ref": "#/responses/ServerVersion" + } + } + } + } + }, + "definitions": { + "APIError": { + "description": "APIError is an api error with a message", + "type": "object", + "properties": { + "message": { + "type": "string", + "x-go-name": "Message" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "AccessToken": { + "type": "object", + "title": "AccessToken represents an API access token.", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Scopes" + }, + "sha1": { + "type": "string", + "x-go-name": "Token" + }, + "token_last_eight": { + "type": "string", + "x-go-name": "TokenLastEight" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionTask": { + "description": "ActionTask represents a ActionTask", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "display_title": { + "type": "string", + "x-go-name": "DisplayTitle" + }, + "event": { + "type": "string", + "x-go-name": "Event" + }, + "head_branch": { + "type": "string", + "x-go-name": "HeadBranch" + }, + "head_sha": { + "type": "string", + "x-go-name": "HeadSHA" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "run_number": { + "type": "integer", + "format": "int64", + "x-go-name": "RunNumber" + }, + "run_started_at": { + "type": "string", + "format": "date-time", + "x-go-name": "RunStartedAt" + }, + "status": { + "type": "string", + "x-go-name": "Status" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "UpdatedAt" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "workflow_id": { + "type": "string", + "x-go-name": "WorkflowID" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionTaskResponse": { + "description": "ActionTaskResponse returns a ActionTask", + "type": "object", + "properties": { + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + }, + "workflow_runs": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionTask" + }, + "x-go-name": "Entries" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActionVariable": { + "description": "ActionVariable return value of the query API", + "type": "object", + "properties": { + "data": { + "description": "the value of the variable", + "type": "string", + "x-go-name": "Data" + }, + "name": { + "description": "the name of the variable", + "type": "string", + "x-go-name": "Name" + }, + "owner_id": { + "description": "the owner to which the variable belongs", + "type": "integer", + "format": "int64", + "x-go-name": "OwnerID" + }, + "repo_id": { + "description": "the repository to which the variable belongs", + "type": "integer", + "format": "int64", + "x-go-name": "RepoID" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Activity": { + "type": "object", + "properties": { + "act_user": { + "$ref": "#/definitions/User" + }, + "act_user_id": { + "type": "integer", + "format": "int64", + "x-go-name": "ActUserID" + }, + "comment": { + "$ref": "#/definitions/Comment" + }, + "comment_id": { + "type": "integer", + "format": "int64", + "x-go-name": "CommentID" + }, + "content": { + "type": "string", + "x-go-name": "Content" + }, + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "is_private": { + "type": "boolean", + "x-go-name": "IsPrivate" + }, + "op_type": { + "description": "the type of action", + "type": "string", + "enum": [ + "create_repo", + "rename_repo", + "star_repo", + "watch_repo", + "commit_repo", + "create_issue", + "create_pull_request", + "transfer_repo", + "push_tag", + "comment_issue", + "merge_pull_request", + "close_issue", + "reopen_issue", + "close_pull_request", + "reopen_pull_request", + "delete_tag", + "delete_branch", + "mirror_sync_push", + "mirror_sync_create", + "mirror_sync_delete", + "approve_pull_request", + "reject_pull_request", + "comment_pull", + "publish_release", + "pull_review_dismissed", + "pull_request_ready_for_review", + "auto_merge_pull_request" + ], + "x-go-name": "OpType" + }, + "ref_name": { + "type": "string", + "x-go-name": "RefName" + }, + "repo": { + "$ref": "#/definitions/Repository" + }, + "repo_id": { + "type": "integer", + "format": "int64", + "x-go-name": "RepoID" + }, + "user_id": { + "type": "integer", + "format": "int64", + "x-go-name": "UserID" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ActivityPub": { + "description": "ActivityPub type", + "type": "object", + "properties": { + "@context": { + "type": "string", + "x-go-name": "Context" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "AddCollaboratorOption": { + "description": "AddCollaboratorOption options when adding a user as a collaborator of a repository", + "type": "object", + "properties": { + "permission": { + "type": "string", + "x-go-name": "Permission" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "AddTimeOption": { + "description": "AddTimeOption options for adding time to an issue", + "type": "object", + "required": [ + "time" + ], + "properties": { + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "time": { + "description": "time in seconds", + "type": "integer", + "format": "int64", + "x-go-name": "Time" + }, + "user_name": { + "description": "User who spent the time (optional)", + "type": "string", + "x-go-name": "User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "AnnotatedTag": { + "description": "AnnotatedTag represents an annotated tag", + "type": "object", + "properties": { + "archive_download_count": { + "$ref": "#/definitions/TagArchiveDownloadCount" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "object": { + "$ref": "#/definitions/AnnotatedTagObject" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "tag": { + "type": "string", + "x-go-name": "Tag" + }, + "tagger": { + "$ref": "#/definitions/CommitUser" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "verification": { + "$ref": "#/definitions/PayloadCommitVerification" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "AnnotatedTagObject": { + "description": "AnnotatedTagObject contains meta information of the tag object", + "type": "object", + "properties": { + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "type": { + "type": "string", + "x-go-name": "Type" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Attachment": { + "description": "Attachment a generic attachment", + "type": "object", + "properties": { + "browser_download_url": { + "type": "string", + "x-go-name": "DownloadURL" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "download_count": { + "type": "integer", + "format": "int64", + "x-go-name": "DownloadCount" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "size": { + "type": "integer", + "format": "int64", + "x-go-name": "Size" + }, + "uuid": { + "type": "string", + "x-go-name": "UUID" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "BlockedUser": { + "type": "object", + "title": "BlockedUser represents a blocked user.", + "properties": { + "block_id": { + "type": "integer", + "format": "int64", + "x-go-name": "BlockID" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Branch": { + "description": "Branch represents a repository branch", + "type": "object", + "properties": { + "commit": { + "$ref": "#/definitions/PayloadCommit" + }, + "effective_branch_protection_name": { + "type": "string", + "x-go-name": "EffectiveBranchProtectionName" + }, + "enable_status_check": { + "type": "boolean", + "x-go-name": "EnableStatusCheck" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "protected": { + "type": "boolean", + "x-go-name": "Protected" + }, + "required_approvals": { + "type": "integer", + "format": "int64", + "x-go-name": "RequiredApprovals" + }, + "status_check_contexts": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "StatusCheckContexts" + }, + "user_can_merge": { + "type": "boolean", + "x-go-name": "UserCanMerge" + }, + "user_can_push": { + "type": "boolean", + "x-go-name": "UserCanPush" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "BranchProtection": { + "description": "BranchProtection represents a branch protection for a repository", + "type": "object", + "properties": { + "apply_to_admins": { + "type": "boolean", + "x-go-name": "ApplyToAdmins" + }, + "approvals_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "ApprovalsWhitelistTeams" + }, + "approvals_whitelist_username": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "ApprovalsWhitelistUsernames" + }, + "block_on_official_review_requests": { + "type": "boolean", + "x-go-name": "BlockOnOfficialReviewRequests" + }, + "block_on_outdated_branch": { + "type": "boolean", + "x-go-name": "BlockOnOutdatedBranch" + }, + "block_on_rejected_reviews": { + "type": "boolean", + "x-go-name": "BlockOnRejectedReviews" + }, + "branch_name": { + "description": "Deprecated: true", + "type": "string", + "x-go-name": "BranchName" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "dismiss_stale_approvals": { + "type": "boolean", + "x-go-name": "DismissStaleApprovals" + }, + "enable_approvals_whitelist": { + "type": "boolean", + "x-go-name": "EnableApprovalsWhitelist" + }, + "enable_merge_whitelist": { + "type": "boolean", + "x-go-name": "EnableMergeWhitelist" + }, + "enable_push": { + "type": "boolean", + "x-go-name": "EnablePush" + }, + "enable_push_whitelist": { + "type": "boolean", + "x-go-name": "EnablePushWhitelist" + }, + "enable_status_check": { + "type": "boolean", + "x-go-name": "EnableStatusCheck" + }, + "ignore_stale_approvals": { + "type": "boolean", + "x-go-name": "IgnoreStaleApprovals" + }, + "merge_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "MergeWhitelistTeams" + }, + "merge_whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "MergeWhitelistUsernames" + }, + "protected_file_patterns": { + "type": "string", + "x-go-name": "ProtectedFilePatterns" + }, + "push_whitelist_deploy_keys": { + "type": "boolean", + "x-go-name": "PushWhitelistDeployKeys" + }, + "push_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "PushWhitelistTeams" + }, + "push_whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "PushWhitelistUsernames" + }, + "require_signed_commits": { + "type": "boolean", + "x-go-name": "RequireSignedCommits" + }, + "required_approvals": { + "type": "integer", + "format": "int64", + "x-go-name": "RequiredApprovals" + }, + "rule_name": { + "type": "string", + "x-go-name": "RuleName" + }, + "status_check_contexts": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "StatusCheckContexts" + }, + "unprotected_file_patterns": { + "type": "string", + "x-go-name": "UnprotectedFilePatterns" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ChangeFileOperation": { + "description": "ChangeFileOperation for creating, updating or deleting a file", + "type": "object", + "required": [ + "operation", + "path" + ], + "properties": { + "content": { + "description": "new or updated file content, must be base64 encoded", + "type": "string", + "x-go-name": "ContentBase64" + }, + "from_path": { + "description": "old path of the file to move", + "type": "string", + "x-go-name": "FromPath" + }, + "operation": { + "description": "indicates what to do with the file", + "type": "string", + "enum": [ + "create", + "update", + "delete" + ], + "x-go-name": "Operation" + }, + "path": { + "description": "path to the existing or new file", + "type": "string", + "x-go-name": "Path" + }, + "sha": { + "description": "sha is the SHA for the file that already exists, required for update or delete", + "type": "string", + "x-go-name": "SHA" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ChangeFilesOptions": { + "description": "ChangeFilesOptions options for creating, updating or deleting multiple files\nNote: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)", + "type": "object", + "required": [ + "files" + ], + "properties": { + "author": { + "$ref": "#/definitions/Identity" + }, + "branch": { + "description": "branch (optional) to base this file from. if not given, the default branch is used", + "type": "string", + "x-go-name": "BranchName" + }, + "committer": { + "$ref": "#/definitions/Identity" + }, + "dates": { + "$ref": "#/definitions/CommitDateOptions" + }, + "files": { + "description": "list of file operations", + "type": "array", + "items": { + "$ref": "#/definitions/ChangeFileOperation" + }, + "x-go-name": "Files" + }, + "message": { + "description": "message (optional) for the commit of this file. if not supplied, a default message will be used", + "type": "string", + "x-go-name": "Message" + }, + "new_branch": { + "description": "new_branch (optional) will make a new branch from `branch` before creating the file", + "type": "string", + "x-go-name": "NewBranchName" + }, + "signoff": { + "description": "Add a Signed-off-by trailer by the committer at the end of the commit log message.", + "type": "boolean", + "x-go-name": "Signoff" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ChangedFile": { + "description": "ChangedFile store information about files affected by the pull request", + "type": "object", + "properties": { + "additions": { + "type": "integer", + "format": "int64", + "x-go-name": "Additions" + }, + "changes": { + "type": "integer", + "format": "int64", + "x-go-name": "Changes" + }, + "contents_url": { + "type": "string", + "x-go-name": "ContentsURL" + }, + "deletions": { + "type": "integer", + "format": "int64", + "x-go-name": "Deletions" + }, + "filename": { + "type": "string", + "x-go-name": "Filename" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "previous_filename": { + "type": "string", + "x-go-name": "PreviousFilename" + }, + "raw_url": { + "type": "string", + "x-go-name": "RawURL" + }, + "status": { + "type": "string", + "x-go-name": "Status" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CombinedStatus": { + "description": "CombinedStatus holds the combined state of several statuses for a single commit", + "type": "object", + "properties": { + "commit_url": { + "type": "string", + "x-go-name": "CommitURL" + }, + "repository": { + "$ref": "#/definitions/Repository" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "state": { + "$ref": "#/definitions/CommitStatusState" + }, + "statuses": { + "type": "array", + "items": { + "$ref": "#/definitions/CommitStatus" + }, + "x-go-name": "Statuses" + }, + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Comment": { + "description": "Comment represents a comment on a commit or issue", + "type": "object", + "properties": { + "assets": { + "type": "array", + "items": { + "$ref": "#/definitions/Attachment" + }, + "x-go-name": "Attachments" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "issue_url": { + "type": "string", + "x-go-name": "IssueURL" + }, + "original_author": { + "type": "string", + "x-go-name": "OriginalAuthor" + }, + "original_author_id": { + "type": "integer", + "format": "int64", + "x-go-name": "OriginalAuthorID" + }, + "pull_request_url": { + "type": "string", + "x-go-name": "PRURL" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Commit": { + "type": "object", + "title": "Commit contains information generated from a Git commit.", + "properties": { + "author": { + "$ref": "#/definitions/User" + }, + "commit": { + "$ref": "#/definitions/RepoCommit" + }, + "committer": { + "$ref": "#/definitions/User" + }, + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/definitions/CommitAffectedFiles" + }, + "x-go-name": "Files" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "parents": { + "type": "array", + "items": { + "$ref": "#/definitions/CommitMeta" + }, + "x-go-name": "Parents" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "stats": { + "$ref": "#/definitions/CommitStats" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CommitAffectedFiles": { + "description": "CommitAffectedFiles store information about files affected by the commit", + "type": "object", + "properties": { + "filename": { + "type": "string", + "x-go-name": "Filename" + }, + "status": { + "type": "string", + "x-go-name": "Status" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CommitDateOptions": { + "description": "CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE", + "type": "object", + "properties": { + "author": { + "type": "string", + "format": "date-time", + "x-go-name": "Author" + }, + "committer": { + "type": "string", + "format": "date-time", + "x-go-name": "Committer" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CommitMeta": { + "type": "object", + "title": "CommitMeta contains meta information of a commit in terms of API.", + "properties": { + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CommitStats": { + "description": "CommitStats is statistics for a RepoCommit", + "type": "object", + "properties": { + "additions": { + "type": "integer", + "format": "int64", + "x-go-name": "Additions" + }, + "deletions": { + "type": "integer", + "format": "int64", + "x-go-name": "Deletions" + }, + "total": { + "type": "integer", + "format": "int64", + "x-go-name": "Total" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CommitStatus": { + "description": "CommitStatus holds a single status of a single Commit", + "type": "object", + "properties": { + "context": { + "type": "string", + "x-go-name": "Context" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "creator": { + "$ref": "#/definitions/User" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "status": { + "$ref": "#/definitions/CommitStatusState" + }, + "target_url": { + "type": "string", + "x-go-name": "TargetURL" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "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.", + "properties": { + "date": { + "type": "string", + "x-go-name": "Date" + }, + "email": { + "type": "string", + "format": "email", + "x-go-name": "Email" + }, + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Compare": { + "type": "object", + "title": "Compare represents a comparison between two commits.", + "properties": { + "commits": { + "type": "array", + "items": { + "$ref": "#/definitions/Commit" + }, + "x-go-name": "Commits" + }, + "total_commits": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCommits" + } + }, + "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", + "properties": { + "_links": { + "$ref": "#/definitions/FileLinksResponse" + }, + "content": { + "description": "`content` is populated when `type` is `file`, otherwise null", + "type": "string", + "x-go-name": "Content" + }, + "download_url": { + "type": "string", + "x-go-name": "DownloadURL" + }, + "encoding": { + "description": "`encoding` is populated when `type` is `file`, otherwise null", + "type": "string", + "x-go-name": "Encoding" + }, + "git_url": { + "type": "string", + "x-go-name": "GitURL" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "last_commit_sha": { + "type": "string", + "x-go-name": "LastCommitSHA" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "path": { + "type": "string", + "x-go-name": "Path" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "size": { + "type": "integer", + "format": "int64", + "x-go-name": "Size" + }, + "submodule_git_url": { + "description": "`submodule_git_url` is populated when `type` is `submodule`, otherwise null", + "type": "string", + "x-go-name": "SubmoduleGitURL" + }, + "target": { + "description": "`target` is populated when `type` is `symlink`, otherwise null", + "type": "string", + "x-go-name": "Target" + }, + "type": { + "description": "`type` will be `file`, `dir`, `symlink`, or `submodule`", + "type": "string", + "x-go-name": "Type" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateAccessTokenOption": { + "description": "CreateAccessTokenOption options when create access token", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "x-go-name": "Name" + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Scopes" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateBranchProtectionOption": { + "description": "CreateBranchProtectionOption options for creating a branch protection", + "type": "object", + "properties": { + "apply_to_admins": { + "type": "boolean", + "x-go-name": "ApplyToAdmins" + }, + "approvals_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "ApprovalsWhitelistTeams" + }, + "approvals_whitelist_username": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "ApprovalsWhitelistUsernames" + }, + "block_on_official_review_requests": { + "type": "boolean", + "x-go-name": "BlockOnOfficialReviewRequests" + }, + "block_on_outdated_branch": { + "type": "boolean", + "x-go-name": "BlockOnOutdatedBranch" + }, + "block_on_rejected_reviews": { + "type": "boolean", + "x-go-name": "BlockOnRejectedReviews" + }, + "branch_name": { + "description": "Deprecated: true", + "type": "string", + "x-go-name": "BranchName" + }, + "dismiss_stale_approvals": { + "type": "boolean", + "x-go-name": "DismissStaleApprovals" + }, + "enable_approvals_whitelist": { + "type": "boolean", + "x-go-name": "EnableApprovalsWhitelist" + }, + "enable_merge_whitelist": { + "type": "boolean", + "x-go-name": "EnableMergeWhitelist" + }, + "enable_push": { + "type": "boolean", + "x-go-name": "EnablePush" + }, + "enable_push_whitelist": { + "type": "boolean", + "x-go-name": "EnablePushWhitelist" + }, + "enable_status_check": { + "type": "boolean", + "x-go-name": "EnableStatusCheck" + }, + "ignore_stale_approvals": { + "type": "boolean", + "x-go-name": "IgnoreStaleApprovals" + }, + "merge_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "MergeWhitelistTeams" + }, + "merge_whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "MergeWhitelistUsernames" + }, + "protected_file_patterns": { + "type": "string", + "x-go-name": "ProtectedFilePatterns" + }, + "push_whitelist_deploy_keys": { + "type": "boolean", + "x-go-name": "PushWhitelistDeployKeys" + }, + "push_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "PushWhitelistTeams" + }, + "push_whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "PushWhitelistUsernames" + }, + "require_signed_commits": { + "type": "boolean", + "x-go-name": "RequireSignedCommits" + }, + "required_approvals": { + "type": "integer", + "format": "int64", + "x-go-name": "RequiredApprovals" + }, + "rule_name": { + "type": "string", + "x-go-name": "RuleName" + }, + "status_check_contexts": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "StatusCheckContexts" + }, + "unprotected_file_patterns": { + "type": "string", + "x-go-name": "UnprotectedFilePatterns" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateBranchRepoOption": { + "description": "CreateBranchRepoOption options when creating a branch in a repository", + "type": "object", + "required": [ + "new_branch_name" + ], + "properties": { + "new_branch_name": { + "description": "Name of the branch to create", + "type": "string", + "uniqueItems": true, + "x-go-name": "BranchName" + }, + "old_branch_name": { + "description": "Deprecated: true\nName of the old branch to create from", + "type": "string", + "uniqueItems": true, + "x-go-name": "OldBranchName" + }, + "old_ref_name": { + "description": "Name of the old branch/tag/commit to create from", + "type": "string", + "uniqueItems": true, + "x-go-name": "OldRefName" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateEmailOption": { + "description": "CreateEmailOption options when creating email addresses", + "type": "object", + "properties": { + "emails": { + "description": "email addresses to add", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Emails" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateFileOptions": { + "description": "CreateFileOptions options for creating files\nNote: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)", + "type": "object", + "required": [ + "content" + ], + "properties": { + "author": { + "$ref": "#/definitions/Identity" + }, + "branch": { + "description": "branch (optional) to base this file from. if not given, the default branch is used", + "type": "string", + "x-go-name": "BranchName" + }, + "committer": { + "$ref": "#/definitions/Identity" + }, + "content": { + "description": "content must be base64 encoded", + "type": "string", + "x-go-name": "ContentBase64" + }, + "dates": { + "$ref": "#/definitions/CommitDateOptions" + }, + "message": { + "description": "message (optional) for the commit of this file. if not supplied, a default message will be used", + "type": "string", + "x-go-name": "Message" + }, + "new_branch": { + "description": "new_branch (optional) will make a new branch from `branch` before creating the file", + "type": "string", + "x-go-name": "NewBranchName" + }, + "signoff": { + "description": "Add a Signed-off-by trailer by the committer at the end of the commit log message.", + "type": "boolean", + "x-go-name": "Signoff" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateForkOption": { + "description": "CreateForkOption options for creating a fork", + "type": "object", + "properties": { + "name": { + "description": "name of the forked repository", + "type": "string", + "x-go-name": "Name" + }, + "organization": { + "description": "organization name, if forking into an organization", + "type": "string", + "x-go-name": "Organization" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateGPGKeyOption": { + "description": "CreateGPGKeyOption options create user GPG key", + "type": "object", + "required": [ + "armored_public_key" + ], + "properties": { + "armored_public_key": { + "description": "An armored GPG key to add", + "type": "string", + "uniqueItems": true, + "x-go-name": "ArmoredKey" + }, + "armored_signature": { + "type": "string", + "x-go-name": "Signature" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateHookOption": { + "description": "CreateHookOption options when create a hook", + "type": "object", + "required": [ + "type", + "config" + ], + "properties": { + "active": { + "type": "boolean", + "default": false, + "x-go-name": "Active" + }, + "authorization_header": { + "type": "string", + "x-go-name": "AuthorizationHeader" + }, + "branch_filter": { + "type": "string", + "x-go-name": "BranchFilter" + }, + "config": { + "$ref": "#/definitions/CreateHookOptionConfig" + }, + "events": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Events" + }, + "type": { + "type": "string", + "enum": [ + "forgejo", + "dingtalk", + "discord", + "gitea", + "gogs", + "msteams", + "slack", + "telegram", + "feishu", + "wechatwork", + "packagist" + ], + "x-go-name": "Type" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateHookOptionConfig": { + "description": "CreateHookOptionConfig has all config options in it\nrequired are \"content_type\" and \"url\" Required", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateIssueCommentOption": { + "description": "CreateIssueCommentOption options for creating a comment on an issue", + "type": "object", + "required": [ + "body" + ], + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateIssueOption": { + "description": "CreateIssueOption options to create one issue", + "type": "object", + "required": [ + "title" + ], + "properties": { + "assignee": { + "description": "deprecated", + "type": "string", + "x-go-name": "Assignee" + }, + "assignees": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Assignees" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "closed": { + "type": "boolean", + "x-go-name": "Closed" + }, + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "labels": { + "description": "list of label ids", + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "x-go-name": "Labels" + }, + "milestone": { + "description": "milestone id", + "type": "integer", + "format": "int64", + "x-go-name": "Milestone" + }, + "ref": { + "type": "string", + "x-go-name": "Ref" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateKeyOption": { + "description": "CreateKeyOption options when creating a key", + "type": "object", + "required": [ + "title", + "key" + ], + "properties": { + "key": { + "description": "An armored SSH key to add", + "type": "string", + "uniqueItems": true, + "x-go-name": "Key" + }, + "read_only": { + "description": "Describe if the key has only read access or read/write", + "type": "boolean", + "x-go-name": "ReadOnly" + }, + "title": { + "description": "Title of the key to add", + "type": "string", + "uniqueItems": true, + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateLabelOption": { + "description": "CreateLabelOption options for creating a label", + "type": "object", + "required": [ + "name", + "color" + ], + "properties": { + "color": { + "type": "string", + "x-go-name": "Color", + "example": "#00aabb" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "exclusive": { + "type": "boolean", + "x-go-name": "Exclusive", + "example": false + }, + "is_archived": { + "type": "boolean", + "x-go-name": "IsArchived", + "example": false + }, + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateMilestoneOption": { + "description": "CreateMilestoneOption options for creating a milestone", + "type": "object", + "properties": { + "description": { + "type": "string", + "x-go-name": "Description" + }, + "due_on": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "state": { + "type": "string", + "enum": [ + "open", + "closed" + ], + "x-go-name": "State" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateOAuth2ApplicationOptions": { + "description": "CreateOAuth2ApplicationOptions holds options to create an oauth2 application", + "type": "object", + "properties": { + "confidential_client": { + "type": "boolean", + "x-go-name": "ConfidentialClient" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "redirect_uris": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "RedirectURIs" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateOrUpdateSecretOption": { + "description": "CreateOrUpdateSecretOption options when creating or updating secret", + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "description": "Data of the secret to update", + "type": "string", + "x-go-name": "Data" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateOrgOption": { + "description": "CreateOrgOption options for creating an organization", + "type": "object", + "required": [ + "username" + ], + "properties": { + "description": { + "type": "string", + "x-go-name": "Description" + }, + "email": { + "type": "string", + "x-go-name": "Email" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "location": { + "type": "string", + "x-go-name": "Location" + }, + "repo_admin_change_team_access": { + "type": "boolean", + "x-go-name": "RepoAdminChangeTeamAccess" + }, + "username": { + "type": "string", + "x-go-name": "UserName" + }, + "visibility": { + "description": "possible values are `public` (default), `limited` or `private`", + "type": "string", + "enum": [ + "public", + "limited", + "private" + ], + "x-go-name": "Visibility" + }, + "website": { + "type": "string", + "x-go-name": "Website" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreatePullRequestOption": { + "description": "CreatePullRequestOption options when creating a pull request", + "type": "object", + "properties": { + "assignee": { + "type": "string", + "x-go-name": "Assignee" + }, + "assignees": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Assignees" + }, + "base": { + "type": "string", + "x-go-name": "Base" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "head": { + "type": "string", + "x-go-name": "Head" + }, + "labels": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "x-go-name": "Labels" + }, + "milestone": { + "type": "integer", + "format": "int64", + "x-go-name": "Milestone" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreatePullReviewComment": { + "description": "CreatePullReviewComment represent a review comment for creation api", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "new_position": { + "description": "if comment to new file line or 0", + "type": "integer", + "format": "int64", + "x-go-name": "NewLineNum" + }, + "old_position": { + "description": "if comment to old file line or 0", + "type": "integer", + "format": "int64", + "x-go-name": "OldLineNum" + }, + "path": { + "description": "the tree path", + "type": "string", + "x-go-name": "Path" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreatePullReviewCommentOptions": { + "description": "CreatePullReviewCommentOptions are options to create a pull review comment", + "$ref": "#/definitions/CreatePullReviewComment" + }, + "CreatePullReviewOptions": { + "description": "CreatePullReviewOptions are options to create a pull review", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "comments": { + "type": "array", + "items": { + "$ref": "#/definitions/CreatePullReviewComment" + }, + "x-go-name": "Comments" + }, + "commit_id": { + "type": "string", + "x-go-name": "CommitID" + }, + "event": { + "$ref": "#/definitions/ReviewStateType" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreatePushMirrorOption": { + "type": "object", + "title": "CreatePushMirrorOption represents need information to create a push mirror of a repository.", + "properties": { + "interval": { + "type": "string", + "x-go-name": "Interval" + }, + "remote_address": { + "type": "string", + "x-go-name": "RemoteAddress" + }, + "remote_password": { + "type": "string", + "x-go-name": "RemotePassword" + }, + "remote_username": { + "type": "string", + "x-go-name": "RemoteUsername" + }, + "sync_on_commit": { + "type": "boolean", + "x-go-name": "SyncOnCommit" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateReleaseOption": { + "description": "CreateReleaseOption options when creating a release", + "type": "object", + "required": [ + "tag_name" + ], + "properties": { + "body": { + "type": "string", + "x-go-name": "Note" + }, + "draft": { + "type": "boolean", + "x-go-name": "IsDraft" + }, + "hide_archive_links": { + "type": "boolean", + "x-go-name": "HideArchiveLinks" + }, + "name": { + "type": "string", + "x-go-name": "Title" + }, + "prerelease": { + "type": "boolean", + "x-go-name": "IsPrerelease" + }, + "tag_name": { + "type": "string", + "x-go-name": "TagName" + }, + "target_commitish": { + "type": "string", + "x-go-name": "Target" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateRepoOption": { + "description": "CreateRepoOption options when creating repository", + "type": "object", + "required": [ + "name" + ], + "properties": { + "auto_init": { + "description": "Whether the repository should be auto-initialized?", + "type": "boolean", + "x-go-name": "AutoInit" + }, + "default_branch": { + "description": "DefaultBranch of the repository (used when initializes and in template)", + "type": "string", + "x-go-name": "DefaultBranch" + }, + "description": { + "description": "Description of the repository to create", + "type": "string", + "x-go-name": "Description" + }, + "gitignores": { + "description": "Gitignores to use", + "type": "string", + "x-go-name": "Gitignores" + }, + "issue_labels": { + "description": "Label-Set to use", + "type": "string", + "x-go-name": "IssueLabels" + }, + "license": { + "description": "License to use", + "type": "string", + "x-go-name": "License" + }, + "name": { + "description": "Name of the repository to create", + "type": "string", + "uniqueItems": true, + "x-go-name": "Name" + }, + "object_format_name": { + "description": "ObjectFormatName of the underlying git repository", + "type": "string", + "enum": [ + "sha1", + "sha256" + ], + "x-go-name": "ObjectFormatName" + }, + "private": { + "description": "Whether the repository is private", + "type": "boolean", + "x-go-name": "Private" + }, + "readme": { + "description": "Readme of the repository to create", + "type": "string", + "x-go-name": "Readme" + }, + "template": { + "description": "Whether the repository is template", + "type": "boolean", + "x-go-name": "Template" + }, + "trust_model": { + "description": "TrustModel of the repository", + "type": "string", + "enum": [ + "default", + "collaborator", + "committer", + "collaboratorcommitter" + ], + "x-go-name": "TrustModel" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateStatusOption": { + "description": "CreateStatusOption holds the information needed to create a new CommitStatus for a Commit", + "type": "object", + "properties": { + "context": { + "type": "string", + "x-go-name": "Context" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "state": { + "$ref": "#/definitions/CommitStatusState" + }, + "target_url": { + "type": "string", + "x-go-name": "TargetURL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateTagOption": { + "description": "CreateTagOption options when creating a tag", + "type": "object", + "required": [ + "tag_name" + ], + "properties": { + "message": { + "type": "string", + "x-go-name": "Message" + }, + "tag_name": { + "type": "string", + "x-go-name": "TagName" + }, + "target": { + "type": "string", + "x-go-name": "Target" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateTagProtectionOption": { + "description": "CreateTagProtectionOption options for creating a tag protection", + "type": "object", + "properties": { + "name_pattern": { + "type": "string", + "x-go-name": "NamePattern" + }, + "whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "WhitelistTeams" + }, + "whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "WhitelistUsernames" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateTeamOption": { + "description": "CreateTeamOption options for creating a team", + "type": "object", + "required": [ + "name" + ], + "properties": { + "can_create_org_repo": { + "type": "boolean", + "x-go-name": "CanCreateOrgRepo" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "includes_all_repositories": { + "type": "boolean", + "x-go-name": "IncludesAllRepositories" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "permission": { + "type": "string", + "enum": [ + "read", + "write", + "admin" + ], + "x-go-name": "Permission" + }, + "units": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Units", + "example": [ + "repo.actions", + "repo.code", + "repo.issues", + "repo.ext_issues", + "repo.wiki", + "repo.ext_wiki", + "repo.pulls", + "repo.releases", + "repo.projects", + "repo.ext_wiki" + ] + }, + "units_map": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "UnitsMap", + "example": "{\"repo.actions\",\"repo.packages\",\"repo.code\":\"read\",\"repo.issues\":\"write\",\"repo.ext_issues\":\"none\",\"repo.wiki\":\"admin\",\"repo.pulls\":\"owner\",\"repo.releases\":\"none\",\"repo.projects\":\"none\",\"repo.ext_wiki\":\"none\"}" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateUserOption": { + "description": "CreateUserOption create user options", + "type": "object", + "required": [ + "username", + "email" + ], + "properties": { + "created_at": { + "description": "For explicitly setting the user creation timestamp. Useful when users are\nmigrated from other systems. When omitted, the user's creation timestamp\nwill be set to \"now\".", + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "email": { + "type": "string", + "format": "email", + "x-go-name": "Email" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "login_name": { + "type": "string", + "x-go-name": "LoginName" + }, + "must_change_password": { + "type": "boolean", + "x-go-name": "MustChangePassword" + }, + "password": { + "type": "string", + "x-go-name": "Password" + }, + "restricted": { + "type": "boolean", + "x-go-name": "Restricted" + }, + "send_notify": { + "type": "boolean", + "x-go-name": "SendNotify" + }, + "source_id": { + "type": "integer", + "format": "int64", + "x-go-name": "SourceID" + }, + "username": { + "type": "string", + "x-go-name": "Username" + }, + "visibility": { + "type": "string", + "x-go-name": "Visibility" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateVariableOption": { + "description": "CreateVariableOption the option when creating variable", + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "description": "Value of the variable to create", + "type": "string", + "x-go-name": "Value" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "CreateWikiPageOptions": { + "description": "CreateWikiPageOptions form for creating wiki", + "type": "object", + "properties": { + "content_base64": { + "description": "content must be base64 encoded", + "type": "string", + "x-go-name": "ContentBase64" + }, + "message": { + "description": "optional commit message summarizing the change", + "type": "string", + "x-go-name": "Message" + }, + "title": { + "description": "page title. leave empty to keep unchanged", + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Cron": { + "description": "Cron represents a Cron task", + "type": "object", + "properties": { + "exec_times": { + "type": "integer", + "format": "int64", + "x-go-name": "ExecTimes" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "next": { + "type": "string", + "format": "date-time", + "x-go-name": "Next" + }, + "prev": { + "type": "string", + "format": "date-time", + "x-go-name": "Prev" + }, + "schedule": { + "type": "string", + "x-go-name": "Schedule" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "DeleteEmailOption": { + "description": "DeleteEmailOption options when deleting email addresses", + "type": "object", + "properties": { + "emails": { + "description": "email addresses to delete", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Emails" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "DeleteFileOptions": { + "description": "DeleteFileOptions options for deleting files (used for other File structs below)\nNote: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)", + "type": "object", + "required": [ + "sha" + ], + "properties": { + "author": { + "$ref": "#/definitions/Identity" + }, + "branch": { + "description": "branch (optional) to base this file from. if not given, the default branch is used", + "type": "string", + "x-go-name": "BranchName" + }, + "committer": { + "$ref": "#/definitions/Identity" + }, + "dates": { + "$ref": "#/definitions/CommitDateOptions" + }, + "message": { + "description": "message (optional) for the commit of this file. if not supplied, a default message will be used", + "type": "string", + "x-go-name": "Message" + }, + "new_branch": { + "description": "new_branch (optional) will make a new branch from `branch` before creating the file", + "type": "string", + "x-go-name": "NewBranchName" + }, + "sha": { + "description": "sha is the SHA for the file that already exists", + "type": "string", + "x-go-name": "SHA" + }, + "signoff": { + "description": "Add a Signed-off-by trailer by the committer at the end of the commit log message.", + "type": "boolean", + "x-go-name": "Signoff" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "DeleteLabelsOption": { + "description": "DeleteLabelOption options for deleting a label", + "type": "object", + "properties": { + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "DeployKey": { + "description": "DeployKey a deploy key", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "fingerprint": { + "type": "string", + "x-go-name": "Fingerprint" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "key": { + "type": "string", + "x-go-name": "Key" + }, + "key_id": { + "type": "integer", + "format": "int64", + "x-go-name": "KeyID" + }, + "read_only": { + "type": "boolean", + "x-go-name": "ReadOnly" + }, + "repository": { + "$ref": "#/definitions/Repository" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "DismissPullReviewOptions": { + "description": "DismissPullReviewOptions are options to dismiss a pull review", + "type": "object", + "properties": { + "message": { + "type": "string", + "x-go-name": "Message" + }, + "priors": { + "type": "boolean", + "x-go-name": "Priors" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "DispatchWorkflowOption": { + "description": "DispatchWorkflowOption options when dispatching a workflow", + "type": "object", + "required": [ + "ref" + ], + "properties": { + "inputs": { + "description": "Input keys and values configured in the workflow file.", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "Inputs" + }, + "ref": { + "description": "Git reference for the workflow", + "type": "string", + "x-go-name": "Ref" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditAttachmentOptions": { + "description": "EditAttachmentOptions options for editing attachments", + "type": "object", + "properties": { + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditBranchProtectionOption": { + "description": "EditBranchProtectionOption options for editing a branch protection", + "type": "object", + "properties": { + "apply_to_admins": { + "type": "boolean", + "x-go-name": "ApplyToAdmins" + }, + "approvals_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "ApprovalsWhitelistTeams" + }, + "approvals_whitelist_username": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "ApprovalsWhitelistUsernames" + }, + "block_on_official_review_requests": { + "type": "boolean", + "x-go-name": "BlockOnOfficialReviewRequests" + }, + "block_on_outdated_branch": { + "type": "boolean", + "x-go-name": "BlockOnOutdatedBranch" + }, + "block_on_rejected_reviews": { + "type": "boolean", + "x-go-name": "BlockOnRejectedReviews" + }, + "dismiss_stale_approvals": { + "type": "boolean", + "x-go-name": "DismissStaleApprovals" + }, + "enable_approvals_whitelist": { + "type": "boolean", + "x-go-name": "EnableApprovalsWhitelist" + }, + "enable_merge_whitelist": { + "type": "boolean", + "x-go-name": "EnableMergeWhitelist" + }, + "enable_push": { + "type": "boolean", + "x-go-name": "EnablePush" + }, + "enable_push_whitelist": { + "type": "boolean", + "x-go-name": "EnablePushWhitelist" + }, + "enable_status_check": { + "type": "boolean", + "x-go-name": "EnableStatusCheck" + }, + "ignore_stale_approvals": { + "type": "boolean", + "x-go-name": "IgnoreStaleApprovals" + }, + "merge_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "MergeWhitelistTeams" + }, + "merge_whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "MergeWhitelistUsernames" + }, + "protected_file_patterns": { + "type": "string", + "x-go-name": "ProtectedFilePatterns" + }, + "push_whitelist_deploy_keys": { + "type": "boolean", + "x-go-name": "PushWhitelistDeployKeys" + }, + "push_whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "PushWhitelistTeams" + }, + "push_whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "PushWhitelistUsernames" + }, + "require_signed_commits": { + "type": "boolean", + "x-go-name": "RequireSignedCommits" + }, + "required_approvals": { + "type": "integer", + "format": "int64", + "x-go-name": "RequiredApprovals" + }, + "status_check_contexts": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "StatusCheckContexts" + }, + "unprotected_file_patterns": { + "type": "string", + "x-go-name": "UnprotectedFilePatterns" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditDeadlineOption": { + "description": "EditDeadlineOption options for creating a deadline", + "type": "object", + "required": [ + "due_date" + ], + "properties": { + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditGitHookOption": { + "description": "EditGitHookOption options when modifying one Git hook", + "type": "object", + "properties": { + "content": { + "type": "string", + "x-go-name": "Content" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditHookOption": { + "description": "EditHookOption options when modify one hook", + "type": "object", + "properties": { + "active": { + "type": "boolean", + "x-go-name": "Active" + }, + "authorization_header": { + "type": "string", + "x-go-name": "AuthorizationHeader" + }, + "branch_filter": { + "type": "string", + "x-go-name": "BranchFilter" + }, + "config": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "Config" + }, + "events": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Events" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditIssueCommentOption": { + "description": "EditIssueCommentOption options for editing a comment", + "type": "object", + "required": [ + "body" + ], + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditIssueOption": { + "description": "EditIssueOption options for editing an issue", + "type": "object", + "properties": { + "assignee": { + "description": "deprecated", + "type": "string", + "x-go-name": "Assignee" + }, + "assignees": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Assignees" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "milestone": { + "type": "integer", + "format": "int64", + "x-go-name": "Milestone" + }, + "ref": { + "type": "string", + "x-go-name": "Ref" + }, + "state": { + "type": "string", + "x-go-name": "State" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "unset_due_date": { + "type": "boolean", + "x-go-name": "RemoveDeadline" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditLabelOption": { + "description": "EditLabelOption options for editing a label", + "type": "object", + "properties": { + "color": { + "type": "string", + "x-go-name": "Color", + "example": "#00aabb" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "exclusive": { + "type": "boolean", + "x-go-name": "Exclusive", + "example": false + }, + "is_archived": { + "type": "boolean", + "x-go-name": "IsArchived", + "example": false + }, + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditMilestoneOption": { + "description": "EditMilestoneOption options for editing a milestone", + "type": "object", + "properties": { + "description": { + "type": "string", + "x-go-name": "Description" + }, + "due_on": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "state": { + "type": "string", + "x-go-name": "State" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditOrgOption": { + "description": "EditOrgOption options for editing an organization", + "type": "object", + "properties": { + "description": { + "type": "string", + "x-go-name": "Description" + }, + "email": { + "type": "string", + "x-go-name": "Email" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "location": { + "type": "string", + "x-go-name": "Location" + }, + "repo_admin_change_team_access": { + "type": "boolean", + "x-go-name": "RepoAdminChangeTeamAccess" + }, + "visibility": { + "description": "possible values are `public`, `limited` or `private`", + "type": "string", + "enum": [ + "public", + "limited", + "private" + ], + "x-go-name": "Visibility" + }, + "website": { + "type": "string", + "x-go-name": "Website" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditPullRequestOption": { + "description": "EditPullRequestOption options when modify pull request", + "type": "object", + "properties": { + "allow_maintainer_edit": { + "type": "boolean", + "x-go-name": "AllowMaintainerEdit" + }, + "assignee": { + "type": "string", + "x-go-name": "Assignee" + }, + "assignees": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Assignees" + }, + "base": { + "type": "string", + "x-go-name": "Base" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "labels": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "x-go-name": "Labels" + }, + "milestone": { + "type": "integer", + "format": "int64", + "x-go-name": "Milestone" + }, + "state": { + "type": "string", + "x-go-name": "State" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "unset_due_date": { + "type": "boolean", + "x-go-name": "RemoveDeadline" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditReactionOption": { + "description": "EditReactionOption contain the reaction type", + "type": "object", + "properties": { + "content": { + "type": "string", + "x-go-name": "Reaction" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditReleaseOption": { + "description": "EditReleaseOption options when editing a release", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Note" + }, + "draft": { + "type": "boolean", + "x-go-name": "IsDraft" + }, + "hide_archive_links": { + "type": "boolean", + "x-go-name": "HideArchiveLinks" + }, + "name": { + "type": "string", + "x-go-name": "Title" + }, + "prerelease": { + "type": "boolean", + "x-go-name": "IsPrerelease" + }, + "tag_name": { + "type": "string", + "x-go-name": "TagName" + }, + "target_commitish": { + "type": "string", + "x-go-name": "Target" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditRepoOption": { + "description": "EditRepoOption options when editing a repository's properties", + "type": "object", + "properties": { + "allow_fast_forward_only_merge": { + "description": "either `true` to allow fast-forward-only merging pull requests, or `false` to prevent fast-forward-only merging.", + "type": "boolean", + "x-go-name": "AllowFastForwardOnly" + }, + "allow_manual_merge": { + "description": "either `true` to allow mark pr as merged manually, or `false` to prevent it.", + "type": "boolean", + "x-go-name": "AllowManualMerge" + }, + "allow_merge_commits": { + "description": "either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.", + "type": "boolean", + "x-go-name": "AllowMerge" + }, + "allow_rebase": { + "description": "either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.", + "type": "boolean", + "x-go-name": "AllowRebase" + }, + "allow_rebase_explicit": { + "description": "either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits.", + "type": "boolean", + "x-go-name": "AllowRebaseMerge" + }, + "allow_rebase_update": { + "description": "either `true` to allow updating pull request branch by rebase, or `false` to prevent it.", + "type": "boolean", + "x-go-name": "AllowRebaseUpdate" + }, + "allow_squash_merge": { + "description": "either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.", + "type": "boolean", + "x-go-name": "AllowSquash" + }, + "archived": { + "description": "set to `true` to archive this repository.", + "type": "boolean", + "x-go-name": "Archived" + }, + "autodetect_manual_merge": { + "description": "either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.", + "type": "boolean", + "x-go-name": "AutodetectManualMerge" + }, + "default_allow_maintainer_edit": { + "description": "set to `true` to allow edits from maintainers by default", + "type": "boolean", + "x-go-name": "DefaultAllowMaintainerEdit" + }, + "default_branch": { + "description": "sets the default branch for this repository.", + "type": "string", + "x-go-name": "DefaultBranch" + }, + "default_delete_branch_after_merge": { + "description": "set to `true` to delete pr branch after merge by default", + "type": "boolean", + "x-go-name": "DefaultDeleteBranchAfterMerge" + }, + "default_merge_style": { + "description": "set to a merge style to be used by this repository: \"merge\", \"rebase\", \"rebase-merge\", \"squash\", or \"fast-forward-only\".", + "type": "string", + "x-go-name": "DefaultMergeStyle" + }, + "description": { + "description": "a short description of the repository.", + "type": "string", + "x-go-name": "Description" + }, + "enable_prune": { + "description": "enable prune - remove obsolete remote-tracking references when mirroring", + "type": "boolean", + "x-go-name": "EnablePrune" + }, + "external_tracker": { + "$ref": "#/definitions/ExternalTracker" + }, + "external_wiki": { + "$ref": "#/definitions/ExternalWiki" + }, + "globally_editable_wiki": { + "description": "set the globally editable state of the wiki", + "type": "boolean", + "x-go-name": "GloballyEditableWiki" + }, + "has_actions": { + "description": "either `true` to enable actions unit, or `false` to disable them.", + "type": "boolean", + "x-go-name": "HasActions" + }, + "has_issues": { + "description": "either `true` to enable issues for this repository or `false` to disable them.", + "type": "boolean", + "x-go-name": "HasIssues" + }, + "has_packages": { + "description": "either `true` to enable packages unit, or `false` to disable them.", + "type": "boolean", + "x-go-name": "HasPackages" + }, + "has_projects": { + "description": "either `true` to enable project unit, or `false` to disable them.", + "type": "boolean", + "x-go-name": "HasProjects" + }, + "has_pull_requests": { + "description": "either `true` to allow pull requests, or `false` to prevent pull request.", + "type": "boolean", + "x-go-name": "HasPullRequests" + }, + "has_releases": { + "description": "either `true` to enable releases unit, or `false` to disable them.", + "type": "boolean", + "x-go-name": "HasReleases" + }, + "has_wiki": { + "description": "either `true` to enable the wiki for this repository or `false` to disable it.", + "type": "boolean", + "x-go-name": "HasWiki" + }, + "ignore_whitespace_conflicts": { + "description": "either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.", + "type": "boolean", + "x-go-name": "IgnoreWhitespaceConflicts" + }, + "internal_tracker": { + "$ref": "#/definitions/InternalTracker" + }, + "mirror_interval": { + "description": "set to a string like `8h30m0s` to set the mirror interval time", + "type": "string", + "x-go-name": "MirrorInterval" + }, + "name": { + "description": "name of the repository", + "type": "string", + "uniqueItems": true, + "x-go-name": "Name" + }, + "private": { + "description": "either `true` to make the repository private or `false` to make it public.\nNote: you will get a 422 error if the organization restricts changing repository visibility to organization\nowners and a non-owner tries to change the value of private.", + "type": "boolean", + "x-go-name": "Private" + }, + "template": { + "description": "either `true` to make this repository a template or `false` to make it a normal repository", + "type": "boolean", + "x-go-name": "Template" + }, + "website": { + "description": "a URL with more information about the repository.", + "type": "string", + "x-go-name": "Website" + }, + "wiki_branch": { + "description": "sets the branch used for this repository's wiki.", + "type": "string", + "x-go-name": "WikiBranch" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditTagProtectionOption": { + "description": "EditTagProtectionOption options for editing a tag protection", + "type": "object", + "properties": { + "name_pattern": { + "type": "string", + "x-go-name": "NamePattern" + }, + "whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "WhitelistTeams" + }, + "whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "WhitelistUsernames" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditTeamOption": { + "description": "EditTeamOption options for editing a team", + "type": "object", + "required": [ + "name" + ], + "properties": { + "can_create_org_repo": { + "type": "boolean", + "x-go-name": "CanCreateOrgRepo" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "includes_all_repositories": { + "type": "boolean", + "x-go-name": "IncludesAllRepositories" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "permission": { + "type": "string", + "enum": [ + "read", + "write", + "admin" + ], + "x-go-name": "Permission" + }, + "units": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Units", + "example": [ + "repo.code", + "repo.issues", + "repo.ext_issues", + "repo.wiki", + "repo.pulls", + "repo.releases", + "repo.projects", + "repo.ext_wiki" + ] + }, + "units_map": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "UnitsMap", + "example": { + "repo.code": "read", + "repo.ext_issues": "none", + "repo.ext_wiki": "none", + "repo.issues": "write", + "repo.projects": "none", + "repo.pulls": "owner", + "repo.releases": "none", + "repo.wiki": "admin" + } + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "EditUserOption": { + "description": "EditUserOption edit user options", + "type": "object", + "properties": { + "active": { + "type": "boolean", + "x-go-name": "Active" + }, + "admin": { + "type": "boolean", + "x-go-name": "Admin" + }, + "allow_create_organization": { + "type": "boolean", + "x-go-name": "AllowCreateOrganization" + }, + "allow_git_hook": { + "type": "boolean", + "x-go-name": "AllowGitHook" + }, + "allow_import_local": { + "type": "boolean", + "x-go-name": "AllowImportLocal" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "email": { + "type": "string", + "format": "email", + "x-go-name": "Email" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "location": { + "type": "string", + "x-go-name": "Location" + }, + "login_name": { + "type": "string", + "x-go-name": "LoginName" + }, + "max_repo_creation": { + "type": "integer", + "format": "int64", + "x-go-name": "MaxRepoCreation" + }, + "must_change_password": { + "type": "boolean", + "x-go-name": "MustChangePassword" + }, + "password": { + "type": "string", + "x-go-name": "Password" + }, + "prohibit_login": { + "type": "boolean", + "x-go-name": "ProhibitLogin" + }, + "pronouns": { + "type": "string", + "x-go-name": "Pronouns" + }, + "restricted": { + "type": "boolean", + "x-go-name": "Restricted" + }, + "source_id": { + "type": "integer", + "format": "int64", + "x-go-name": "SourceID" + }, + "visibility": { + "type": "string", + "x-go-name": "Visibility" + }, + "website": { + "type": "string", + "x-go-name": "Website" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Email": { + "description": "Email an email address belonging to a user", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "x-go-name": "Email" + }, + "primary": { + "type": "boolean", + "x-go-name": "Primary" + }, + "user_id": { + "type": "integer", + "format": "int64", + "x-go-name": "UserID" + }, + "username": { + "type": "string", + "x-go-name": "UserName" + }, + "verified": { + "type": "boolean", + "x-go-name": "Verified" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ExternalTracker": { + "description": "ExternalTracker represents settings for external tracker", + "type": "object", + "properties": { + "external_tracker_format": { + "description": "External Issue Tracker URL Format. Use the placeholders {user}, {repo} and {index} for the username, repository name and issue index.", + "type": "string", + "x-go-name": "ExternalTrackerFormat" + }, + "external_tracker_regexp_pattern": { + "description": "External Issue Tracker issue regular expression", + "type": "string", + "x-go-name": "ExternalTrackerRegexpPattern" + }, + "external_tracker_style": { + "description": "External Issue Tracker Number Format, either `numeric`, `alphanumeric`, or `regexp`", + "type": "string", + "x-go-name": "ExternalTrackerStyle" + }, + "external_tracker_url": { + "description": "URL of external issue tracker.", + "type": "string", + "x-go-name": "ExternalTrackerURL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ExternalWiki": { + "description": "ExternalWiki represents setting for external wiki", + "type": "object", + "properties": { + "external_wiki_url": { + "description": "URL of external wiki.", + "type": "string", + "x-go-name": "ExternalWikiURL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "FileCommitResponse": { + "type": "object", + "title": "FileCommitResponse contains information generated from a Git commit for a repo's file.", + "properties": { + "author": { + "$ref": "#/definitions/CommitUser" + }, + "committer": { + "$ref": "#/definitions/CommitUser" + }, + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "parents": { + "type": "array", + "items": { + "$ref": "#/definitions/CommitMeta" + }, + "x-go-name": "Parents" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "tree": { + "$ref": "#/definitions/CommitMeta" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "FileDeleteResponse": { + "description": "FileDeleteResponse contains information about a repo's file that was deleted", + "type": "object", + "properties": { + "commit": { + "$ref": "#/definitions/FileCommitResponse" + }, + "content": { + "x-go-name": "Content" + }, + "verification": { + "$ref": "#/definitions/PayloadCommitVerification" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "FileLinksResponse": { + "description": "FileLinksResponse contains the links for a repo's file", + "type": "object", + "properties": { + "git": { + "type": "string", + "x-go-name": "GitURL" + }, + "html": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "self": { + "type": "string", + "x-go-name": "Self" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "FileResponse": { + "description": "FileResponse contains information about a repo's file", + "type": "object", + "properties": { + "commit": { + "$ref": "#/definitions/FileCommitResponse" + }, + "content": { + "$ref": "#/definitions/ContentsResponse" + }, + "verification": { + "$ref": "#/definitions/PayloadCommitVerification" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "FilesResponse": { + "description": "FilesResponse contains information about multiple files from a repo", + "type": "object", + "properties": { + "commit": { + "$ref": "#/definitions/FileCommitResponse" + }, + "files": { + "type": "array", + "items": { + "$ref": "#/definitions/ContentsResponse" + }, + "x-go-name": "Files" + }, + "verification": { + "$ref": "#/definitions/PayloadCommitVerification" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ForgeLike": { + "description": "ForgeLike activity data type", + "type": "object", + "x-go-package": "code.gitea.io/gitea/modules/forgefed" + }, + "GPGKey": { + "description": "GPGKey a user GPG key to sign commit and tag in repository", + "type": "object", + "properties": { + "can_certify": { + "type": "boolean", + "x-go-name": "CanCertify" + }, + "can_encrypt_comms": { + "type": "boolean", + "x-go-name": "CanEncryptComms" + }, + "can_encrypt_storage": { + "type": "boolean", + "x-go-name": "CanEncryptStorage" + }, + "can_sign": { + "type": "boolean", + "x-go-name": "CanSign" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "emails": { + "type": "array", + "items": { + "$ref": "#/definitions/GPGKeyEmail" + }, + "x-go-name": "Emails" + }, + "expires_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Expires" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "key_id": { + "type": "string", + "x-go-name": "KeyID" + }, + "primary_key_id": { + "type": "string", + "x-go-name": "PrimaryKeyID" + }, + "public_key": { + "type": "string", + "x-go-name": "PublicKey" + }, + "subkeys": { + "type": "array", + "items": { + "$ref": "#/definitions/GPGKey" + }, + "x-go-name": "SubsKey" + }, + "verified": { + "type": "boolean", + "x-go-name": "Verified" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GPGKeyEmail": { + "description": "GPGKeyEmail an email attached to a GPGKey", + "type": "object", + "properties": { + "email": { + "type": "string", + "x-go-name": "Email" + }, + "verified": { + "type": "boolean", + "x-go-name": "Verified" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GeneralAPISettings": { + "description": "GeneralAPISettings contains global api settings exposed by it", + "type": "object", + "properties": { + "default_git_trees_per_page": { + "type": "integer", + "format": "int64", + "x-go-name": "DefaultGitTreesPerPage" + }, + "default_max_blob_size": { + "type": "integer", + "format": "int64", + "x-go-name": "DefaultMaxBlobSize" + }, + "default_paging_num": { + "type": "integer", + "format": "int64", + "x-go-name": "DefaultPagingNum" + }, + "max_response_items": { + "type": "integer", + "format": "int64", + "x-go-name": "MaxResponseItems" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GeneralAttachmentSettings": { + "description": "GeneralAttachmentSettings contains global Attachment settings exposed by API", + "type": "object", + "properties": { + "allowed_types": { + "type": "string", + "x-go-name": "AllowedTypes" + }, + "enabled": { + "type": "boolean", + "x-go-name": "Enabled" + }, + "max_files": { + "type": "integer", + "format": "int64", + "x-go-name": "MaxFiles" + }, + "max_size": { + "type": "integer", + "format": "int64", + "x-go-name": "MaxSize" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GeneralRepoSettings": { + "description": "GeneralRepoSettings contains global repository settings exposed by API", + "type": "object", + "properties": { + "forks_disabled": { + "type": "boolean", + "x-go-name": "ForksDisabled" + }, + "http_git_disabled": { + "type": "boolean", + "x-go-name": "HTTPGitDisabled" + }, + "lfs_disabled": { + "type": "boolean", + "x-go-name": "LFSDisabled" + }, + "migrations_disabled": { + "type": "boolean", + "x-go-name": "MigrationsDisabled" + }, + "mirrors_disabled": { + "type": "boolean", + "x-go-name": "MirrorsDisabled" + }, + "stars_disabled": { + "type": "boolean", + "x-go-name": "StarsDisabled" + }, + "time_tracking_disabled": { + "type": "boolean", + "x-go-name": "TimeTrackingDisabled" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GeneralUISettings": { + "description": "GeneralUISettings contains global ui settings exposed by API", + "type": "object", + "properties": { + "allowed_reactions": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "AllowedReactions" + }, + "custom_emojis": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "CustomEmojis" + }, + "default_theme": { + "type": "string", + "x-go-name": "DefaultTheme" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GenerateRepoOption": { + "description": "GenerateRepoOption options when creating repository using a template", + "type": "object", + "required": [ + "owner", + "name" + ], + "properties": { + "avatar": { + "description": "include avatar of the template repo", + "type": "boolean", + "x-go-name": "Avatar" + }, + "default_branch": { + "description": "Default branch of the new repository", + "type": "string", + "x-go-name": "DefaultBranch" + }, + "description": { + "description": "Description of the repository to create", + "type": "string", + "x-go-name": "Description" + }, + "git_content": { + "description": "include git content of default branch in template repo", + "type": "boolean", + "x-go-name": "GitContent" + }, + "git_hooks": { + "description": "include git hooks in template repo", + "type": "boolean", + "x-go-name": "GitHooks" + }, + "labels": { + "description": "include labels in template repo", + "type": "boolean", + "x-go-name": "Labels" + }, + "name": { + "description": "Name of the repository to create", + "type": "string", + "uniqueItems": true, + "x-go-name": "Name" + }, + "owner": { + "description": "The organization or person who will own the new repository", + "type": "string", + "x-go-name": "Owner" + }, + "private": { + "description": "Whether the repository is private", + "type": "boolean", + "x-go-name": "Private" + }, + "protected_branch": { + "description": "include protected branches in template repo", + "type": "boolean", + "x-go-name": "ProtectedBranch" + }, + "topics": { + "description": "include topics in template repo", + "type": "boolean", + "x-go-name": "Topics" + }, + "webhooks": { + "description": "include webhooks in template repo", + "type": "boolean", + "x-go-name": "Webhooks" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GitBlobResponse": { + "description": "GitBlobResponse represents a git blob", + "type": "object", + "properties": { + "content": { + "type": "string", + "x-go-name": "Content" + }, + "encoding": { + "type": "string", + "x-go-name": "Encoding" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "size": { + "type": "integer", + "format": "int64", + "x-go-name": "Size" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GitEntry": { + "description": "GitEntry represents a git tree", + "type": "object", + "properties": { + "mode": { + "type": "string", + "x-go-name": "Mode" + }, + "path": { + "type": "string", + "x-go-name": "Path" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "size": { + "type": "integer", + "format": "int64", + "x-go-name": "Size" + }, + "type": { + "type": "string", + "x-go-name": "Type" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GitHook": { + "description": "GitHook represents a Git repository hook", + "type": "object", + "properties": { + "content": { + "type": "string", + "x-go-name": "Content" + }, + "is_active": { + "type": "boolean", + "x-go-name": "IsActive" + }, + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GitObject": { + "type": "object", + "title": "GitObject represents a Git object.", + "properties": { + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "type": { + "type": "string", + "x-go-name": "Type" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GitTreeResponse": { + "description": "GitTreeResponse returns a git tree", + "type": "object", + "properties": { + "page": { + "type": "integer", + "format": "int64", + "x-go-name": "Page" + }, + "sha": { + "type": "string", + "x-go-name": "SHA" + }, + "total_count": { + "type": "integer", + "format": "int64", + "x-go-name": "TotalCount" + }, + "tree": { + "type": "array", + "items": { + "$ref": "#/definitions/GitEntry" + }, + "x-go-name": "Entries" + }, + "truncated": { + "type": "boolean", + "x-go-name": "Truncated" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "GitignoreTemplateInfo": { + "description": "GitignoreTemplateInfo name and text of a gitignore template", + "type": "object", + "properties": { + "name": { + "type": "string", + "x-go-name": "Name" + }, + "source": { + "type": "string", + "x-go-name": "Source" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Hook": { + "description": "Hook a hook is a web hook when one repository changed", + "type": "object", + "properties": { + "active": { + "type": "boolean", + "x-go-name": "Active" + }, + "authorization_header": { + "type": "string", + "x-go-name": "AuthorizationHeader" + }, + "branch_filter": { + "type": "string", + "x-go-name": "BranchFilter" + }, + "config": { + "description": "Deprecated: use Metadata instead", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "Config" + }, + "content_type": { + "type": "string", + "x-go-name": "ContentType" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "events": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Events" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "metadata": { + "x-go-name": "Metadata" + }, + "type": { + "type": "string", + "x-go-name": "Type" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Identity": { + "description": "Identity for a person's identity like an author or committer", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "x-go-name": "Email" + }, + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "InternalTracker": { + "description": "InternalTracker represents settings for internal tracker", + "type": "object", + "properties": { + "allow_only_contributors_to_track_time": { + "description": "Let only contributors track time (Built-in issue tracker)", + "type": "boolean", + "x-go-name": "AllowOnlyContributorsToTrackTime" + }, + "enable_issue_dependencies": { + "description": "Enable dependencies for issues and pull requests (Built-in issue tracker)", + "type": "boolean", + "x-go-name": "EnableIssueDependencies" + }, + "enable_time_tracker": { + "description": "Enable time tracking (Built-in issue tracker)", + "type": "boolean", + "x-go-name": "EnableTimeTracker" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Issue": { + "description": "Issue represents an issue in a repository", + "type": "object", + "properties": { + "assets": { + "type": "array", + "items": { + "$ref": "#/definitions/Attachment" + }, + "x-go-name": "Attachments" + }, + "assignee": { + "$ref": "#/definitions/User" + }, + "assignees": { + "type": "array", + "items": { + "$ref": "#/definitions/User" + }, + "x-go-name": "Assignees" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "closed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Closed" + }, + "comments": { + "type": "integer", + "format": "int64", + "x-go-name": "Comments" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "is_locked": { + "type": "boolean", + "x-go-name": "IsLocked" + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/Label" + }, + "x-go-name": "Labels" + }, + "milestone": { + "$ref": "#/definitions/Milestone" + }, + "number": { + "type": "integer", + "format": "int64", + "x-go-name": "Index" + }, + "original_author": { + "type": "string", + "x-go-name": "OriginalAuthor" + }, + "original_author_id": { + "type": "integer", + "format": "int64", + "x-go-name": "OriginalAuthorID" + }, + "pin_order": { + "type": "integer", + "format": "int64", + "x-go-name": "PinOrder" + }, + "pull_request": { + "$ref": "#/definitions/PullRequestMeta" + }, + "ref": { + "type": "string", + "x-go-name": "Ref" + }, + "repository": { + "$ref": "#/definitions/RepositoryMeta" + }, + "state": { + "$ref": "#/definitions/StateType" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueConfig": { + "type": "object", + "properties": { + "blank_issues_enabled": { + "type": "boolean", + "x-go-name": "BlankIssuesEnabled" + }, + "contact_links": { + "type": "array", + "items": { + "$ref": "#/definitions/IssueConfigContactLink" + }, + "x-go-name": "ContactLinks" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueConfigContactLink": { + "type": "object", + "properties": { + "about": { + "type": "string", + "x-go-name": "About" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueConfigValidation": { + "type": "object", + "properties": { + "message": { + "type": "string", + "x-go-name": "Message" + }, + "valid": { + "type": "boolean", + "x-go-name": "Valid" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueDeadline": { + "description": "IssueDeadline represents an issue deadline", + "type": "object", + "properties": { + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueFormField": { + "description": "IssueFormField represents a form field", + "type": "object", + "properties": { + "attributes": { + "type": "object", + "additionalProperties": {}, + "x-go-name": "Attributes" + }, + "id": { + "type": "string", + "x-go-name": "ID" + }, + "type": { + "$ref": "#/definitions/IssueFormFieldType" + }, + "validations": { + "type": "object", + "additionalProperties": {}, + "x-go-name": "Validations" + }, + "visible": { + "type": "array", + "items": { + "$ref": "#/definitions/IssueFormFieldVisible" + }, + "x-go-name": "Visible" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueFormFieldType": { + "type": "string", + "title": "IssueFormFieldType defines issue form field type, can be \"markdown\", \"textarea\", \"input\", \"dropdown\" or \"checkboxes\"", + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueFormFieldVisible": { + "description": "IssueFormFieldVisible defines issue form field visible", + "type": "string", + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueLabelsOption": { + "description": "IssueLabelsOption a collection of labels", + "type": "object", + "properties": { + "labels": { + "description": "Labels can be a list of integers representing label IDs\nor a list of strings representing label names", + "type": "array", + "items": {}, + "x-go-name": "Labels" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueMeta": { + "description": "IssueMeta basic issue information", + "type": "object", + "properties": { + "index": { + "type": "integer", + "format": "int64", + "x-go-name": "Index" + }, + "owner": { + "type": "string", + "x-go-name": "Owner" + }, + "repo": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueTemplate": { + "description": "IssueTemplate represents an issue template for a repository", + "type": "object", + "properties": { + "about": { + "type": "string", + "x-go-name": "About" + }, + "body": { + "type": "array", + "items": { + "$ref": "#/definitions/IssueFormField" + }, + "x-go-name": "Fields" + }, + "content": { + "type": "string", + "x-go-name": "Content" + }, + "file_name": { + "type": "string", + "x-go-name": "FileName" + }, + "labels": { + "$ref": "#/definitions/IssueTemplateLabels" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "ref": { + "type": "string", + "x-go-name": "Ref" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "IssueTemplateLabels": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Label": { + "description": "Label a label to an issue or a pr", + "type": "object", + "properties": { + "color": { + "type": "string", + "x-go-name": "Color", + "example": "00aabb" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "exclusive": { + "type": "boolean", + "x-go-name": "Exclusive", + "example": false + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "is_archived": { + "type": "boolean", + "x-go-name": "IsArchived", + "example": false + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "LabelTemplate": { + "description": "LabelTemplate info of a Label template", + "type": "object", + "properties": { + "color": { + "type": "string", + "x-go-name": "Color", + "example": "00aabb" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "exclusive": { + "type": "boolean", + "x-go-name": "Exclusive", + "example": false + }, + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "LicenseTemplateInfo": { + "description": "LicensesInfo contains information about a License", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "implementation": { + "type": "string", + "x-go-name": "Implementation" + }, + "key": { + "type": "string", + "x-go-name": "Key" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "LicensesTemplateListEntry": { + "description": "LicensesListEntry is used for the API", + "type": "object", + "properties": { + "key": { + "type": "string", + "x-go-name": "Key" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "MarkdownOption": { + "description": "MarkdownOption markdown options", + "type": "object", + "properties": { + "Context": { + "description": "Context to render\n\nin: body", + "type": "string" + }, + "Mode": { + "description": "Mode to render (comment, gfm, markdown)\n\nin: body", + "type": "string" + }, + "Text": { + "description": "Text markdown to render\n\nin: body", + "type": "string" + }, + "Wiki": { + "description": "Is it a wiki page ?\n\nin: body", + "type": "boolean" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "MarkupOption": { + "description": "MarkupOption markup options", + "type": "object", + "properties": { + "Context": { + "description": "Context to render\n\nin: body", + "type": "string" + }, + "FilePath": { + "description": "File path for detecting extension in file mode\n\nin: body", + "type": "string" + }, + "Mode": { + "description": "Mode to render (comment, gfm, markdown, file)\n\nin: body", + "type": "string" + }, + "Text": { + "description": "Text markup to render\n\nin: body", + "type": "string" + }, + "Wiki": { + "description": "Is it a wiki page ?\n\nin: body", + "type": "boolean" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "MergePullRequestOption": { + "description": "MergePullRequestForm form for merging Pull Request", + "type": "object", + "required": [ + "Do" + ], + "properties": { + "Do": { + "type": "string", + "enum": [ + "merge", + "rebase", + "rebase-merge", + "squash", + "fast-forward-only", + "manually-merged" + ] + }, + "MergeCommitID": { + "type": "string" + }, + "MergeMessageField": { + "type": "string" + }, + "MergeTitleField": { + "type": "string" + }, + "delete_branch_after_merge": { + "type": "boolean", + "x-go-name": "DeleteBranchAfterMerge" + }, + "force_merge": { + "type": "boolean", + "x-go-name": "ForceMerge" + }, + "head_commit_id": { + "type": "string", + "x-go-name": "HeadCommitID" + }, + "merge_when_checks_succeed": { + "type": "boolean", + "x-go-name": "MergeWhenChecksSucceed" + } + }, + "x-go-name": "MergePullRequestForm", + "x-go-package": "code.gitea.io/gitea/services/forms" + }, + "MigrateRepoOptions": { + "description": "MigrateRepoOptions options for migrating repository's\nthis is used to interact with api v1", + "type": "object", + "required": [ + "clone_addr", + "repo_name" + ], + "properties": { + "auth_password": { + "type": "string", + "x-go-name": "AuthPassword" + }, + "auth_token": { + "type": "string", + "x-go-name": "AuthToken" + }, + "auth_username": { + "type": "string", + "x-go-name": "AuthUsername" + }, + "clone_addr": { + "type": "string", + "x-go-name": "CloneAddr" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "issues": { + "type": "boolean", + "x-go-name": "Issues" + }, + "labels": { + "type": "boolean", + "x-go-name": "Labels" + }, + "lfs": { + "type": "boolean", + "x-go-name": "LFS" + }, + "lfs_endpoint": { + "type": "string", + "x-go-name": "LFSEndpoint" + }, + "milestones": { + "type": "boolean", + "x-go-name": "Milestones" + }, + "mirror": { + "type": "boolean", + "x-go-name": "Mirror" + }, + "mirror_interval": { + "type": "string", + "x-go-name": "MirrorInterval" + }, + "private": { + "type": "boolean", + "x-go-name": "Private" + }, + "pull_requests": { + "type": "boolean", + "x-go-name": "PullRequests" + }, + "releases": { + "type": "boolean", + "x-go-name": "Releases" + }, + "repo_name": { + "type": "string", + "x-go-name": "RepoName" + }, + "repo_owner": { + "description": "Name of User or Organisation who will own Repo after migration", + "type": "string", + "x-go-name": "RepoOwner" + }, + "service": { + "type": "string", + "enum": [ + "git", + "github", + "gitea", + "gitlab", + "gogs", + "onedev", + "gitbucket", + "codebase" + ], + "x-go-name": "Service" + }, + "uid": { + "description": "deprecated (only for backwards compatibility)", + "type": "integer", + "format": "int64", + "x-go-name": "RepoOwnerID" + }, + "wiki": { + "type": "boolean", + "x-go-name": "Wiki" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Milestone": { + "description": "Milestone milestone is a collection of issues on one repository", + "type": "object", + "properties": { + "closed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Closed" + }, + "closed_issues": { + "type": "integer", + "format": "int64", + "x-go-name": "ClosedIssues" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "due_on": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "open_issues": { + "type": "integer", + "format": "int64", + "x-go-name": "OpenIssues" + }, + "state": { + "$ref": "#/definitions/StateType" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NewIssuePinsAllowed": { + "description": "NewIssuePinsAllowed represents an API response that says if new Issue Pins are allowed", + "type": "object", + "properties": { + "issues": { + "type": "boolean", + "x-go-name": "Issues" + }, + "pull_requests": { + "type": "boolean", + "x-go-name": "PullRequests" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NodeInfo": { + "description": "NodeInfo contains standardized way of exposing metadata about a server running one of the distributed social networks", + "type": "object", + "properties": { + "metadata": { + "type": "object", + "x-go-name": "Metadata" + }, + "openRegistrations": { + "type": "boolean", + "x-go-name": "OpenRegistrations" + }, + "protocols": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Protocols" + }, + "services": { + "$ref": "#/definitions/NodeInfoServices" + }, + "software": { + "$ref": "#/definitions/NodeInfoSoftware" + }, + "usage": { + "$ref": "#/definitions/NodeInfoUsage" + }, + "version": { + "type": "string", + "x-go-name": "Version" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NodeInfoServices": { + "description": "NodeInfoServices contains the third party sites this server can connect to via their application API", + "type": "object", + "properties": { + "inbound": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Inbound" + }, + "outbound": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Outbound" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NodeInfoSoftware": { + "description": "NodeInfoSoftware contains Metadata about server software in use", + "type": "object", + "properties": { + "homepage": { + "type": "string", + "x-go-name": "Homepage" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "repository": { + "type": "string", + "x-go-name": "Repository" + }, + "version": { + "type": "string", + "x-go-name": "Version" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NodeInfoUsage": { + "description": "NodeInfoUsage contains usage statistics for this server", + "type": "object", + "properties": { + "localComments": { + "type": "integer", + "format": "int64", + "x-go-name": "LocalComments" + }, + "localPosts": { + "type": "integer", + "format": "int64", + "x-go-name": "LocalPosts" + }, + "users": { + "$ref": "#/definitions/NodeInfoUsageUsers" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NodeInfoUsageUsers": { + "description": "NodeInfoUsageUsers contains statistics about the users of this server", + "type": "object", + "properties": { + "activeHalfyear": { + "type": "integer", + "format": "int64", + "x-go-name": "ActiveHalfyear" + }, + "activeMonth": { + "type": "integer", + "format": "int64", + "x-go-name": "ActiveMonth" + }, + "total": { + "type": "integer", + "format": "int64", + "x-go-name": "Total" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Note": { + "description": "Note contains information related to a git note", + "type": "object", + "properties": { + "commit": { + "$ref": "#/definitions/Commit" + }, + "message": { + "type": "string", + "x-go-name": "Message" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NotificationCount": { + "description": "NotificationCount number of unread notifications", + "type": "object", + "properties": { + "new": { + "type": "integer", + "format": "int64", + "x-go-name": "New" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NotificationSubject": { + "description": "NotificationSubject contains the notification subject (Issue/Pull/Commit)", + "type": "object", + "properties": { + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "latest_comment_html_url": { + "type": "string", + "x-go-name": "LatestCommentHTMLURL" + }, + "latest_comment_url": { + "type": "string", + "x-go-name": "LatestCommentURL" + }, + "state": { + "$ref": "#/definitions/StateType" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "type": { + "$ref": "#/definitions/NotifySubjectType" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "NotificationThread": { + "description": "NotificationThread expose Notification on API", + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "pinned": { + "type": "boolean", + "x-go-name": "Pinned" + }, + "repository": { + "$ref": "#/definitions/Repository" + }, + "subject": { + "$ref": "#/definitions/NotificationSubject" + }, + "unread": { + "type": "boolean", + "x-go-name": "Unread" + }, + "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" + }, + "NotifySubjectType": { + "description": "NotifySubjectType represent type of notification subject", + "type": "string", + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "OAuth2Application": { + "type": "object", + "title": "OAuth2Application represents an OAuth2 application.", + "properties": { + "client_id": { + "type": "string", + "x-go-name": "ClientID" + }, + "client_secret": { + "type": "string", + "x-go-name": "ClientSecret" + }, + "confidential_client": { + "type": "boolean", + "x-go-name": "ConfidentialClient" + }, + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "redirect_uris": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "RedirectURIs" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Organization": { + "description": "Organization represents an organization", + "type": "object", + "properties": { + "avatar_url": { + "type": "string", + "x-go-name": "AvatarURL" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "email": { + "type": "string", + "x-go-name": "Email" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "location": { + "type": "string", + "x-go-name": "Location" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "repo_admin_change_team_access": { + "type": "boolean", + "x-go-name": "RepoAdminChangeTeamAccess" + }, + "username": { + "description": "deprecated", + "type": "string", + "x-go-name": "UserName" + }, + "visibility": { + "type": "string", + "x-go-name": "Visibility" + }, + "website": { + "type": "string", + "x-go-name": "Website" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "OrganizationPermissions": { + "description": "OrganizationPermissions list different users permissions on an organization", + "type": "object", + "properties": { + "can_create_repository": { + "type": "boolean", + "x-go-name": "CanCreateRepository" + }, + "can_read": { + "type": "boolean", + "x-go-name": "CanRead" + }, + "can_write": { + "type": "boolean", + "x-go-name": "CanWrite" + }, + "is_admin": { + "type": "boolean", + "x-go-name": "IsAdmin" + }, + "is_owner": { + "type": "boolean", + "x-go-name": "IsOwner" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PRBranchInfo": { + "description": "PRBranchInfo information about a branch", + "type": "object", + "properties": { + "label": { + "type": "string", + "x-go-name": "Name" + }, + "ref": { + "type": "string", + "x-go-name": "Ref" + }, + "repo": { + "$ref": "#/definitions/Repository" + }, + "repo_id": { + "type": "integer", + "format": "int64", + "x-go-name": "RepoID" + }, + "sha": { + "type": "string", + "x-go-name": "Sha" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Package": { + "description": "Package represents a package", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "creator": { + "$ref": "#/definitions/User" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "owner": { + "$ref": "#/definitions/User" + }, + "repository": { + "$ref": "#/definitions/Repository" + }, + "type": { + "type": "string", + "x-go-name": "Type" + }, + "version": { + "type": "string", + "x-go-name": "Version" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PackageFile": { + "description": "PackageFile represents a package file", + "type": "object", + "properties": { + "Size": { + "type": "integer", + "format": "int64" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "md5": { + "type": "string", + "x-go-name": "HashMD5" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "sha1": { + "type": "string", + "x-go-name": "HashSHA1" + }, + "sha256": { + "type": "string", + "x-go-name": "HashSHA256" + }, + "sha512": { + "type": "string", + "x-go-name": "HashSHA512" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PayloadCommit": { + "description": "PayloadCommit represents a commit", + "type": "object", + "properties": { + "added": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Added" + }, + "author": { + "$ref": "#/definitions/PayloadUser" + }, + "committer": { + "$ref": "#/definitions/PayloadUser" + }, + "id": { + "description": "sha1 hash of the commit", + "type": "string", + "x-go-name": "ID" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "modified": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Modified" + }, + "removed": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Removed" + }, + "timestamp": { + "type": "string", + "format": "date-time", + "x-go-name": "Timestamp" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "verification": { + "$ref": "#/definitions/PayloadCommitVerification" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PayloadCommitVerification": { + "description": "PayloadCommitVerification represents the GPG verification of a commit", + "type": "object", + "properties": { + "payload": { + "type": "string", + "x-go-name": "Payload" + }, + "reason": { + "type": "string", + "x-go-name": "Reason" + }, + "signature": { + "type": "string", + "x-go-name": "Signature" + }, + "signer": { + "$ref": "#/definitions/PayloadUser" + }, + "verified": { + "type": "boolean", + "x-go-name": "Verified" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PayloadUser": { + "description": "PayloadUser represents the author or committer of a commit", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "x-go-name": "Email" + }, + "name": { + "description": "Full name of the commit author", + "type": "string", + "x-go-name": "Name" + }, + "username": { + "type": "string", + "x-go-name": "UserName" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Permission": { + "description": "Permission represents a set of permissions", + "type": "object", + "properties": { + "admin": { + "type": "boolean", + "x-go-name": "Admin" + }, + "pull": { + "type": "boolean", + "x-go-name": "Pull" + }, + "push": { + "type": "boolean", + "x-go-name": "Push" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PublicKey": { + "description": "PublicKey publickey is a user key to push code to repository", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "fingerprint": { + "type": "string", + "x-go-name": "Fingerprint" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "key": { + "type": "string", + "x-go-name": "Key" + }, + "key_type": { + "type": "string", + "x-go-name": "KeyType" + }, + "read_only": { + "type": "boolean", + "x-go-name": "ReadOnly" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PullRequest": { + "description": "PullRequest represents a pull request", + "type": "object", + "properties": { + "additions": { + "type": "integer", + "format": "int64", + "x-go-name": "Additions" + }, + "allow_maintainer_edit": { + "type": "boolean", + "x-go-name": "AllowMaintainerEdit" + }, + "assignee": { + "$ref": "#/definitions/User" + }, + "assignees": { + "type": "array", + "items": { + "$ref": "#/definitions/User" + }, + "x-go-name": "Assignees" + }, + "base": { + "$ref": "#/definitions/PRBranchInfo" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "changed_files": { + "type": "integer", + "format": "int64", + "x-go-name": "ChangedFiles" + }, + "closed_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Closed" + }, + "comments": { + "type": "integer", + "format": "int64", + "x-go-name": "Comments" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "deletions": { + "type": "integer", + "format": "int64", + "x-go-name": "Deletions" + }, + "diff_url": { + "type": "string", + "x-go-name": "DiffURL" + }, + "draft": { + "type": "boolean", + "x-go-name": "Draft" + }, + "due_date": { + "type": "string", + "format": "date-time", + "x-go-name": "Deadline" + }, + "head": { + "$ref": "#/definitions/PRBranchInfo" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "is_locked": { + "type": "boolean", + "x-go-name": "IsLocked" + }, + "labels": { + "type": "array", + "items": { + "$ref": "#/definitions/Label" + }, + "x-go-name": "Labels" + }, + "merge_base": { + "type": "string", + "x-go-name": "MergeBase" + }, + "merge_commit_sha": { + "type": "string", + "x-go-name": "MergedCommitID" + }, + "mergeable": { + "type": "boolean", + "x-go-name": "Mergeable" + }, + "merged": { + "type": "boolean", + "x-go-name": "HasMerged" + }, + "merged_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Merged" + }, + "merged_by": { + "$ref": "#/definitions/User" + }, + "milestone": { + "$ref": "#/definitions/Milestone" + }, + "number": { + "type": "integer", + "format": "int64", + "x-go-name": "Index" + }, + "patch_url": { + "type": "string", + "x-go-name": "PatchURL" + }, + "pin_order": { + "type": "integer", + "format": "int64", + "x-go-name": "PinOrder" + }, + "requested_reviewers": { + "type": "array", + "items": { + "$ref": "#/definitions/User" + }, + "x-go-name": "RequestedReviewers" + }, + "review_comments": { + "description": "number of review comments made on the diff of a PR review (not including comments on commits or issues in a PR)", + "type": "integer", + "format": "int64", + "x-go-name": "ReviewComments" + }, + "state": { + "$ref": "#/definitions/StateType" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PullRequestMeta": { + "description": "PullRequestMeta PR info if an issue is a PR", + "type": "object", + "properties": { + "draft": { + "type": "boolean", + "x-go-name": "IsWorkInProgress" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "merged": { + "type": "boolean", + "x-go-name": "HasMerged" + }, + "merged_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Merged" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PullReview": { + "description": "PullReview represents a pull request review", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "comments_count": { + "type": "integer", + "format": "int64", + "x-go-name": "CodeCommentsCount" + }, + "commit_id": { + "type": "string", + "x-go-name": "CommitID" + }, + "dismissed": { + "type": "boolean", + "x-go-name": "Dismissed" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "official": { + "type": "boolean", + "x-go-name": "Official" + }, + "pull_request_url": { + "type": "string", + "x-go-name": "HTMLPullURL" + }, + "stale": { + "type": "boolean", + "x-go-name": "Stale" + }, + "state": { + "$ref": "#/definitions/ReviewStateType" + }, + "submitted_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Submitted" + }, + "team": { + "$ref": "#/definitions/Team" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PullReviewComment": { + "description": "PullReviewComment represents a comment on a pull request review", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "commit_id": { + "type": "string", + "x-go-name": "CommitID" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "diff_hunk": { + "type": "string", + "x-go-name": "DiffHunk" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "original_commit_id": { + "type": "string", + "x-go-name": "OrigCommitID" + }, + "original_position": { + "type": "integer", + "format": "uint64", + "x-go-name": "OldLineNum" + }, + "path": { + "type": "string", + "x-go-name": "Path" + }, + "position": { + "type": "integer", + "format": "uint64", + "x-go-name": "LineNum" + }, + "pull_request_review_id": { + "type": "integer", + "format": "int64", + "x-go-name": "ReviewID" + }, + "pull_request_url": { + "type": "string", + "x-go-name": "HTMLPullURL" + }, + "resolver": { + "$ref": "#/definitions/User" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PullReviewRequestOptions": { + "description": "PullReviewRequestOptions are options to add or remove pull review requests", + "type": "object", + "properties": { + "reviewers": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Reviewers" + }, + "team_reviewers": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "TeamReviewers" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "PushMirror": { + "description": "PushMirror represents information of a push mirror", + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedUnix" + }, + "interval": { + "type": "string", + "x-go-name": "Interval" + }, + "last_error": { + "type": "string", + "x-go-name": "LastError" + }, + "last_update": { + "type": "string", + "format": "date-time", + "x-go-name": "LastUpdateUnix" + }, + "remote_address": { + "type": "string", + "x-go-name": "RemoteAddress" + }, + "remote_name": { + "type": "string", + "x-go-name": "RemoteName" + }, + "repo_name": { + "type": "string", + "x-go-name": "RepoName" + }, + "sync_on_commit": { + "type": "boolean", + "x-go-name": "SyncOnCommit" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Reaction": { + "description": "Reaction contain one reaction", + "type": "object", + "properties": { + "content": { + "type": "string", + "x-go-name": "Reaction" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Reference": { + "type": "object", + "title": "Reference represents a Git reference.", + "properties": { + "object": { + "$ref": "#/definitions/GitObject" + }, + "ref": { + "type": "string", + "x-go-name": "Ref" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Release": { + "description": "Release represents a repository release", + "type": "object", + "properties": { + "archive_download_count": { + "$ref": "#/definitions/TagArchiveDownloadCount" + }, + "assets": { + "type": "array", + "items": { + "$ref": "#/definitions/Attachment" + }, + "x-go-name": "Attachments" + }, + "author": { + "$ref": "#/definitions/User" + }, + "body": { + "type": "string", + "x-go-name": "Note" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "draft": { + "type": "boolean", + "x-go-name": "IsDraft" + }, + "hide_archive_links": { + "type": "boolean", + "x-go-name": "HideArchiveLinks" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Title" + }, + "prerelease": { + "type": "boolean", + "x-go-name": "IsPrerelease" + }, + "published_at": { + "type": "string", + "format": "date-time", + "x-go-name": "PublishedAt" + }, + "tag_name": { + "type": "string", + "x-go-name": "TagName" + }, + "tarball_url": { + "type": "string", + "x-go-name": "TarURL" + }, + "target_commitish": { + "type": "string", + "x-go-name": "Target" + }, + "upload_url": { + "type": "string", + "x-go-name": "UploadURL" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "zipball_url": { + "type": "string", + "x-go-name": "ZipURL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "RenameUserOption": { + "description": "RenameUserOption options when renaming a user", + "type": "object", + "required": [ + "new_username" + ], + "properties": { + "new_username": { + "description": "New username for this user. 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" + }, + "ReplaceFlagsOption": { + "description": "ReplaceFlagsOption options when replacing the flags of a repository", + "type": "object", + "properties": { + "flags": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Flags" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "RepoCollaboratorPermission": { + "description": "RepoCollaboratorPermission to get repository permission for a collaborator", + "type": "object", + "properties": { + "permission": { + "type": "string", + "x-go-name": "Permission" + }, + "role_name": { + "type": "string", + "x-go-name": "RoleName" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "RepoCommit": { + "type": "object", + "title": "RepoCommit contains information of a commit in the context of a repository.", + "properties": { + "author": { + "$ref": "#/definitions/CommitUser" + }, + "committer": { + "$ref": "#/definitions/CommitUser" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "tree": { + "$ref": "#/definitions/CommitMeta" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "verification": { + "$ref": "#/definitions/PayloadCommitVerification" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "RepoTopicOptions": { + "description": "RepoTopicOptions a collection of repo topic names", + "type": "object", + "properties": { + "topics": { + "description": "list of topic names", + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Topics" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "RepoTransfer": { + "description": "RepoTransfer represents a pending repo transfer", + "type": "object", + "properties": { + "doer": { + "$ref": "#/definitions/User" + }, + "recipient": { + "$ref": "#/definitions/User" + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/definitions/Team" + }, + "x-go-name": "Teams" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Repository": { + "description": "Repository represents a repository", + "type": "object", + "properties": { + "allow_fast_forward_only_merge": { + "type": "boolean", + "x-go-name": "AllowFastForwardOnly" + }, + "allow_merge_commits": { + "type": "boolean", + "x-go-name": "AllowMerge" + }, + "allow_rebase": { + "type": "boolean", + "x-go-name": "AllowRebase" + }, + "allow_rebase_explicit": { + "type": "boolean", + "x-go-name": "AllowRebaseMerge" + }, + "allow_rebase_update": { + "type": "boolean", + "x-go-name": "AllowRebaseUpdate" + }, + "allow_squash_merge": { + "type": "boolean", + "x-go-name": "AllowSquash" + }, + "archived": { + "type": "boolean", + "x-go-name": "Archived" + }, + "archived_at": { + "type": "string", + "format": "date-time", + "x-go-name": "ArchivedAt" + }, + "avatar_url": { + "type": "string", + "x-go-name": "AvatarURL" + }, + "clone_url": { + "type": "string", + "x-go-name": "CloneURL" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "default_allow_maintainer_edit": { + "type": "boolean", + "x-go-name": "DefaultAllowMaintainerEdit" + }, + "default_branch": { + "type": "string", + "x-go-name": "DefaultBranch" + }, + "default_delete_branch_after_merge": { + "type": "boolean", + "x-go-name": "DefaultDeleteBranchAfterMerge" + }, + "default_merge_style": { + "type": "string", + "x-go-name": "DefaultMergeStyle" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "empty": { + "type": "boolean", + "x-go-name": "Empty" + }, + "external_tracker": { + "$ref": "#/definitions/ExternalTracker" + }, + "external_wiki": { + "$ref": "#/definitions/ExternalWiki" + }, + "fork": { + "type": "boolean", + "x-go-name": "Fork" + }, + "forks_count": { + "type": "integer", + "format": "int64", + "x-go-name": "Forks" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "globally_editable_wiki": { + "type": "boolean", + "x-go-name": "GloballyEditableWiki" + }, + "has_actions": { + "type": "boolean", + "x-go-name": "HasActions" + }, + "has_issues": { + "type": "boolean", + "x-go-name": "HasIssues" + }, + "has_packages": { + "type": "boolean", + "x-go-name": "HasPackages" + }, + "has_projects": { + "type": "boolean", + "x-go-name": "HasProjects" + }, + "has_pull_requests": { + "type": "boolean", + "x-go-name": "HasPullRequests" + }, + "has_releases": { + "type": "boolean", + "x-go-name": "HasReleases" + }, + "has_wiki": { + "type": "boolean", + "x-go-name": "HasWiki" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "ignore_whitespace_conflicts": { + "type": "boolean", + "x-go-name": "IgnoreWhitespaceConflicts" + }, + "internal": { + "type": "boolean", + "x-go-name": "Internal" + }, + "internal_tracker": { + "$ref": "#/definitions/InternalTracker" + }, + "language": { + "type": "string", + "x-go-name": "Language" + }, + "languages_url": { + "type": "string", + "x-go-name": "LanguagesURL" + }, + "link": { + "type": "string", + "x-go-name": "Link" + }, + "mirror": { + "type": "boolean", + "x-go-name": "Mirror" + }, + "mirror_interval": { + "type": "string", + "x-go-name": "MirrorInterval" + }, + "mirror_updated": { + "type": "string", + "format": "date-time", + "x-go-name": "MirrorUpdated" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "object_format_name": { + "description": "ObjectFormatName of the underlying git repository", + "type": "string", + "enum": [ + "sha1", + "sha256" + ], + "x-go-name": "ObjectFormatName" + }, + "open_issues_count": { + "type": "integer", + "format": "int64", + "x-go-name": "OpenIssues" + }, + "open_pr_counter": { + "type": "integer", + "format": "int64", + "x-go-name": "OpenPulls" + }, + "original_url": { + "type": "string", + "x-go-name": "OriginalURL" + }, + "owner": { + "$ref": "#/definitions/User" + }, + "parent": { + "$ref": "#/definitions/Repository" + }, + "permissions": { + "$ref": "#/definitions/Permission" + }, + "private": { + "type": "boolean", + "x-go-name": "Private" + }, + "release_counter": { + "type": "integer", + "format": "int64", + "x-go-name": "Releases" + }, + "repo_transfer": { + "$ref": "#/definitions/RepoTransfer" + }, + "size": { + "type": "integer", + "format": "int64", + "x-go-name": "Size" + }, + "ssh_url": { + "type": "string", + "x-go-name": "SSHURL" + }, + "stars_count": { + "type": "integer", + "format": "int64", + "x-go-name": "Stars" + }, + "template": { + "type": "boolean", + "x-go-name": "Template" + }, + "topics": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Topics" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "url": { + "type": "string", + "x-go-name": "URL" + }, + "watchers_count": { + "type": "integer", + "format": "int64", + "x-go-name": "Watchers" + }, + "website": { + "type": "string", + "x-go-name": "Website" + }, + "wiki_branch": { + "type": "string", + "x-go-name": "WikiBranch" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "RepositoryMeta": { + "description": "RepositoryMeta basic repository information", + "type": "object", + "properties": { + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "owner": { + "type": "string", + "x-go-name": "Owner" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ReviewStateType": { + "description": "ReviewStateType review state type", + "type": "string", + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "SearchResults": { + "description": "SearchResults results of a successful search", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/Repository" + }, + "x-go-name": "Data" + }, + "ok": { + "type": "boolean", + "x-go-name": "OK" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Secret": { + "description": "Secret represents a secret", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "name": { + "description": "the secret's name", + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "ServerVersion": { + "description": "ServerVersion wraps the version of the server", + "type": "object", + "properties": { + "version": { + "type": "string", + "x-go-name": "Version" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "StateType": { + "description": "StateType issue state type", + "type": "string", + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "StopWatch": { + "description": "StopWatch represent a running stopwatch", + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "duration": { + "type": "string", + "x-go-name": "Duration" + }, + "issue_index": { + "type": "integer", + "format": "int64", + "x-go-name": "IssueIndex" + }, + "issue_title": { + "type": "string", + "x-go-name": "IssueTitle" + }, + "repo_name": { + "type": "string", + "x-go-name": "RepoName" + }, + "repo_owner_name": { + "type": "string", + "x-go-name": "RepoOwnerName" + }, + "seconds": { + "type": "integer", + "format": "int64", + "x-go-name": "Seconds" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "SubmitPullReviewOptions": { + "description": "SubmitPullReviewOptions are options to submit a pending pull review", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "event": { + "$ref": "#/definitions/ReviewStateType" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Tag": { + "description": "Tag represents a repository tag", + "type": "object", + "properties": { + "archive_download_count": { + "$ref": "#/definitions/TagArchiveDownloadCount" + }, + "commit": { + "$ref": "#/definitions/CommitMeta" + }, + "id": { + "type": "string", + "x-go-name": "ID" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "tarball_url": { + "type": "string", + "x-go-name": "TarballURL" + }, + "zipball_url": { + "type": "string", + "x-go-name": "ZipballURL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "TagArchiveDownloadCount": { + "description": "TagArchiveDownloadCount counts how many times a archive was downloaded", + "type": "object", + "properties": { + "tar_gz": { + "type": "integer", + "format": "int64", + "x-go-name": "TarGz" + }, + "zip": { + "type": "integer", + "format": "int64", + "x-go-name": "Zip" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "TagProtection": { + "description": "TagProtection represents a tag protection", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "name_pattern": { + "type": "string", + "x-go-name": "NamePattern" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "whitelist_teams": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "WhitelistTeams" + }, + "whitelist_usernames": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "WhitelistUsernames" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "Team": { + "description": "Team represents a team in an organization", + "type": "object", + "properties": { + "can_create_org_repo": { + "type": "boolean", + "x-go-name": "CanCreateOrgRepo" + }, + "description": { + "type": "string", + "x-go-name": "Description" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "includes_all_repositories": { + "type": "boolean", + "x-go-name": "IncludesAllRepositories" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "organization": { + "$ref": "#/definitions/Organization" + }, + "permission": { + "type": "string", + "enum": [ + "none", + "read", + "write", + "admin", + "owner" + ], + "x-go-name": "Permission" + }, + "units": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "Units", + "example": [ + "repo.code", + "repo.issues", + "repo.ext_issues", + "repo.wiki", + "repo.pulls", + "repo.releases", + "repo.projects", + "repo.ext_wiki" + ] + }, + "units_map": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-go-name": "UnitsMap", + "example": { + "repo.code": "read", + "repo.ext_issues": "none", + "repo.ext_wiki": "none", + "repo.issues": "write", + "repo.projects": "none", + "repo.pulls": "owner", + "repo.releases": "none", + "repo.wiki": "admin" + } + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "TimeStamp": { + "description": "TimeStamp defines a timestamp", + "type": "integer", + "format": "int64", + "x-go-package": "code.gitea.io/gitea/modules/timeutil" + }, + "TimelineComment": { + "description": "TimelineComment represents a timeline comment (comment of any type) on a commit or issue", + "type": "object", + "properties": { + "assignee": { + "$ref": "#/definitions/User" + }, + "assignee_team": { + "$ref": "#/definitions/Team" + }, + "body": { + "type": "string", + "x-go-name": "Body" + }, + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "dependent_issue": { + "$ref": "#/definitions/Issue" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "issue_url": { + "type": "string", + "x-go-name": "IssueURL" + }, + "label": { + "$ref": "#/definitions/Label" + }, + "milestone": { + "$ref": "#/definitions/Milestone" + }, + "new_ref": { + "type": "string", + "x-go-name": "NewRef" + }, + "new_title": { + "type": "string", + "x-go-name": "NewTitle" + }, + "old_milestone": { + "$ref": "#/definitions/Milestone" + }, + "old_project_id": { + "type": "integer", + "format": "int64", + "x-go-name": "OldProjectID" + }, + "old_ref": { + "type": "string", + "x-go-name": "OldRef" + }, + "old_title": { + "type": "string", + "x-go-name": "OldTitle" + }, + "project_id": { + "type": "integer", + "format": "int64", + "x-go-name": "ProjectID" + }, + "pull_request_url": { + "type": "string", + "x-go-name": "PRURL" + }, + "ref_action": { + "type": "string", + "x-go-name": "RefAction" + }, + "ref_comment": { + "$ref": "#/definitions/Comment" + }, + "ref_commit_sha": { + "description": "commit SHA where issue/PR was referenced", + "type": "string", + "x-go-name": "RefCommitSHA" + }, + "ref_issue": { + "$ref": "#/definitions/Issue" + }, + "removed_assignee": { + "description": "whether the assignees were removed or added", + "type": "boolean", + "x-go-name": "RemovedAssignee" + }, + "resolve_doer": { + "$ref": "#/definitions/User" + }, + "review_id": { + "type": "integer", + "format": "int64", + "x-go-name": "ReviewID" + }, + "tracked_time": { + "$ref": "#/definitions/TrackedTime" + }, + "type": { + "type": "string", + "x-go-name": "Type" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + }, + "user": { + "$ref": "#/definitions/User" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "TopicName": { + "description": "TopicName a list of repo topic names", + "type": "object", + "properties": { + "topics": { + "type": "array", + "items": { + "type": "string" + }, + "x-go-name": "TopicNames" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "TopicResponse": { + "description": "TopicResponse for returning topics", + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "repo_count": { + "type": "integer", + "format": "int64", + "x-go-name": "RepoCount" + }, + "topic_name": { + "type": "string", + "x-go-name": "Name" + }, + "updated": { + "type": "string", + "format": "date-time", + "x-go-name": "Updated" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "TrackedTime": { + "description": "TrackedTime worked time for an issue / pr", + "type": "object", + "properties": { + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "id": { + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "issue": { + "$ref": "#/definitions/Issue" + }, + "issue_id": { + "description": "deprecated (only for backwards compatibility)", + "type": "integer", + "format": "int64", + "x-go-name": "IssueID" + }, + "time": { + "description": "Time in seconds", + "type": "integer", + "format": "int64", + "x-go-name": "Time" + }, + "user_id": { + "description": "deprecated (only for backwards compatibility)", + "type": "integer", + "format": "int64", + "x-go-name": "UserID" + }, + "user_name": { + "type": "string", + "x-go-name": "UserName" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "TransferRepoOption": { + "description": "TransferRepoOption options when transfer a repository's ownership", + "type": "object", + "required": [ + "new_owner" + ], + "properties": { + "new_owner": { + "type": "string", + "x-go-name": "NewOwner" + }, + "team_ids": { + "description": "ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.", + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "x-go-name": "TeamIDs" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "UpdateFileOptions": { + "description": "UpdateFileOptions options for updating files\nNote: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)", + "type": "object", + "required": [ + "sha", + "content" + ], + "properties": { + "author": { + "$ref": "#/definitions/Identity" + }, + "branch": { + "description": "branch (optional) to base this file from. if not given, the default branch is used", + "type": "string", + "x-go-name": "BranchName" + }, + "committer": { + "$ref": "#/definitions/Identity" + }, + "content": { + "description": "content must be base64 encoded", + "type": "string", + "x-go-name": "ContentBase64" + }, + "dates": { + "$ref": "#/definitions/CommitDateOptions" + }, + "from_path": { + "description": "from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL", + "type": "string", + "x-go-name": "FromPath" + }, + "message": { + "description": "message (optional) for the commit of this file. if not supplied, a default message will be used", + "type": "string", + "x-go-name": "Message" + }, + "new_branch": { + "description": "new_branch (optional) will make a new branch from `branch` before creating the file", + "type": "string", + "x-go-name": "NewBranchName" + }, + "sha": { + "description": "sha is the SHA for the file that already exists", + "type": "string", + "x-go-name": "SHA" + }, + "signoff": { + "description": "Add a Signed-off-by trailer by the committer at the end of the commit log message.", + "type": "boolean", + "x-go-name": "Signoff" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "UpdateRepoAvatarOption": { + "description": "UpdateRepoAvatarUserOption options when updating the repo avatar", + "type": "object", + "properties": { + "image": { + "description": "image must be base64 encoded", + "type": "string", + "x-go-name": "Image" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "UpdateUserAvatarOption": { + "description": "UpdateUserAvatarUserOption options when updating the user avatar", + "type": "object", + "properties": { + "image": { + "description": "image must be base64 encoded", + "type": "string", + "x-go-name": "Image" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "UpdateVariableOption": { + "description": "UpdateVariableOption the option when updating variable", + "type": "object", + "required": [ + "value" + ], + "properties": { + "name": { + "description": "New name for the variable. If the field is empty, the variable name won't be updated.", + "type": "string", + "x-go-name": "Name" + }, + "value": { + "description": "Value of the variable to update", + "type": "string", + "x-go-name": "Value" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "User": { + "description": "User represents a user", + "type": "object", + "properties": { + "active": { + "description": "Is user active", + "type": "boolean", + "x-go-name": "IsActive" + }, + "avatar_url": { + "description": "URL to the user's avatar", + "type": "string", + "x-go-name": "AvatarURL" + }, + "created": { + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, + "description": { + "description": "the user's description", + "type": "string", + "x-go-name": "Description" + }, + "email": { + "type": "string", + "format": "email", + "x-go-name": "Email" + }, + "followers_count": { + "description": "user counts", + "type": "integer", + "format": "int64", + "x-go-name": "Followers" + }, + "following_count": { + "type": "integer", + "format": "int64", + "x-go-name": "Following" + }, + "full_name": { + "description": "the user's full name", + "type": "string", + "x-go-name": "FullName" + }, + "html_url": { + "description": "URL to the user's gitea page", + "type": "string", + "x-go-name": "HTMLURL" + }, + "id": { + "description": "the user's id", + "type": "integer", + "format": "int64", + "x-go-name": "ID" + }, + "is_admin": { + "description": "Is the user an administrator", + "type": "boolean", + "x-go-name": "IsAdmin" + }, + "language": { + "description": "User locale", + "type": "string", + "x-go-name": "Language" + }, + "last_login": { + "type": "string", + "format": "date-time", + "x-go-name": "LastLogin" + }, + "location": { + "description": "the user's location", + "type": "string", + "x-go-name": "Location" + }, + "login": { + "description": "the user's username", + "type": "string", + "x-go-name": "UserName" + }, + "login_name": { + "description": "the user's authentication sign-in name.", + "type": "string", + "default": "empty", + "x-go-name": "LoginName" + }, + "prohibit_login": { + "description": "Is user login prohibited", + "type": "boolean", + "x-go-name": "ProhibitLogin" + }, + "pronouns": { + "description": "the user's pronouns", + "type": "string", + "x-go-name": "Pronouns" + }, + "restricted": { + "description": "Is user restricted", + "type": "boolean", + "x-go-name": "Restricted" + }, + "source_id": { + "description": "The ID of the user's Authentication Source", + "type": "integer", + "format": "int64", + "x-go-name": "SourceID" + }, + "starred_repos_count": { + "type": "integer", + "format": "int64", + "x-go-name": "StarredRepos" + }, + "visibility": { + "description": "User visibility level option: public, limited, private", + "type": "string", + "x-go-name": "Visibility" + }, + "website": { + "description": "the user's website", + "type": "string", + "x-go-name": "Website" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "UserHeatmapData": { + "description": "UserHeatmapData represents the data needed to create a heatmap", + "type": "object", + "properties": { + "contributions": { + "type": "integer", + "format": "int64", + "x-go-name": "Contributions" + }, + "timestamp": { + "$ref": "#/definitions/TimeStamp" + } + }, + "x-go-package": "code.gitea.io/gitea/models/activities" + }, + "UserSettings": { + "description": "UserSettings represents user settings", + "type": "object", + "properties": { + "description": { + "type": "string", + "x-go-name": "Description" + }, + "diff_view_style": { + "type": "string", + "x-go-name": "DiffViewStyle" + }, + "enable_repo_unit_hints": { + "type": "boolean", + "x-go-name": "EnableRepoUnitHints" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "hide_activity": { + "type": "boolean", + "x-go-name": "HideActivity" + }, + "hide_email": { + "description": "Privacy", + "type": "boolean", + "x-go-name": "HideEmail" + }, + "language": { + "type": "string", + "x-go-name": "Language" + }, + "location": { + "type": "string", + "x-go-name": "Location" + }, + "pronouns": { + "type": "string", + "x-go-name": "Pronouns" + }, + "theme": { + "type": "string", + "x-go-name": "Theme" + }, + "website": { + "type": "string", + "x-go-name": "Website" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "UserSettingsOptions": { + "description": "UserSettingsOptions represents options to change user settings", + "type": "object", + "properties": { + "description": { + "type": "string", + "x-go-name": "Description" + }, + "diff_view_style": { + "type": "string", + "x-go-name": "DiffViewStyle" + }, + "enable_repo_unit_hints": { + "type": "boolean", + "x-go-name": "EnableRepoUnitHints" + }, + "full_name": { + "type": "string", + "x-go-name": "FullName" + }, + "hide_activity": { + "type": "boolean", + "x-go-name": "HideActivity" + }, + "hide_email": { + "description": "Privacy", + "type": "boolean", + "x-go-name": "HideEmail" + }, + "language": { + "type": "string", + "x-go-name": "Language" + }, + "location": { + "type": "string", + "x-go-name": "Location" + }, + "pronouns": { + "type": "string", + "x-go-name": "Pronouns" + }, + "theme": { + "type": "string", + "x-go-name": "Theme" + }, + "website": { + "type": "string", + "x-go-name": "Website" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "WatchInfo": { + "description": "WatchInfo represents an API watch status of one repository", + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "x-go-name": "CreatedAt" + }, + "ignored": { + "type": "boolean", + "x-go-name": "Ignored" + }, + "reason": { + "x-go-name": "Reason" + }, + "repository_url": { + "type": "string", + "x-go-name": "RepositoryURL" + }, + "subscribed": { + "type": "boolean", + "x-go-name": "Subscribed" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "WikiCommit": { + "description": "WikiCommit page commit/revision", + "type": "object", + "properties": { + "author": { + "$ref": "#/definitions/CommitUser" + }, + "commiter": { + "$ref": "#/definitions/CommitUser" + }, + "message": { + "type": "string", + "x-go-name": "Message" + }, + "sha": { + "type": "string", + "x-go-name": "ID" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "WikiCommitList": { + "description": "WikiCommitList commit/revision list", + "type": "object", + "properties": { + "commits": { + "type": "array", + "items": { + "$ref": "#/definitions/WikiCommit" + }, + "x-go-name": "WikiCommits" + }, + "count": { + "type": "integer", + "format": "int64", + "x-go-name": "Count" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "WikiPage": { + "description": "WikiPage a wiki page", + "type": "object", + "properties": { + "commit_count": { + "type": "integer", + "format": "int64", + "x-go-name": "CommitCount" + }, + "content_base64": { + "description": "Page content, base64 encoded", + "type": "string", + "x-go-name": "ContentBase64" + }, + "footer": { + "type": "string", + "x-go-name": "Footer" + }, + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "last_commit": { + "$ref": "#/definitions/WikiCommit" + }, + "sidebar": { + "type": "string", + "x-go-name": "Sidebar" + }, + "sub_url": { + "type": "string", + "x-go-name": "SubURL" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "WikiPageMetaData": { + "description": "WikiPageMetaData wiki page meta information", + "type": "object", + "properties": { + "html_url": { + "type": "string", + "x-go-name": "HTMLURL" + }, + "last_commit": { + "$ref": "#/definitions/WikiCommit" + }, + "sub_url": { + "type": "string", + "x-go-name": "SubURL" + }, + "title": { + "type": "string", + "x-go-name": "Title" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + } + }, + "responses": { + "AccessToken": { + "description": "AccessToken represents an API access token.", + "schema": { + "$ref": "#/definitions/AccessToken" + } + }, + "AccessTokenList": { + "description": "AccessTokenList represents a list of API access token.", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/AccessToken" + } + } + }, + "ActionVariable": { + "description": "ActionVariable", + "schema": { + "$ref": "#/definitions/ActionVariable" + } + }, + "ActivityFeedsList": { + "description": "ActivityFeedsList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Activity" + } + } + }, + "ActivityPub": { + "description": "ActivityPub", + "schema": { + "$ref": "#/definitions/ActivityPub" + } + }, + "AnnotatedTag": { + "description": "AnnotatedTag", + "schema": { + "$ref": "#/definitions/AnnotatedTag" + } + }, + "Attachment": { + "description": "Attachment", + "schema": { + "$ref": "#/definitions/Attachment" + } + }, + "AttachmentList": { + "description": "AttachmentList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Attachment" + } + } + }, + "BlockedUserList": { + "description": "BlockedUserList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/BlockedUser" + } + } + }, + "Branch": { + "description": "Branch", + "schema": { + "$ref": "#/definitions/Branch" + } + }, + "BranchList": { + "description": "BranchList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Branch" + } + } + }, + "BranchProtection": { + "description": "BranchProtection", + "schema": { + "$ref": "#/definitions/BranchProtection" + } + }, + "BranchProtectionList": { + "description": "BranchProtectionList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/BranchProtection" + } + } + }, + "ChangedFileList": { + "description": "ChangedFileList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ChangedFile" + } + }, + "headers": { + "X-HasMore": { + "type": "boolean", + "description": "True if there is another page" + }, + "X-Page": { + "type": "integer", + "format": "int64", + "description": "The current page" + }, + "X-PageCount": { + "type": "integer", + "format": "int64", + "description": "Total number of pages" + }, + "X-PerPage": { + "type": "integer", + "format": "int64", + "description": "Commits per page" + }, + "X-Total-Count": { + "type": "integer", + "format": "int64", + "description": "Total commit count" + } + } + }, + "CombinedStatus": { + "description": "CombinedStatus", + "schema": { + "$ref": "#/definitions/CombinedStatus" + } + }, + "Comment": { + "description": "Comment", + "schema": { + "$ref": "#/definitions/Comment" + } + }, + "CommentList": { + "description": "CommentList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Comment" + } + } + }, + "Commit": { + "description": "Commit", + "schema": { + "$ref": "#/definitions/Commit" + } + }, + "CommitList": { + "description": "CommitList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Commit" + } + }, + "headers": { + "X-HasMore": { + "type": "boolean", + "description": "True if there is another page" + }, + "X-Page": { + "type": "integer", + "format": "int64", + "description": "The current page" + }, + "X-PageCount": { + "type": "integer", + "format": "int64", + "description": "Total number of pages" + }, + "X-PerPage": { + "type": "integer", + "format": "int64", + "description": "Commits per page" + }, + "X-Total": { + "type": "integer", + "format": "int64", + "description": "Total commit count" + } + } + }, + "CommitStatus": { + "description": "CommitStatus", + "schema": { + "$ref": "#/definitions/CommitStatus" + } + }, + "CommitStatusList": { + "description": "CommitStatusList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/CommitStatus" + } + } + }, + "Compare": { + "description": "", + "schema": { + "$ref": "#/definitions/Compare" + } + }, + "ContentsListResponse": { + "description": "ContentsListResponse", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ContentsResponse" + } + } + }, + "ContentsResponse": { + "description": "ContentsResponse", + "schema": { + "$ref": "#/definitions/ContentsResponse" + } + }, + "CronList": { + "description": "CronList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Cron" + } + } + }, + "DeployKey": { + "description": "DeployKey", + "schema": { + "$ref": "#/definitions/DeployKey" + } + }, + "DeployKeyList": { + "description": "DeployKeyList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/DeployKey" + } + } + }, + "EmailList": { + "description": "EmailList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Email" + } + } + }, + "EmptyRepository": { + "description": "EmptyRepository", + "schema": { + "$ref": "#/definitions/APIError" + } + }, + "FileDeleteResponse": { + "description": "FileDeleteResponse", + "schema": { + "$ref": "#/definitions/FileDeleteResponse" + } + }, + "FileResponse": { + "description": "FileResponse", + "schema": { + "$ref": "#/definitions/FileResponse" + } + }, + "FilesResponse": { + "description": "FilesResponse", + "schema": { + "$ref": "#/definitions/FilesResponse" + } + }, + "GPGKey": { + "description": "GPGKey", + "schema": { + "$ref": "#/definitions/GPGKey" + } + }, + "GPGKeyList": { + "description": "GPGKeyList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/GPGKey" + } + } + }, + "GeneralAPISettings": { + "description": "GeneralAPISettings", + "schema": { + "$ref": "#/definitions/GeneralAPISettings" + } + }, + "GeneralAttachmentSettings": { + "description": "GeneralAttachmentSettings", + "schema": { + "$ref": "#/definitions/GeneralAttachmentSettings" + } + }, + "GeneralRepoSettings": { + "description": "GeneralRepoSettings", + "schema": { + "$ref": "#/definitions/GeneralRepoSettings" + } + }, + "GeneralUISettings": { + "description": "GeneralUISettings", + "schema": { + "$ref": "#/definitions/GeneralUISettings" + } + }, + "GitBlobResponse": { + "description": "GitBlobResponse", + "schema": { + "$ref": "#/definitions/GitBlobResponse" + } + }, + "GitHook": { + "description": "GitHook", + "schema": { + "$ref": "#/definitions/GitHook" + } + }, + "GitHookList": { + "description": "GitHookList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/GitHook" + } + } + }, + "GitTreeResponse": { + "description": "GitTreeResponse", + "schema": { + "$ref": "#/definitions/GitTreeResponse" + } + }, + "GitignoreTemplateInfo": { + "description": "GitignoreTemplateInfo", + "schema": { + "$ref": "#/definitions/GitignoreTemplateInfo" + } + }, + "GitignoreTemplateList": { + "description": "GitignoreTemplateList", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Hook": { + "description": "Hook", + "schema": { + "$ref": "#/definitions/Hook" + } + }, + "HookList": { + "description": "HookList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Hook" + } + } + }, + "Issue": { + "description": "Issue", + "schema": { + "$ref": "#/definitions/Issue" + } + }, + "IssueDeadline": { + "description": "IssueDeadline", + "schema": { + "$ref": "#/definitions/IssueDeadline" + } + }, + "IssueList": { + "description": "IssueList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Issue" + } + } + }, + "IssueTemplates": { + "description": "IssueTemplates", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/IssueTemplate" + } + } + }, + "Label": { + "description": "Label", + "schema": { + "$ref": "#/definitions/Label" + } + }, + "LabelList": { + "description": "LabelList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Label" + } + } + }, + "LabelTemplateInfo": { + "description": "LabelTemplateInfo", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/LabelTemplate" + } + } + }, + "LabelTemplateList": { + "description": "LabelTemplateList", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "LanguageStatistics": { + "description": "LanguageStatistics", + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int64" + } + } + }, + "LicenseTemplateInfo": { + "description": "LicenseTemplateInfo", + "schema": { + "$ref": "#/definitions/LicenseTemplateInfo" + } + }, + "LicenseTemplateList": { + "description": "LicenseTemplateList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/LicensesTemplateListEntry" + } + } + }, + "MarkdownRender": { + "description": "MarkdownRender is a rendered markdown document", + "schema": { + "type": "string" + } + }, + "MarkupRender": { + "description": "MarkupRender is a rendered markup document", + "schema": { + "type": "string" + } + }, + "Milestone": { + "description": "Milestone", + "schema": { + "$ref": "#/definitions/Milestone" + } + }, + "MilestoneList": { + "description": "MilestoneList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Milestone" + } + } + }, + "NodeInfo": { + "description": "NodeInfo", + "schema": { + "$ref": "#/definitions/NodeInfo" + } + }, + "Note": { + "description": "Note", + "schema": { + "$ref": "#/definitions/Note" + } + }, + "NotificationCount": { + "description": "Number of unread notifications", + "schema": { + "$ref": "#/definitions/NotificationCount" + } + }, + "NotificationThread": { + "description": "NotificationThread", + "schema": { + "$ref": "#/definitions/NotificationThread" + } + }, + "NotificationThreadList": { + "description": "NotificationThreadList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/NotificationThread" + } + } + }, + "OAuth2Application": { + "description": "OAuth2Application", + "schema": { + "$ref": "#/definitions/OAuth2Application" + } + }, + "OAuth2ApplicationList": { + "description": "OAuth2ApplicationList represents a list of OAuth2 applications.", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/OAuth2Application" + } + } + }, + "Organization": { + "description": "Organization", + "schema": { + "$ref": "#/definitions/Organization" + } + }, + "OrganizationList": { + "description": "OrganizationList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Organization" + } + } + }, + "OrganizationPermissions": { + "description": "OrganizationPermissions", + "schema": { + "$ref": "#/definitions/OrganizationPermissions" + } + }, + "Package": { + "description": "Package", + "schema": { + "$ref": "#/definitions/Package" + } + }, + "PackageFileList": { + "description": "PackageFileList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/PackageFile" + } + } + }, + "PackageList": { + "description": "PackageList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Package" + } + } + }, + "PublicKey": { + "description": "PublicKey", + "schema": { + "$ref": "#/definitions/PublicKey" + } + }, + "PublicKeyList": { + "description": "PublicKeyList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/PublicKey" + } + } + }, + "PullRequest": { + "description": "PullRequest", + "schema": { + "$ref": "#/definitions/PullRequest" + } + }, + "PullRequestList": { + "description": "PullRequestList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/PullRequest" + } + } + }, + "PullReview": { + "description": "PullReview", + "schema": { + "$ref": "#/definitions/PullReview" + } + }, + "PullReviewComment": { + "description": "PullComment", + "schema": { + "$ref": "#/definitions/PullReviewComment" + } + }, + "PullReviewCommentList": { + "description": "PullCommentList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/PullReviewComment" + } + } + }, + "PullReviewList": { + "description": "PullReviewList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/PullReview" + } + } + }, + "PushMirror": { + "description": "PushMirror", + "schema": { + "$ref": "#/definitions/PushMirror" + } + }, + "PushMirrorList": { + "description": "PushMirrorList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/PushMirror" + } + } + }, + "Reaction": { + "description": "Reaction", + "schema": { + "$ref": "#/definitions/Reaction" + } + }, + "ReactionList": { + "description": "ReactionList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Reaction" + } + } + }, + "Reference": { + "description": "Reference", + "schema": { + "$ref": "#/definitions/Reference" + } + }, + "ReferenceList": { + "description": "ReferenceList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Reference" + } + } + }, + "RegistrationToken": { + "description": "RegistrationToken is a string used to register a runner with a server", + "headers": { + "token": { + "type": "string" + } + } + }, + "Release": { + "description": "Release", + "schema": { + "$ref": "#/definitions/Release" + } + }, + "ReleaseList": { + "description": "ReleaseList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Release" + } + } + }, + "RepoCollaboratorPermission": { + "description": "RepoCollaboratorPermission", + "schema": { + "$ref": "#/definitions/RepoCollaboratorPermission" + } + }, + "RepoIssueConfig": { + "description": "RepoIssueConfig", + "schema": { + "$ref": "#/definitions/IssueConfig" + } + }, + "RepoIssueConfigValidation": { + "description": "RepoIssueConfigValidation", + "schema": { + "$ref": "#/definitions/IssueConfigValidation" + } + }, + "RepoNewIssuePinsAllowed": { + "description": "RepoNewIssuePinsAllowed", + "schema": { + "$ref": "#/definitions/NewIssuePinsAllowed" + } + }, + "Repository": { + "description": "Repository", + "schema": { + "$ref": "#/definitions/Repository" + } + }, + "RepositoryList": { + "description": "RepositoryList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Repository" + } + } + }, + "SearchResults": { + "description": "SearchResults", + "schema": { + "$ref": "#/definitions/SearchResults" + } + }, + "Secret": { + "description": "Secret", + "schema": { + "$ref": "#/definitions/Secret" + } + }, + "SecretList": { + "description": "SecretList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Secret" + } + } + }, + "ServerVersion": { + "description": "ServerVersion", + "schema": { + "$ref": "#/definitions/ServerVersion" + } + }, + "StopWatch": { + "description": "StopWatch", + "schema": { + "$ref": "#/definitions/StopWatch" + } + }, + "StopWatchList": { + "description": "StopWatchList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/StopWatch" + } + } + }, + "StringSlice": { + "description": "StringSlice", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "Tag": { + "description": "Tag", + "schema": { + "$ref": "#/definitions/Tag" + } + }, + "TagList": { + "description": "TagList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Tag" + } + } + }, + "TagProtection": { + "description": "TagProtection", + "schema": { + "$ref": "#/definitions/TagProtection" + } + }, + "TagProtectionList": { + "description": "TagProtectionList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TagProtection" + } + } + }, + "TasksList": { + "description": "TasksList", + "schema": { + "$ref": "#/definitions/ActionTaskResponse" + } + }, + "Team": { + "description": "Team", + "schema": { + "$ref": "#/definitions/Team" + } + }, + "TeamList": { + "description": "TeamList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/Team" + } + } + }, + "TimelineList": { + "description": "TimelineList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TimelineComment" + } + } + }, + "TopicListResponse": { + "description": "TopicListResponse", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TopicResponse" + } + } + }, + "TopicNames": { + "description": "TopicNames", + "schema": { + "$ref": "#/definitions/TopicName" + } + }, + "TrackedTime": { + "description": "TrackedTime", + "schema": { + "$ref": "#/definitions/TrackedTime" + } + }, + "TrackedTimeList": { + "description": "TrackedTimeList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/TrackedTime" + } + } + }, + "User": { + "description": "User", + "schema": { + "$ref": "#/definitions/User" + } + }, + "UserHeatmapData": { + "description": "UserHeatmapData", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/UserHeatmapData" + } + } + }, + "UserList": { + "description": "UserList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/User" + } + } + }, + "UserSettings": { + "description": "UserSettings", + "schema": { + "$ref": "#/definitions/UserSettings" + } + }, + "VariableList": { + "description": "VariableList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionVariable" + } + } + }, + "WatchInfo": { + "description": "WatchInfo", + "schema": { + "$ref": "#/definitions/WatchInfo" + } + }, + "WikiCommitList": { + "description": "WikiCommitList", + "schema": { + "$ref": "#/definitions/WikiCommitList" + } + }, + "WikiPage": { + "description": "WikiPage", + "schema": { + "$ref": "#/definitions/WikiPage" + } + }, + "WikiPageList": { + "description": "WikiPageList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/WikiPageMetaData" + } + } + }, + "conflict": { + "description": "APIConflict is a conflict empty response" + }, + "empty": { + "description": "APIEmpty is an empty response" + }, + "error": { + "description": "APIError is error format response", + "headers": { + "message": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "forbidden": { + "description": "APIForbiddenError is a forbidden error response", + "headers": { + "message": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "invalidTopicsError": { + "description": "APIInvalidTopicsError is error format response to invalid topics", + "headers": { + "invalidTopics": { + "type": "array", + "items": { + "type": "string" + } + }, + "message": { + "type": "string" + } + } + }, + "notFound": { + "description": "APINotFound is a not found empty response" + }, + "parameterBodies": { + "description": "parameterBodies", + "schema": { + "$ref": "#/definitions/DispatchWorkflowOption" + } + }, + "redirect": { + "description": "APIRedirect is a redirect response" + }, + "repoArchivedError": { + "description": "APIRepoArchivedError is an error that is raised when an archived repo should be modified", + "headers": { + "message": { + "type": "string" + }, + "url": { + "type": "string" + } + } + }, + "string": { + "description": "APIString is a string response", + "schema": { + "type": "string" + } + }, + "validationError": { + "description": "APIValidationError is error format response related to input validation", + "headers": { + "message": { + "type": "string" + }, + "url": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "AccessToken": { + "description": "This authentication option is deprecated for removal in Gitea 1.23. Please use AuthorizationHeaderToken instead.", + "type": "apiKey", + "name": "access_token", + "in": "query" + }, + "AuthorizationHeaderToken": { + "description": "API tokens must be prepended with \"token\" followed by a space.", + "type": "apiKey", + "name": "Authorization", + "in": "header" + }, + "BasicAuth": { + "type": "basic" + }, + "SudoHeader": { + "description": "Sudo API request as the user provided as the key. Admin privileges are required.", + "type": "apiKey", + "name": "Sudo", + "in": "header" + }, + "SudoParam": { + "description": "Sudo API request as the user provided as the key. Admin privileges are required.", + "type": "apiKey", + "name": "sudo", + "in": "query" + }, + "TOTPHeader": { + "description": "Must be used in combination with BasicAuth if two-factor authentication is enabled.", + "type": "apiKey", + "name": "X-FORGEJO-OTP", + "in": "header" + }, + "Token": { + "description": "This authentication option is deprecated for removal in Gitea 1.23. Please use AuthorizationHeaderToken instead.", + "type": "apiKey", + "name": "token", + "in": "query" + } + }, + "security": [ + { + "BasicAuth": [] + }, + { + "Token": [] + }, + { + "AccessToken": [] + }, + { + "AuthorizationHeaderToken": [] + }, + { + "SudoParam": [] + }, + { + "SudoHeader": [] + }, + { + "TOTPHeader": [] + } + ] +} diff --git a/templates/user/auth/activate.tmpl b/templates/user/auth/activate.tmpl new file mode 100644 index 00000000..9ae811bf --- /dev/null +++ b/templates/user/auth/activate.tmpl @@ -0,0 +1,61 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user activate"> + <div class="ui middle very relaxed page grid"> + <div class="column"> + <form class="ui form ignore-dirty tw-max-w-2xl tw-m-auto" action="{{AppSubUrl}}/user/activate" method="post"> + {{.CsrfTokenHtml}} + <h2 class="ui top attached header"> + {{ctx.Locale.Tr "auth.active_your_account"}} + </h2> + <div class="ui attached segment"> + {{template "base/alert" .}} + {{if .IsActivatePage}} + {{if .ServiceNotEnabled}} + <p class="center">{{ctx.Locale.Tr "auth.disable_register_mail"}}</p> + {{else if .ResendLimited}} + <p class="center">{{ctx.Locale.Tr "auth.resent_limit_prompt"}}</p> + {{else}} + <p>{{ctx.Locale.Tr "auth.confirmation_mail_sent_prompt" .SignedUser.Email .ActiveCodeLives}}</p> + {{end}} + {{else}} + {{if .NeedsPassword}} + <div class="required field"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" autocomplete="off" required> + </div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "install.confirm_password"}}</button> + </div> + <input id="code" name="code" type="hidden" value="{{.Code}}"> + {{else if .IsSendRegisterMail}} + <p>{{ctx.Locale.Tr "auth.confirmation_mail_sent_prompt" .Email .ActiveCodeLives}}</p> + {{else if .IsCodeInvalid}} + <p>{{ctx.Locale.Tr "auth.invalid_code"}}</p> + {{else if .IsPasswordInvalid}} + <p>{{ctx.Locale.Tr "auth.invalid_password"}}</p> + {{else if .ManualActivationOnly}} + <p class="center">{{ctx.Locale.Tr "auth.manual_activation_only"}}</p> + {{else}} + <p>{{ctx.Locale.Tr "auth.has_unconfirmed_mail" .SignedUser.Name .SignedUser.Email}}</p> + <div class="divider"></div> + <details class="inline field"> + <summary>{{ctx.Locale.Tr "auth.change_unconfirmed_email_summary"}}</summary> + + <p>{{ctx.Locale.Tr "auth.change_unconfirmed_email"}}</p> + <div class="inline field"> + <label for="email">{{ctx.Locale.Tr "email"}}</label> + <input id="email" name="email" type="email" autocomplete="on"> + </div> + </details> + + <div class="text"> + <button class="ui primary button">{{ctx.Locale.Tr "auth.resend_mail"}}</button> + </div> + {{end}} + {{end}} + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/captcha.tmpl b/templates/user/auth/captcha.tmpl new file mode 100644 index 00000000..0e9c2b9d --- /dev/null +++ b/templates/user/auth/captcha.tmpl @@ -0,0 +1,30 @@ +{{if .EnableCaptcha}}{{if eq .CaptchaType "image"}} + <div class="inline field"> + {{.Captcha.CreateHTML}} + </div> + <div class="required field {{if .Err_Captcha}}error{{end}}"> + <label for="captcha">{{ctx.Locale.Tr "captcha"}}</label> + <input id="captcha" name="captcha" value="{{.captcha}}" autocomplete="off"> + </div> +{{else if eq .CaptchaType "recaptcha"}} + <div class="inline field 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> +{{else if eq .CaptchaType "hcaptcha"}} + <div class="inline field 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> +{{else if eq .CaptchaType "mcaptcha"}} + <div class="inline field"> + <label></label> + <div class="m-captcha-style" id="mcaptcha__widget-container"></div> + <div id="captcha" data-captcha-type="m-captcha" data-sitekey="{{.McaptchaSitekey}}" data-instance-url="{{.McaptchaURL}}"></div> + </div> +{{else if eq .CaptchaType "cfturnstile"}} + <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> +{{end}}{{end}} diff --git a/templates/user/auth/change_passwd.tmpl b/templates/user/auth/change_passwd.tmpl new file mode 100644 index 00000000..e05f46fa --- /dev/null +++ b/templates/user/auth/change_passwd.tmpl @@ -0,0 +1,7 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user signin{{if .LinkAccountMode}} icon{{end}}"> + <div class="ui container"> + {{template "user/auth/change_passwd_inner" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/change_passwd_inner.tmpl b/templates/user/auth/change_passwd_inner.tmpl new file mode 100644 index 00000000..601f0365 --- /dev/null +++ b/templates/user/auth/change_passwd_inner.tmpl @@ -0,0 +1,22 @@ + {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}} + {{template "base/alert" .}} + {{end}} + <h4 class="ui top attached header center"> + {{ctx.Locale.Tr "settings.update_password"}} + </h4> + <div class="ui attached segment"> + <form class="ui form tw-max-w-2xl tw-m-auto" action="{{.ChangePasscodeLink}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" required> + </div> + <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}"> + <label for="retype">{{ctx.Locale.Tr "re_type"}}</label> + <input id="retype" name="retype" type="password" autocomplete="new-password" required> + </div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_password"}}</button> + </div> + </form> + </div> diff --git a/templates/user/auth/finalize_openid.tmpl b/templates/user/auth/finalize_openid.tmpl new file mode 100644 index 00000000..1c1dcdb8 --- /dev/null +++ b/templates/user/auth/finalize_openid.tmpl @@ -0,0 +1,47 @@ +{{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/forgot_passwd.tmpl b/templates/user/auth/forgot_passwd.tmpl new file mode 100644 index 00000000..55bcf630 --- /dev/null +++ b/templates/user/auth/forgot_passwd.tmpl @@ -0,0 +1,39 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user forgot password"> + <div class="ui middle very relaxed page grid"> + <div class="column"> + <form class="ui form ignore-dirty" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <h2 class="ui top attached header"> + {{ctx.Locale.Tr "auth.forgot_password_title"}} + </h2> + <div class="ui attached segment"> + {{template "base/alert" .}} + {{if .IsResetSent}} + <p>{{ctx.Locale.Tr "auth.reset_password_mail_sent_prompt" .Email .ResetPwdCodeLives}}</p> + {{else if .IsResetRequest}} + <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="{{.Email}}" autofocus required> + </div> + <div class="divider"></div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "auth.send_reset_mail"}}</button> + </div> + {{else if .IsResetDisable}} + <p class="center"> + {{if $.IsAdmin}} + {{ctx.Locale.Tr "auth.disable_forgot_password_mail_admin"}} + {{else}} + {{ctx.Locale.Tr "auth.disable_forgot_password_mail"}} + {{end}} + </p> + {{else if .ResendLimited}} + <p class="center">{{ctx.Locale.Tr "auth.resent_limit_prompt"}}</p> + {{end}} + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/grant.tmpl b/templates/user/auth/grant.tmpl new file mode 100644 index 00000000..a18a3bd2 --- /dev/null +++ b/templates/user/auth/grant.tmpl @@ -0,0 +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> + <b>{{ctx.Locale.Tr "auth.authorize_application_description"}}</b><br> + {{ctx.Locale.Tr "auth.authorize_application_created_by" .ApplicationCreatorLinkHTML}} + </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> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/grant_error.tmpl b/templates/user/auth/grant_error.tmpl new file mode 100644 index 00000000..b2e07796 --- /dev/null +++ b/templates/user/auth/grant_error.tmpl @@ -0,0 +1,16 @@ +{{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> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/link_account.tmpl b/templates/user/auth/link_account.tmpl new file mode 100644 index 00000000..8dd49ccd --- /dev/null +++ b/templates/user/auth/link_account.tmpl @@ -0,0 +1,34 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user link-account"> + <overflow-menu class="ui secondary pointing tabular top attached borderless menu secondary-nav"> + <div class="overflow-menu-items tw-justify-center"> + <!-- TODO handle .ShowRegistrationButton once other login bugs are fixed --> + {{if not .AllowOnlyInternalRegistration}} + <a class="item {{if not .user_exists}}active{{end}}" + data-tab="auth-link-signup-tab"> + {{ctx.Locale.Tr "auth.oauth_signup_tab"}} + </a> + {{end}} + <a class="item {{if .user_exists}}active{{end}}" + data-tab="auth-link-signin-tab"> + {{ctx.Locale.Tr "auth.oauth_signin_tab"}} + </a> + </div> + </overflow-menu> + <div class="ui middle very relaxed page grid"> + <div class="column"> + <div class="ui tab {{if not .user_exists}}active{{end}}" + data-tab="auth-link-signup-tab"> + {{template "user/auth/signup_inner" .}} + </div> + <div class="ui tab {{if .user_exists}}active{{end}}" + data-tab="auth-link-signin-tab"> + <div class="ui user signin container icon"> + {{template "user/auth/signin_inner" .}} + </div> + </div> + </div> + </div> +</div> + +{{template "base/footer" .}} diff --git a/templates/user/auth/oidc_wellknown.tmpl b/templates/user/auth/oidc_wellknown.tmpl new file mode 100644 index 00000000..54bb4a76 --- /dev/null +++ b/templates/user/auth/oidc_wellknown.tmpl @@ -0,0 +1,49 @@ +{ + "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", + "response_types_supported": [ + "code", + "id_token" + ], + "id_token_signing_alg_values_supported": [ + "{{.SigningKey.SigningMethod.Alg | JSEscape}}" + ], + "subject_types_supported": [ + "public" + ], + "scopes_supported": [ + "openid", + "profile", + "email", + "groups" + ], + "claims_supported": [ + "aud", + "exp", + "iat", + "iss", + "sub", + "name", + "preferred_username", + "profile", + "picture", + "website", + "locale", + "updated_at", + "email", + "email_verified", + "groups" + ], + "code_challenge_methods_supported": [ + "plain", + "S256" + ], + "grant_types_supported": [ + "authorization_code", + "refresh_token" + ] +} diff --git a/templates/user/auth/prohibit_login.tmpl b/templates/user/auth/prohibit_login.tmpl new file mode 100644 index 00000000..962ddfa9 --- /dev/null +++ b/templates/user/auth/prohibit_login.tmpl @@ -0,0 +1,16 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user activate"> + <div class="ui middle very relaxed page grid"> + <div class="column"> + <form class="ui form tw-max-w-2xl tw-m-auto"> + <h2 class="ui top attached header"> + {{ctx.Locale.Tr "auth.prohibit_login"}} + </h2> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "auth.prohibit_login_desc"}}</p> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/reset_passwd.tmpl b/templates/user/auth/reset_passwd.tmpl new file mode 100644 index 00000000..f8303fee --- /dev/null +++ b/templates/user/auth/reset_passwd.tmpl @@ -0,0 +1,65 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user reset password"> + <div class="ui middle very relaxed page grid"> + <div class="column"> + <form class="ui form ignore-dirty" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input name="code" type="hidden" value="{{.Code}}"> + <h2 class="ui top attached header"> + {{ctx.Locale.Tr "auth.reset_password"}} + </h2> + <div class="ui attached segment"> + {{template "base/alert" .}} + {{if .user_email}} + <div class="inline field"> + <label for="user_name">{{ctx.Locale.Tr "email"}}</label> + <input id="user_name" type="text" value="{{.user_email}}" disabled> + </div> + {{end}} + {{if .IsResetForm}} + <div class="required field {{if .Err_Password}}error{{end}}"> + <label for="password">{{ctx.Locale.Tr "settings.new_password"}}</label> + <input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" autofocus required> + </div> + {{if not .user_signed_in}} + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "auth.remember_me"}}</label> + <input name="remember" type="checkbox"> + </div> + </div> + {{end}} + {{if .has_two_factor}} + <h4 class="ui dividing header"> + {{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}} + {{end}} + <div class="divider"></div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "auth.reset_password_helper"}}</button> + {{if and .has_two_factor (not .scratch_code)}} + <a href="?code={{.Code}}&scratch_code=true">{{ctx.Locale.Tr "auth.use_scratch_code"}}</a> + {{end}} + </div> + {{else}} + <p class="center">{{ctx.Locale.Tr "auth.invalid_code_forgot_password" (printf "%s/user/forgot_password" AppSubUrl)}}</p> + {{end}} + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/signin.tmpl b/templates/user/auth/signin.tmpl new file mode 100644 index 00000000..b0e9ce8c --- /dev/null +++ b/templates/user/auth/signin.tmpl @@ -0,0 +1,10 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user signin{{if .LinkAccountMode}} icon{{end}}"> + {{template "user/auth/signin_navbar" .}} + <div class="ui middle very relaxed page grid"> + <div class="ui container column fluid"> + {{template "user/auth/signin_inner" .}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl new file mode 100644 index 00000000..9872096f --- /dev/null +++ b/templates/user/auth/signin_inner.tmpl @@ -0,0 +1,70 @@ +{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}} +{{template "base/alert" .}} +{{end}} +<h4 class="ui top attached header center"> + {{if .LinkAccountMode}} + {{ctx.Locale.Tr "auth.oauth_signin_title"}} + {{else}} + {{ctx.Locale.Tr "auth.login_userpass"}} + {{end}} +</h4> +<div class="ui attached segment"> + <form class="ui form tw-max-w-2xl tw-m-auto" action="{{.SignInLink}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}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> + {{if or (not .DisablePassword) .LinkAccountMode}} + <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" value="{{.password}}" autocomplete="current-password" required> + </div> + {{end}} + {{if not .LinkAccountMode}} + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "auth.remember_me"}}</label> + <input name="remember" type="checkbox"> + </div> + </div> + {{end}} + + {{template "user/auth/captcha" .}} + + <div class="field"> + <button class="ui primary button"> + {{if .LinkAccountMode}} + {{ctx.Locale.Tr "auth.oauth_signin_submit"}} + {{else}} + {{ctx.Locale.Tr "sign_in"}} + {{end}} + </button> + <a href="{{AppSubUrl}}/user/forgot_password">{{ctx.Locale.Tr "auth.forgot_password"}}</a> + </div> + + {{if .ShowRegistrationButton}} + <div class="field"> + <a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now"}}</a> + </div> + {{end}} + + {{if .OAuth2Providers}} + <div class="divider divider-text"> + {{ctx.Locale.Tr "sign_in_or"}} + </div> + <div id="oauth2-login-navigator" class="tw-py-1"> + <div class="tw-flex tw-flex-col tw-justify-center"> + <div id="oauth2-login-navigator-inner" class="tw-flex tw-flex-col tw-flex-wrap tw-items-center tw-gap-2"> + {{range $provider := .OAuth2Providers}} + <a class="{{$provider.Name}} ui button tw-flex tw-items-center tw-justify-center tw-py-2 tw-w-full oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}"> + {{$provider.IconHTML 28}} + {{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}} + </a> + {{end}} + </div> + </div> + </div> + {{end}} + </form> +</div> diff --git a/templates/user/auth/signin_navbar.tmpl b/templates/user/auth/signin_navbar.tmpl new file mode 100644 index 00000000..01b994b9 --- /dev/null +++ b/templates/user/auth/signin_navbar.tmpl @@ -0,0 +1,24 @@ +{{if or .EnableOpenIDSignIn .EnableSSPI}} +<overflow-menu class="ui secondary pointing tabular top attached borderless menu navbar secondary-nav"> + <div class="overflow-menu-items tw-justify-center"> + <a class="{{if .PageIsLogin}}active {{end}}item" rel="nofollow" href="{{AppSubUrl}}/user/login"> + {{ctx.Locale.Tr "auth.tab_signin"}} + </a> + <a class="{{if .PageIsSignUp}}active{{end}} item" rel="nofollow" href="{{AppSubUrl}}/user/sign_up"> + {{ctx.Locale.Tr "auth.tab_signup"}} + </a> + {{if .EnableOpenIDSignIn}} + <a class="{{if .PageIsLoginOpenID}}active {{end}}item" rel="nofollow" href="{{AppSubUrl}}/user/login/openid"> + {{svg "fontawesome-openid"}} + {{ctx.Locale.Tr "auth.tab_openid"}} + </a> + {{end}} + {{if .EnableSSPI}} + <a class="item" rel="nofollow" href="{{AppSubUrl}}/user/login?auth_with_sspi=1"> + {{svg "fontawesome-windows"}} + SSPI + </a> + {{end}} + </div> +</overflow-menu> +{{end}} diff --git a/templates/user/auth/signin_openid.tmpl b/templates/user/auth/signin_openid.tmpl new file mode 100644 index 00000000..c1f392dc --- /dev/null +++ b/templates/user/auth/signin_openid.tmpl @@ -0,0 +1,36 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user signin openid"> + {{template "user/auth/signin_navbar" .}} + <div class="ui container"> + {{template "base/alert" .}} + <h4 class="ui top attached header center"> + {{svg "fontawesome-openid"}} + OpenID + </h4> + <div class="ui attached segment"> + <form class="ui form tw-m-auto" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="inline field"> + {{ctx.Locale.Tr "auth.openid_signin_desc"}} + </div> + <div class="required field {{if .Err_OpenID}}error{{end}}"> + <label for="openid"> + {{svg "fontawesome-openid"}} + OpenID URI + </label> + <input id="openid" name="openid" value="{{.openid}}" autofocus required> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "auth.remember_me"}}</label> + <input name="remember" type="checkbox"> + </div> + </div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "sign_in"}}</button> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/signup.tmpl b/templates/user/auth/signup.tmpl new file mode 100644 index 00000000..f238413c --- /dev/null +++ b/templates/user/auth/signup.tmpl @@ -0,0 +1,8 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user signin{{if .LinkAccountMode}} icon{{end}}"> + {{template "user/auth/signin_navbar" .}} + <div class="ui middle very relaxed page grid"> + {{template "user/auth/signup_inner" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/signup_inner.tmpl b/templates/user/auth/signup_inner.tmpl new file mode 100644 index 00000000..bdb691d8 --- /dev/null +++ b/templates/user/auth/signup_inner.tmpl @@ -0,0 +1,76 @@ +<div class="ui container column fluid{{if .LinkAccountMode}} icon{{end}}"> + <h4 class="ui top attached header center"> + {{if .LinkAccountMode}} + {{ctx.Locale.Tr "auth.oauth_signup_title"}} + {{else}} + {{ctx.Locale.Tr "sign_up"}} + {{end}} + </h4> + <div class="ui attached segment"> + <form class="ui form tw-max-w-2xl tw-m-auto" action="{{.SignUpLink}}" method="post"> + {{.CsrfTokenHtml}} + {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}} + {{template "base/alert" .}} + {{end}} + {{if .DisableRegistration}} + <p>{{ctx.Locale.Tr "auth.disable_register_prompt"}}</p> + {{else}} + <div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}"> + <label for="user_name">{{ctx.Locale.Tr "username"}}</label> + <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required> + </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="{{.email}}" required> + </div> + + {{if not .DisablePassword}} + <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}"> + <label for="password">{{ctx.Locale.Tr "password"}}</label> + <input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" required> + </div> + <div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}"> + <label for="retype">{{ctx.Locale.Tr "re_type"}}</label> + <input id="retype" name="retype" type="password" value="{{.retype}}" autocomplete="new-password" required> + </div> + {{end}} + + {{template "user/auth/captcha" .}} + + <div class="inline field"> + <button class="ui primary button"> + {{if .LinkAccountMode}} + {{ctx.Locale.Tr "auth.oauth_signup_submit"}} + {{else}} + {{ctx.Locale.Tr "auth.create_new_account"}} + {{end}} + </button> + </div> + + {{if not .LinkAccountMode}} + <div class="inline field"> + <a href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "auth.register_helper_msg"}}</a> + </div> + {{end}} + {{end}} + + {{if .OAuth2Providers}} + <div class="divider divider-text"> + {{ctx.Locale.Tr "sign_in_or"}} + </div> + <div id="oauth2-login-navigator" class="tw-py-1"> + <div class="tw-flex tw-flex-col tw-justify-center"> + <div id="oauth2-login-navigator-inner" class="tw-flex tw-flex-col tw-flex-wrap tw-items-center tw-gap-2"> + {{range $provider := .OAuth2Providers}} + <a class="{{$provider.Name}} ui button tw-flex tw-items-center tw-justify-center tw-py-2 tw-w-full oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}"> + {{$provider.IconHTML 28}} + {{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}} + </a> + {{end}} + </div> + </div> + </div> + {{end}} + </form> + </div> +</div> diff --git a/templates/user/auth/signup_openid_connect.tmpl b/templates/user/auth/signup_openid_connect.tmpl new file mode 100644 index 00000000..e4b79363 --- /dev/null +++ b/templates/user/auth/signup_openid_connect.tmpl @@ -0,0 +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> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/signup_openid_navbar.tmpl b/templates/user/auth/signup_openid_navbar.tmpl new file mode 100644 index 00000000..89068ddd --- /dev/null +++ b/templates/user/auth/signup_openid_navbar.tmpl @@ -0,0 +1,12 @@ +<overflow-menu class="ui secondary pointing tabular top attached borderless menu secondary-nav"> + <div class="overflow-menu-items tw-justify-center"> + <a class="{{if .PageIsOpenIDConnect}}active {{end}}item" href="{{AppSubUrl}}/user/openid/connect"> + {{ctx.Locale.Tr "auth.openid_connect_title"}} + </a> + {{if and .EnableOpenIDSignUp (not .AllowOnlyInternalRegistration)}} + <a class="{{if .PageIsOpenIDRegister}}active {{end}}item" href="{{AppSubUrl}}/user/openid/register"> + {{ctx.Locale.Tr "auth.openid_register_title"}} + </a> + {{end}} + </div> +</overflow-menu> diff --git a/templates/user/auth/signup_openid_register.tmpl b/templates/user/auth/signup_openid_register.tmpl new file mode 100644 index 00000000..c017a0e6 --- /dev/null +++ b/templates/user/auth/signup_openid_register.tmpl @@ -0,0 +1,37 @@ +{{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_register_title"}} + </h4> + <div class="ui attached segment"> + <p class="tw-max-w-2xl tw-mx-auto"> + {{ctx.Locale.Tr "auth.openid_register_desc"}} + </p> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_UserName}}error{{end}}"> + <label for="user_name">{{ctx.Locale.Tr "username"}}</label> + <input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required> + </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="{{.email}}" required> + </div> + + {{template "user/auth/captcha" .}} + + <div class="field"> + <label for="openid">OpenID URI</label> + <input id="openid" value="{{.OpenID}}" readonly> + </div> + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "auth.create_new_account"}}</button> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/twofa.tmpl b/templates/user/auth/twofa.tmpl new file mode 100644 index 00000000..d2452391 --- /dev/null +++ b/templates/user/auth/twofa.tmpl @@ -0,0 +1,26 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user signin"> + <div class="ui middle very relaxed page grid"> + <div class="column"> + <form class="ui form tw-max-w-2xl tw-m-auto" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "twofa"}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <div class="required field"> + <label for="passcode">{{ctx.Locale.Tr "passcode"}}</label> + <input id="passcode" name="passcode" type="text" autocomplete="one-time-code" inputmode="numeric" pattern="[0-9]*" autofocus required> + </div> + + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button> + <a href="{{AppSubUrl}}/user/two_factor/scratch">{{ctx.Locale.Tr "auth.use_scratch_code"}}</a> + </div> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/twofa_scratch.tmpl b/templates/user/auth/twofa_scratch.tmpl new file mode 100644 index 00000000..23ad77f2 --- /dev/null +++ b/templates/user/auth/twofa_scratch.tmpl @@ -0,0 +1,25 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user signin"> + <div class="ui middle very relaxed page grid"> + <div class="column"> + <form class="ui form tw-max-w-2xl tw-m-auto" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <h3 class="ui top attached header"> + {{ctx.Locale.Tr "twofa_scratch"}} + </h3> + <div class="ui attached segment"> + {{template "base/alert" .}} + <div class="required field"> + <label for="token">{{ctx.Locale.Tr "auth.scratch_code"}}</label> + <input id="token" name="token" type="text" autocomplete="off" autofocus required> + </div> + + <div class="inline field"> + <button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button> + </div> + </div> + </form> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/webauthn.tmpl b/templates/user/auth/webauthn.tmpl new file mode 100644 index 00000000..1b847653 --- /dev/null +++ b/templates/user/auth/webauthn.tmpl @@ -0,0 +1,25 @@ +{{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"> + {{template "user/auth/webauthn_error" .}} + <h3 class="ui top attached header">{{ctx.Locale.Tr "twofa"}}</h3> + <div class="ui attached segment"> + {{svg "octicon-key" 56}} + <h3>{{ctx.Locale.Tr "webauthn_insert_key"}}</h3> + {{template "base/alert" .}} + <p>{{ctx.Locale.Tr "webauthn_sign_in"}}</p> + </div> + <div class="ui attached segment tw-flex tw-items-center tw-justify-center tw-gap-1 tw-py-2"> + <div class="is-loading tw-w-[40px] tw-h-[40px]"></div> + {{ctx.Locale.Tr "webauthn_press_button"}} + </div> + {{if .HasTwoFactor}} + <div class="ui attached segment"> + <a href="{{AppSubUrl}}/user/two_factor">{{ctx.Locale.Tr "webauthn_use_twofa"}}</a> + </div> + {{end}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/auth/webauthn_error.tmpl b/templates/user/auth/webauthn_error.tmpl new file mode 100644 index 00000000..511ff7c2 --- /dev/null +++ b/templates/user/auth/webauthn_error.tmpl @@ -0,0 +1,13 @@ +<div id="webauthn-error" class="ui negative message tw-hidden"> + <div class="header">{{ctx.Locale.Tr "webauthn_error"}}</div> + <div id="webauthn-error-msg" class="tw-pt-2"></div> + <div class="tw-hidden"> + <div data-webauthn-error-msg="browser">{{ctx.Locale.Tr "webauthn_unsupported_browser"}}</div> + <div data-webauthn-error-msg="unknown">{{ctx.Locale.Tr "webauthn_error_unknown"}}</div> + <div data-webauthn-error-msg="insecure">{{ctx.Locale.Tr "webauthn_error_insecure"}}</div> + <div data-webauthn-error-msg="unable-to-process">{{ctx.Locale.Tr "webauthn_error_unable_to_process"}}</div> + <div data-webauthn-error-msg="duplicated">{{ctx.Locale.Tr "webauthn_error_duplicated"}}</div> + <div data-webauthn-error-msg="empty">{{ctx.Locale.Tr "webauthn_error_empty"}}</div> + <div data-webauthn-error-msg="timeout">{{ctx.Locale.Tr "webauthn_error_timeout"}}</div> + </div> +</div> diff --git a/templates/user/code.tmpl b/templates/user/code.tmpl new file mode 100644 index 00000000..ff6c69d6 --- /dev/null +++ b/templates/user/code.tmpl @@ -0,0 +1,24 @@ +{{template "base/head" .}} +{{if .ContextUser.IsOrganization}} + <div role="main" aria-label="{{.Title}}" class="page-content organization code"> + {{template "org/header" .}} + <div class="ui container"> + {{template "shared/search/code/search" .}} + </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"> + {{template "user/overview/header" .}} + {{template "shared/search/code/search" .}} + </div> + </div> + </div> + </div> +{{end}} +{{template "base/footer" .}} diff --git a/templates/user/dashboard/dashboard.tmpl b/templates/user/dashboard/dashboard.tmpl new file mode 100644 index 00000000..5dc46dc0 --- /dev/null +++ b/templates/user/dashboard/dashboard.tmpl @@ -0,0 +1,13 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content dashboard feeds"> + {{template "user/dashboard/navbar" .}} + <div class="ui container flex-container"> + <div class="flex-container-main"> + {{template "base/alert" .}} + {{template "user/heatmap" .}} + {{template "user/dashboard/feeds" .}} + </div> + {{template "user/dashboard/repolist" .}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl new file mode 100644 index 00000000..60aa1945 --- /dev/null +++ b/templates/user/dashboard/feeds.tmpl @@ -0,0 +1,127 @@ +<div id="activity-feed" class="flex-list"> + {{range .Feeds}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.AvatarByAction .}} + </div> + <div class="flex-item-main tw-gap-2"> + <div> + {{if gt .ActUser.ID 0}} + <a href="{{AppSubUrl}}/{{(.GetActUserName ctx) | PathEscape}}" title="{{.GetActDisplayNameTitle ctx}}">{{.GetActDisplayName ctx}}</a> + {{else}} + {{.ShortActUserName ctx}} + {{end}} + {{if .GetOpType.InActions "create_repo"}} + {{ctx.Locale.Tr "action.create_repo" (.GetRepoLink ctx) (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "rename_repo"}} + {{ctx.Locale.Tr "action.rename_repo" .GetContent (.GetRepoLink ctx) (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "commit_repo"}} + {{if .Content}} + {{ctx.Locale.Tr "action.commit_repo" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}} + {{else}} + {{ctx.Locale.Tr "action.create_branch" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}} + {{end}} + {{else if .GetOpType.InActions "create_issue"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.create_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "create_pull_request"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.create_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "transfer_repo"}} + {{ctx.Locale.Tr "action.transfer_repo" .GetContent (.GetRepoLink ctx) (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "push_tag"}} + {{ctx.Locale.Tr "action.push_tag" (.GetRepoLink ctx) (.GetRefLink ctx) .GetTag (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "comment_issue"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.comment_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "merge_pull_request"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.merge_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "close_issue"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.close_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "reopen_issue"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.reopen_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "close_pull_request"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.close_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "reopen_pull_request"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.reopen_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "delete_tag"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.delete_tag" (.GetRepoLink ctx) .GetTag (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "delete_branch"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.delete_branch" (.GetRepoLink ctx) .GetBranch (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "mirror_sync_push"}} + {{ctx.Locale.Tr "action.mirror_sync_push" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "mirror_sync_create"}} + {{ctx.Locale.Tr "action.mirror_sync_create" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "mirror_sync_delete"}} + {{ctx.Locale.Tr "action.mirror_sync_delete" (.GetRepoLink ctx) .GetBranch (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "approve_pull_request"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.approve_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "reject_pull_request"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.reject_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "comment_pull"}} + {{$index := index .GetIssueInfos 0}} + {{ctx.Locale.Tr "action.comment_pull" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}} + {{else if .GetOpType.InActions "publish_release"}} + {{$linkText := .Content | RenderEmoji $.Context}} + {{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"}} + {{$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}} + {{end}} + {{TimeSince .GetCreate ctx.Locale}} + </div> + {{if .GetOpType.InActions "commit_repo" "mirror_sync_push"}} + {{$push := ActionContent2Commits .}} + {{$repoLink := (.GetRepoLink ctx)}} + {{$repo := .Repo}} + <div class="tw-flex tw-flex-col tw-gap-1"> + {{range $push.Commits}} + {{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}} + <div class="flex-text-block"> + <img class="ui avatar" src="{{$push.AvatarLink $.Context .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16"> + <a class="ui sha label" href="{{$commitLink}}">{{ShortSha .Sha1}}</a> + <span class="text truncate"> + {{RenderCommitMessage $.Context .Message ($repo.ComposeMetas ctx)}} + </span> + </div> + {{end}} + </div> + {{if and (gt $push.Len 1) $push.CompareURL}} + <a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{ctx.Locale.Tr "action.compare_commits" $push.Len}} »</a> + {{end}} + {{else if .GetOpType.InActions "create_issue"}} + <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji $.Context | RenderCodeBlock}}</span> + {{else if .GetOpType.InActions "create_pull_request"}} + <span class="text truncate issue title">{{index .GetIssueInfos 1 | RenderEmoji $.Context | RenderCodeBlock}}</span> + {{else if .GetOpType.InActions "comment_issue" "approve_pull_request" "reject_pull_request" "comment_pull"}} + <a href="{{.GetCommentLink ctx}}" class="text truncate issue title">{{(.GetIssueTitle ctx) | RenderEmoji $.Context | RenderCodeBlock}}</a> + {{$comment := index .GetIssueInfos 1}} + {{if $comment}} + <div class="markup tw-text-14">{{RenderMarkdownToHtml ctx $comment}}</div> + {{end}} + {{else if .GetOpType.InActions "merge_pull_request"}} + <div class="flex-item-body text black">{{index .GetIssueInfos 1}}</div> + {{else if .GetOpType.InActions "close_issue" "reopen_issue" "close_pull_request" "reopen_pull_request"}} + <span class="text truncate issue title">{{(.GetIssueTitle ctx) | RenderEmoji $.Context | RenderCodeBlock}}</span> + {{else if .GetOpType.InActions "pull_review_dismissed"}} + <div class="flex-item-body text black">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</div> + <div class="flex-item-body text black">{{index .GetIssueInfos 2 | RenderEmoji $.Context}}</div> + {{end}} + </div> + <div class="flex-item-trailing"> + {{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32 "text grey tw-mr-1"}} + </div> + </div> + {{end}} + {{template "base/paginate" .}} +</div> diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl new file mode 100644 index 00000000..05253629 --- /dev/null +++ b/templates/user/dashboard/issues.tmpl @@ -0,0 +1,91 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content dashboard issues"> + {{template "user/dashboard/navbar" .}} + <div class="ui container"> + {{template "base/alert" .}} + <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="?type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + {{svg "octicon-issue-opened" 16 "tw-mr-2"}} + {{ctx.Locale.PrettyNumber .IssueStats.OpenCount}} {{ctx.Locale.Tr "repo.issues.open_title"}} + </a> + <a class="item{{if .IsShowClosed}} active{{end}}" href="?type={{$.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + {{svg "octicon-issue-closed" 16 "tw-mr-2"}} + {{ctx.Locale.PrettyNumber .IssueStats.ClosedCount}} {{ctx.Locale.Tr "repo.issues.closed_title"}} + </a> + </div> + <form class="list-header-search ui form ignore-dirty"> + <div class="ui small search fluid action input"> + <input type="hidden" name="type" value="{{$.ViewType}}"> + <input type="hidden" name="sort" value="{{$.SortType}}"> + <input type="hidden" name="state" value="{{$.State}}"> + {{if .PageIsPulls}} + {{template "shared/search/combo_fuzzy" dict "Value" $.Keyword "IsFuzzy" $.IsFuzzy "Placeholder" (ctx.Locale.Tr "search.pull_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} + {{else}} + {{template "shared/search/combo_fuzzy" dict "Value" $.Keyword "IsFuzzy" $.IsFuzzy "Placeholder" (ctx.Locale.Tr "search.issue_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} + {{end}} + </div> + </form> + <div class="ui secondary menu tw-mt-0"> + <!-- Label --> + {{if .PageIsOrgIssues}} + {{template "shared/label_filter" .}} + {{end}} + <!-- Type --> + <div class="list-header ui dropdown type jump item"> + <span class="text tw-whitespace-nowrap"> + {{ctx.Locale.Tr "repo.issues.filter_type"}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </span> + <div class="ui menu"> + <a class="{{if eq .ViewType "your_repositories"}}active{{end}} item" href="?type=your_repositories&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + <div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.YourRepositoriesCount}}</div> + {{ctx.Locale.Tr "home.issues.in_your_repos"}} + </a> + <a class="{{if eq .ViewType "assigned"}}active{{end}} item" href="?type=assigned&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + <div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.AssignCount}}</div> + {{ctx.Locale.Tr "repo.issues.filter_type.assigned_to_you"}} + </a> + <a class="{{if eq .ViewType "created_by"}}active{{end}} item" href="?type=created_by&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + <div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.CreateCount}}</div> + {{ctx.Locale.Tr "repo.issues.filter_type.created_by_you"}} + </a> + {{if .PageIsPulls}} + <a class="{{if eq .ViewType "review_requested"}}active{{end}} item" href="?type=review_requested&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + <div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.ReviewRequestedCount}}</div> + {{ctx.Locale.Tr "repo.issues.filter_type.review_requested"}} + </a> + <a class="{{if eq .ViewType "reviewed_by"}}active{{end}} item" href="?type=reviewed_by&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + <div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.ReviewedCount}}</div> + {{ctx.Locale.Tr "repo.issues.filter_type.reviewed_by_you"}} + </a> + {{end}} + <a class="{{if eq .ViewType "mentioned"}}active{{end}} item" href="?type=mentioned&sort={{$.SortType}}&state={{.State}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}"> + <div class="ui circular mini label tw-ml-0">{{CountFmt .IssueStats.MentionCount}}</div> + {{ctx.Locale.Tr "repo.issues.filter_type.mentioning_you"}} + </a> + </div> + </div> + <!-- Sort --> + <div class="list-header-sort ui dropdown type jump item"> + <span class="text tw-whitespace-nowrap"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </span> + <div class="menu"> + <a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?type={{$.ViewType}}&sort=recentupdate&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> + <a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?type={{$.ViewType}}&sort=leastupdate&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> + <a class="{{if or (eq .SortType "latest") (not .SortType)}}active {{end}}item" href="?type={{$.ViewType}}&sort=latest&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a class="{{if eq .SortType "oldest"}}active {{end}}item" href="?type={{$.ViewType}}&sort=oldest&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "mostcomment"}}active {{end}}item" href="?type={{$.ViewType}}&sort=mostcomment&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.mostcomment"}}</a> + <a class="{{if eq .SortType "leastcomment"}}active {{end}}item" href="?type={{$.ViewType}}&sort=leastcomment&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastcomment"}}</a> + <a class="{{if eq .SortType "nearduedate"}}active {{end}}item" href="?type={{$.ViewType}}&sort=nearduedate&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.nearduedate"}}</a> + <a class="{{if eq .SortType "farduedate"}}active {{end}}item" href="?type={{$.ViewType}}&sort=farduedate&state={{$.State}}&labels={{.SelectLabels}}&q={{$.Keyword}}&fuzzy={{.IsFuzzy}}">{{ctx.Locale.Tr "repo.issues.filter_sort.farduedate"}}</a> + </div> + </div> + </div> + </div> + {{template "shared/issuelist" dict "." . "listType" "dashboard"}} + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl new file mode 100644 index 00000000..0f1e866a --- /dev/null +++ b/templates/user/dashboard/milestones.tmpl @@ -0,0 +1,154 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content dashboard issues repository milestones"> + {{template "user/dashboard/navbar" .}} + <div class="ui container"> + <div class="flex-container"> + <div class="flex-container-nav"> + <div class="ui secondary vertical filter menu tw-bg-transparent"> + <div class="item"> + {{ctx.Locale.Tr "home.issues.in_your_repos"}} + <strong>{{.Total}}</strong> + </div> + <div class="divider"></div> + {{range .Repos}} + {{with $Repo := .}} + <a class="{{range $.RepoIDs}}{{if eq . $Repo.ID}}active{{end}}{{end}} repo name item" href="?repos=[ + {{- with $include := true -}} + {{- range $.RepoIDs -}} + {{- if eq . $Repo.ID -}} + {{$include = false}} + {{- else -}} + {{.}}%2C + {{- end -}} + {{- end -}} + {{- if eq $include true -}} + {{$Repo.ID}}%2C + {{- end -}} + {{- end -}} + ]&sort={{$.SortType}}&state={{$.State}}&q={{$.Keyword}}" title="{{.FullName}}"> + <span class="text truncate">{{$Repo.FullName}}</span> + <div class="ui {{if $.IsShowClosed}}red{{else}}green{{end}} label">{{index $.Counts $Repo.ID}}</div> + </a> + {{end}} + {{end}} + </div> + </div> + <div class="flex-container-main content"> + <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}}"> + {{svg "octicon-milestone" 16 "tw-mr-2"}} + {{ctx.Locale.PrettyNumber .MilestoneStats.OpenCount}} {{ctx.Locale.Tr "repo.issues.open_title"}} + </a> + <a class="item{{if .IsShowClosed}} active{{end}}" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort={{$.SortType}}&state=closed&q={{$.Keyword}}"> + {{svg "octicon-check" 16 "tw-mr-2"}} + {{ctx.Locale.PrettyNumber .MilestoneStats.ClosedCount}} {{ctx.Locale.Tr "repo.issues.closed_title"}} + </a> + </div> + <form class="list-header-search ui form ignore-dirty"> + <input type="hidden" name="type" value="{{$.ViewType}}"> + <input type="hidden" name="repos" value="[{{range $.RepoIDs}}{{.}},{{end}}]"> + <input type="hidden" name="sort" value="{{$.SortType}}"> + <input type="hidden" name="state" value="{{$.State}}"> + {{template "shared/search/combo" dict "Value" $.Keyword}} + </form> + <!-- Sort --> + <div class="list-header-sort ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "closestduedate") (not .SortType)}}active {{end}}item" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort=closestduedate&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.earliest_due_data"}}</a> + <a class="{{if eq .SortType "furthestduedate"}}active {{end}}item" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort=furthestduedate&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.latest_due_date"}}</a> + <a class="{{if eq .SortType "leastcomplete"}}active {{end}}item" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort=leastcomplete&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.least_complete"}}</a> + <a class="{{if eq .SortType "mostcomplete"}}active {{end}}item" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort=mostcomplete&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}}</a> + <a class="{{if eq .SortType "mostissues"}}active {{end}}item" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort=mostissues&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}}</a> + <a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="?repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]&sort=leastissues&state={{$.State}}&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}}</a> + </div> + </div> + </div> + <div class="milestone-list"> + {{range .Milestones}} + <li class="milestone-card"> + <div class="milestone-header"> + <h3 class="flex-text-block tw-m-0"> + <span class="ui large label"> + {{.Repo.FullName}} + </span> + {{svg "octicon-milestone" 16}} + <a class="muted" href="{{.Repo.Link}}/milestone/{{.ID}}">{{.Name}}</a> + </h3> + <div class="tw-flex tw-items-center"> + <span class="tw-mr-2">{{.Completeness}}%</span> + <progress value="{{.Completeness}}" max="100"></progress> + </div> + </div> + <div class="milestone-toolbar"> + <div class="group"> + <div class="flex-text-block"> + {{svg "octicon-issue-opened" 14}} + {{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.Locale.Tr "repo.issues.closed_title"}} + </div> + {{if .TotalTrackedTime}} + <div class="flex-text-block"> + {{svg "octicon-clock"}} + {{.TotalTrackedTime|Sec2Time}} + </div> + {{end}} + {{if .UpdatedUnix}} + <div class="flex-text-block"> + {{svg "octicon-clock"}} + {{ctx.Locale.Tr "repo.milestones.update_ago" (TimeSinceUnix .UpdatedUnix ctx.Locale)}} + </div> + {{end}} + <div class="flex-text-block"> + {{if .IsClosed}} + {{$closedDate:= TimeSinceUnix .ClosedDateUnix ctx.Locale}} + {{svg "octicon-clock" 14}} + {{ctx.Locale.Tr "repo.milestones.closed" $closedDate}} + {{else}} + {{if .DeadlineString}} + <span{{if .IsOverdue}} class="text red"{{end}}> + {{svg "octicon-calendar" 14}} + {{DateTime "short" .DeadlineString}} + </span> + {{else}} + {{svg "octicon-calendar" 14}} + {{ctx.Locale.Tr "repo.milestones.no_due_date"}} + {{end}} + {{end}} + </div> + </div> + {{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}} + <div class="group"> + <a class="flex-text-inline" href="{{$.Link}}/{{.ID}}/edit">{{svg "octicon-pencil" 14}}{{ctx.Locale.Tr "repo.issues.label_edit"}}</a> + {{if .IsClosed}} + <a class="link-action flex-text-inline" href data-url="{{$.Link}}/{{.ID}}/open">{{svg "octicon-check" 14}}{{ctx.Locale.Tr "repo.milestones.open"}}</a> + {{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> + </div> + {{end}} + </div> + {{if .Content}} + <div class="markup content"> + {{.RenderedContent}} + </div> + {{end}} + </li> + {{end}} + + {{template "base/paginate" .}} + </div> + + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl new file mode 100644 index 00000000..1fa356f9 --- /dev/null +++ b/templates/user/dashboard/navbar.tmpl @@ -0,0 +1,102 @@ +<div class="secondary-nav tw-border-b tw-border-b-secondary"> + <div class="ui secondary stackable menu"> + <div class="item"> + <div class="ui floating dropdown jump"> + <span class="text truncated-item-container"> + {{ctx.AvatarUtils.Avatar .ContextUser}} + <span class="truncated-item-name">{{.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"}} + </span> + <div class="context user overflow menu"> + <div class="ui 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}}"> + {{ctx.AvatarUtils.Avatar .SignedUser}} + <span class="truncated-item-name">{{.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}}"> + {{ctx.AvatarUtils.Avatar .}} + <span class="truncated-item-name">{{.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}} + </span> + </a> + {{end}} + </div> + </div> + </div> + </div> + {{if .ContextUser.IsOrganization}} + <div class="item"> + <div class="ui floating dropdown jump"> + <span class="text"> + {{svg "octicon-people" 18}} + {{if .Team}} + {{.Team.Name}} + {{else}} + {{ctx.Locale.Tr "org.teams"}} + {{end}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="context user overflow menu"> + <div class="ui header"> + {{ctx.Locale.Tr "home.filter_by_team_repositories"}} + </div> + <div class="scrolling menu items"> + <a class="{{if not $.Team}}active selected{{end}} item" title="{{ctx.Locale.Tr "all"}}" href="{{$.Org.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}"> + {{ctx.Locale.Tr "all"}} + </a> + {{range .Teams}} + {{if not .IncludesAllRepositories}} + <a class="{{if $.Team}}{{if eq $.Team.ID .ID}}active selected{{end}}{{end}} item" title="{{.Name}}" href="{{$.Org.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}/{{.Name}}"> + {{.Name}} + </a> + {{end}} + {{end}} + </div> + </div> + </div> + </div> + {{end}} + + {{if .ContextUser.IsOrganization}} + <div class="right menu"> + <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> + {{if not .UnitIssuesGlobalDisabled}} + <a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> + {{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "issues"}} + </a> + {{end}} + {{if not .UnitPullsGlobalDisabled}} + <a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> + {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "pull_requests"}} + </a> + {{end}} + {{if and .ShowMilestonesDashboardPage (not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled))}} + <a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> + {{svg "octicon-milestone"}} {{ctx.Locale.Tr "milestones"}} + </a> + {{end}} + <div class="item"> + <a class="ui basic button" href="{{.ContextUser.HomeLink}}" title="{{ctx.Locale.Tr "home.view_home" .ContextUser.Name}}"> + {{ctx.Locale.Tr "home.view_home" (.ContextUser.ShortName 40)}} + </a> + </div> + </div> + {{end}} + </div> +</div> diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl new file mode 100644 index 00000000..2781f710 --- /dev/null +++ b/templates/user/dashboard/repolist.tmpl @@ -0,0 +1,55 @@ +<script type="module"> +const data = { + ...window.config.pageData.dashboardRepoList, // it only contains searchLimit and uid + + isMirrorsEnabled: {{.MirrorsEnabled}}, + isStarsEnabled: {{not .IsDisableStars}}, + + textMyRepos: {{ctx.Locale.Tr "home.my_repos"}}, + textSearchRepos: {{ctx.Locale.Tr "search.repo_kind"}}, + textFilter: {{ctx.Locale.Tr "home.filter"}}, + textShowArchived: {{ctx.Locale.Tr "home.show_archived"}}, + textShowPrivate: {{ctx.Locale.Tr "home.show_private"}}, + + textShowBothArchivedUnarchived: {{ctx.Locale.Tr "home.show_both_archived_unarchived"}}, + textShowOnlyUnarchived: {{ctx.Locale.Tr "home.show_only_unarchived"}}, + textShowOnlyArchived: {{ctx.Locale.Tr "home.show_only_archived"}}, + + textShowBothPrivatePublic: {{ctx.Locale.Tr "home.show_both_private_public"}}, + textShowOnlyPublic: {{ctx.Locale.Tr "home.show_only_public"}}, + textShowOnlyPrivate: {{ctx.Locale.Tr "home.show_only_private"}}, + + textAll: {{ctx.Locale.Tr "all"}}, + textSources: {{ctx.Locale.Tr "sources"}}, + textForks: {{ctx.Locale.Tr "forks"}}, + textMirrors: {{ctx.Locale.Tr "mirrors"}}, + textCollaborative: {{ctx.Locale.Tr "collaborative"}}, + + textFirstPage: {{ctx.Locale.Tr "admin.first_page"}}, + textPreviousPage: {{ctx.Locale.Tr "repo.issues.previous"}}, + textNextPage: {{ctx.Locale.Tr "repo.issues.next"}}, + textLastPage: {{ctx.Locale.Tr "admin.last_page"}}, + + textMyOrgs: {{ctx.Locale.Tr "home.my_orgs"}}, + + textOrgVisibilityLimited: {{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}, + textOrgVisibilityPrivate: {{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}, +}; + +{{if .Team}} +data.teamId = {{.Team.ID}}; +{{end}} + +{{if not .ContextUser.IsOrganization}} +data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}, 'org_visibility': {{.Visibility}}},{{end}}]; +data.isOrganization = false; +data.organizationsTotalCount = {{.UserOrgsCount}}; +data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}}; +{{else}} +data.organizationId = {{.ContextUser.ID}}; +{{end}} + +window.config.pageData.dashboardRepoList = data; +</script> + +<div id="dashboard-repo-list" class="flex-container-sidebar"></div> diff --git a/templates/user/heatmap.tmpl b/templates/user/heatmap.tmpl new file mode 100644 index 00000000..05403e34 --- /dev/null +++ b/templates/user/heatmap.tmpl @@ -0,0 +1,13 @@ +{{if .HeatmapData}} + <div id="user-heatmap" class="is-loading" + data-heatmap-data="{{JsonUtils.EncodeToString .HeatmapData}}" + data-locale-total-contributions="{{ctx.Locale.Tr "heatmap.number_of_contributions_in_the_last_12_months" (ctx.Locale.PrettyNumber .HeatmapTotalContributions)}}" + data-locale-contributions-zero="{{ctx.Locale.Tr "heatmap.contributions_zero"}}" + data-locale-contributions-format="{{ctx.Locale.Tr "heatmap.contributions_format"}}" + data-locale-contributions-one="{{ctx.Locale.Tr "heatmap.contributions_one"}}" + data-locale-contributions-few="{{ctx.Locale.Tr "heatmap.contributions_few"}}" + data-locale-more="{{ctx.Locale.Tr "heatmap.more"}}" + data-locale-less="{{ctx.Locale.Tr "heatmap.less"}}" + ></div> + <div class="divider"></div> +{{end}} diff --git a/templates/user/notification/notification.tmpl b/templates/user/notification/notification.tmpl new file mode 100644 index 00000000..b483c15e --- /dev/null +++ b/templates/user/notification/notification.tmpl @@ -0,0 +1,3 @@ +{{template "base/head" .}} +{{template "user/notification/notification_div" .}} +{{template "base/footer" .}} diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl new file mode 100644 index 00000000..4329ffdb --- /dev/null +++ b/templates/user/notification/notification_div.tmpl @@ -0,0 +1,130 @@ +<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}} + <div class="tw-flex tw-items-center tw-justify-between tw-mb-4"> + <div class="ui secondary partial menu"> + <a class="{{if eq .Status 1}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=unread"> + {{ctx.Locale.Tr "notification.unread"}} + <div class="notifications-unread-count ui label {{if not $notificationUnreadCount}}tw-hidden{{end}}">{{$notificationUnreadCount}}</div> + </a> + <a class="{{if eq .Status 2}}active {{end}}item" href="{{AppSubUrl}}/notifications?q=read"> + {{ctx.Locale.Tr "notification.read"}} + </a> + </div> + <div class="tw-flex button-row"> + <a class="ui tiny button" href="{{AppSubUrl}}/notifications/subscriptions"> + {{ctx.Locale.Tr "notification.subscriptions"}} + </a> + {{if and (eq .Status 1)}} + <form class="{{if not $notificationUnreadCount}}tw-hidden{{end}}" action="{{AppSubUrl}}/notifications/purge" method="post"> + {{$.CsrfTokenHtml}} + <div> + <button class="ui mini button primary tw-mr-0" title="{{ctx.Locale.Tr "notification.mark_all_as_read"}}"> + {{svg "octicon-checklist"}} + </button> + </div> + </form> + {{end}} + </div> + </div> + <div class="tw-p-0"> + <div id="notification_table"> + {{if not .Notifications}} + <div class="tw-flex tw-items-center tw-flex-col tw-p-4"> + {{svg "octicon-inbox" 56 "tw-mb-4"}} + {{if eq .Status 1}} + {{ctx.Locale.Tr "notification.no_unread"}} + {{else}} + {{ctx.Locale.Tr "notification.no_read"}} + {{end}} + </div> + {{else}} + {{range $notification := .Notifications}} + <div class="notifications-item tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-p-2" id="notification_{{.ID}}" data-status="{{.Status}}"> + <div class="notifications-icon tw-ml-2 tw-mr-1 tw-self-start tw-mt-1"> + {{if .Issue}} + {{template "shared/issueicon" .Issue}} + {{else}} + {{svg "octicon-repo" 16 "text grey"}} + {{end}} + </div> + <a class="notifications-link tw-flex tw-flex-1 tw-flex-col silenced" href="{{.Link ctx}}"> + <div class="notifications-top-row tw-text-13 tw-break-anywhere"> + {{.Repository.FullName}} {{if .Issue}}<span class="text light-3">#{{.Issue.Index}}</span>{{end}} + {{if eq .Status 3}} + {{svg "octicon-pin" 13 "text blue tw-mt-0.5 tw-ml-1"}} + {{end}} + </div> + <div class="notifications-bottom-row tw-text-16 tw-py-0.5"> + <span class="issue-title tw-break-anywhere"> + {{if .Issue}} + {{.Issue.Title | RenderEmoji $.Context | RenderCodeBlock}} + {{else}} + {{.Repository.FullName}} + {{end}} + </span> + </div> + </a> + <div class="notifications-updated tw-items-center tw-mr-2"> + {{if .Issue}} + {{TimeSinceUnix .Issue.UpdatedUnix ctx.Locale}} + {{else}} + {{TimeSinceUnix .UpdatedUnix ctx.Locale}} + {{end}} + </div> + <div class="notifications-buttons tw-items-center tw-justify-end tw-gap-1 tw-px-1"> + {{if ne .Status 3}} + <form action="{{AppSubUrl}}/notifications/status" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="notification_id" value="{{.ID}}"> + <input type="hidden" name="status" value="pinned"> + <button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.pin"}}" + data-url="{{AppSubUrl}}/notifications/status" + data-status="pinned" + data-page="{{$.Page.Paginater.Current}}" + data-notification-id="{{.ID}}" + data-q="{{$.Keyword}}"> + {{svg "octicon-pin"}} + </button> + </form> + {{end}} + {{if or (eq .Status 1) (eq .Status 3)}} + <form action="{{AppSubUrl}}/notifications/status" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="notification_id" value="{{.ID}}"> + <input type="hidden" name="status" value="read"> + <input type="hidden" name="page" value="{{$.Page.Paginater.Current}}"> + <button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_read"}}" + data-url="{{AppSubUrl}}/notifications/status" + data-status="read" + data-page="{{$.Page.Paginater.Current}}" + data-notification-id="{{.ID}}" + data-q="{{$.Keyword}}"> + {{svg "octicon-check"}} + </button> + </form> + {{else if eq .Status 2}} + <form action="{{AppSubUrl}}/notifications/status" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="notification_id" value="{{.ID}}"> + <input type="hidden" name="status" value="unread"> + <input type="hidden" name="page" value="{{$.Page.Paginater.Current}}"> + <button class="btn interact-bg tw-p-2" title="{{ctx.Locale.Tr "notification.mark_as_unread"}}" + data-url="{{AppSubUrl}}/notifications/status" + data-status="unread" + data-page="{{$.Page.Paginater.Current}}" + data-notification-id="{{.ID}}" + data-q="{{$.Keyword}}"> + {{svg "octicon-bell"}} + </button> + </form> + {{end}} + </div> + </div> + {{end}} + {{end}} + </div> + </div> + {{template "base/paginate" .}} + </div> +</div> diff --git a/templates/user/notification/notification_subscriptions.tmpl b/templates/user/notification/notification_subscriptions.tmpl new file mode 100644 index 00000000..0a3ae99b --- /dev/null +++ b/templates/user/notification/notification_subscriptions.tmpl @@ -0,0 +1,84 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user notification"> + <div class="ui container"> + <div class="tw-flex tw-items-center tw-justify-between tw-mb-4"> + <div class="ui secondary partial menu"> + <a href="{{AppSubUrl}}/notifications/subscriptions" class="{{if eq .Status 1}}active {{end}}item"> + {{ctx.Locale.Tr "notification.subscriptions"}} + </a> + <a href="{{AppSubUrl}}/notifications/watching" class="{{if eq .Status 2}}active {{end}}item"> + {{ctx.Locale.Tr "notification.watching"}} + </a> + </div> + <a class="ui tiny button" href="{{AppSubUrl}}/notifications"> + {{ctx.Locale.Tr "notifications"}} + </a> + </div> + <div class="ui bottom active tab segment"> + {{if eq .Status 1}} + <div class="tw-flex tw-justify-between"> + <div class="tw-flex"> + <div class="small-menu-items ui compact tiny menu"> + <a class="{{if eq .State "all"}}active {{end}}item" href="?sort={{$.SortType}}&state=all&issueType={{$.IssueType}}&labels={{$.Labels}}"> + {{ctx.Locale.Tr "all"}} + </a> + <a class="{{if eq .State "open"}}active {{end}}item" href="?sort={{$.SortType}}&state=open&issueType={{$.IssueType}}&labels={{$.Labels}}"> + {{svg "octicon-issue-opened" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.open_title"}} + </a> + <a class="{{if eq .State "closed"}}active {{end}}item" href="?sort={{$.SortType}}&state=closed&issueType={{$.IssueType}}&labels={{$.Labels}}"> + {{svg "octicon-issue-closed" 16 "tw-mr-2"}} + {{ctx.Locale.Tr "repo.issues.closed_title"}} + </a> + </div> + </div> + <div class="tw-flex tw-justify-between"> + <div class="ui right aligned secondary filter menu labels"> + <!-- Type --> + <div class="ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_type"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .IssueType "all") (not .IssueType)}}active {{end}}item" href="?sort={{$.SortType}}&state={{$.State}}&issueType=all&labels={{$.Labels}}">{{ctx.Locale.Tr "all"}}</a> + <a class="{{if eq .IssueType "issues"}}active {{end}}item" href="?sort={{$.SortType}}&state={{$.State}}&issueType=issues&labels={{$.Labels}}">{{ctx.Locale.Tr "issues"}}</a> + <a class="{{if eq .IssueType "pulls"}}active {{end}}item" href="?sort={{$.SortType}}&state={{$.State}}&issueType=pulls&labels={{$.Labels}}">{{ctx.Locale.Tr "pull_requests"}}</a> + </div> + </div> + + <!-- Sort --> + <div class="ui dropdown type jump item"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "latest") (not .SortType)}}active {{end}}item" href="?sort=latest&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a> + <a class="{{if eq .SortType "oldest"}}active {{end}}item" href="?sort=oldest&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a> + <a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?sort=recentupdate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a> + <a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?sort=leastupdate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a> + <a class="{{if eq .SortType "mostcomment"}}active {{end}}item" href="?sort=mostcomment&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.mostcomment"}}</a> + <a class="{{if eq .SortType "leastcomment"}}active {{end}}item" href="?sort=leastcomment&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastcomment"}}</a> + <a class="{{if eq .SortType "nearduedate"}}active {{end}}item" href="?sort=nearduedate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.nearduedate"}}</a> + <a class="{{if eq .SortType "farduedate"}}active {{end}}item" href="?sort=farduedate&state={{$.State}}&issueType={{$.IssueType}}&labels={{$.Labels}}">{{ctx.Locale.Tr "repo.issues.filter_sort.farduedate"}}</a> + </div> + </div> + </div> + </div> + </div> + <div class="divider"></div> + {{if not .Issues}} + {{ctx.Locale.Tr "notification.no_subscriptions"}} + {{else}} + {{template "shared/issuelist" dict "." . "listType" "dashboard"}} + {{end}} + {{else}} + {{template "shared/repo_search" .}} + {{template "explore/repo_list" .}} + {{template "base/paginate" .}} + {{end}} + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/overview/header.tmpl b/templates/user/overview/header.tmpl new file mode 100644 index 00000000..27568c31 --- /dev/null +++ b/templates/user/overview/header.tmpl @@ -0,0 +1,54 @@ +<overflow-menu class="ui secondary pointing tabular borderless menu"> + <div class="overflow-menu-items"> + {{if and .HasProfileReadme .ContextUser.IsIndividual}} + <a class="{{if eq .TabName "overview"}}active {{end}}item" href="{{.ContextUser.HomeLink}}?tab=overview"> + {{svg "octicon-info"}} {{ctx.Locale.Tr "user.overview"}} + </a> + {{end}} + <a class="{{if eq .TabName "repositories"}}active {{end}} item" href="{{.ContextUser.HomeLink}}?tab=repositories"> + {{svg "octicon-repo"}} {{ctx.Locale.Tr "user.repositories"}} + {{if .RepoCount}} + <div class="ui small label">{{.RepoCount}}</div> + {{end}} + <span hidden test-name="repository-count">{{.RepoCount}}</span> + </a> + {{if or .ContextUser.IsIndividual .CanReadProjects}} + <a href="{{.ContextUser.HomeLink}}/-/projects" class="{{if .PageIsViewProjects}}active {{end}}item"> + {{svg "octicon-project-symlink"}} {{ctx.Locale.Tr "user.projects"}} + {{if .ProjectCount}} + <div class="ui small label">{{.ProjectCount}}</div> + {{end}} + <span hidden test-name="project-count">{{.ProjectCount}}</span> + </a> + {{end}} + {{if and .IsPackageEnabled (or .ContextUser.IsIndividual .CanReadPackages)}} + <a href="{{.ContextUser.HomeLink}}/-/packages" class="{{if .IsPackagesPage}}active {{end}}item"> + {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} + {{if and .IsRepoIndexerEnabled (or .ContextUser.IsIndividual .CanReadCode)}} + <a href="{{.ContextUser.HomeLink}}/-/code" class="{{if .IsCodePage}}active {{end}}item"> + {{svg "octicon-code"}} {{ctx.Locale.Tr "user.code"}} + </a> + {{end}} + {{if .ContextUser.IsIndividual}} + {{if or (eq .TabName "activity") .IsAdmin (eq .SignedUserID .ContextUser.ID) (not .ContextUser.KeepActivityPrivate)}} + <a class="{{if eq .TabName "activity"}}active {{end}}item" href="{{.ContextUser.HomeLink}}?tab=activity"> + {{svg "octicon-rss"}} {{ctx.Locale.Tr "user.activity"}} + </a> + {{end}} + {{if not .DisableStars}} + <a class="{{if eq .TabName "stars"}}active {{end}}item" href="{{.ContextUser.HomeLink}}?tab=stars"> + {{svg "octicon-star"}} {{ctx.Locale.Tr "user.starred"}} + {{if .ContextUser.NumStars}} + <div class="ui small label">{{.ContextUser.NumStars}}</div> + {{end}} + </a> + {{else}} + <a class="{{if eq .TabName "watching"}}active {{end}}item" href="{{.ContextUser.HomeLink}}?tab=watching"> + {{svg "octicon-eye"}} {{ctx.Locale.Tr "user.watched"}} + </a> + {{end}} + {{end}} + </div> +</overflow-menu> diff --git a/templates/user/overview/package_versions.tmpl b/templates/user/overview/package_versions.tmpl new file mode 100644 index 00000000..0ac2db0d --- /dev/null +++ b/templates/user/overview/package_versions.tmpl @@ -0,0 +1,24 @@ +{{template "base/head" .}} +{{if .ContextUser.IsOrganization}} + <div role="main" aria-label="{{.Title}}" class="page-content organization packages"> + {{template "org/header" .}} + <div class="ui container"> + {{template "package/shared/versionlist" .}} + </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="ui twelve wide column tw-mb-4"> + {{template "user/overview/header" .}} + {{template "package/shared/versionlist" .}} + </div> + </div> + </div> + </div> +{{end}} +{{template "base/footer" .}} diff --git a/templates/user/overview/packages.tmpl b/templates/user/overview/packages.tmpl new file mode 100644 index 00000000..bb2238b9 --- /dev/null +++ b/templates/user/overview/packages.tmpl @@ -0,0 +1,24 @@ +{{template "base/head" .}} +{{if .ContextUser.IsOrganization}} + <div role="main" aria-label="{{.Title}}" class="page-content organization packages"> + {{template "org/header" .}} + <div class="ui container"> + {{template "package/shared/list" .}} + </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="ui twelve wide column tw-mb-4"> + {{template "user/overview/header" .}} + {{template "package/shared/list" .}} + </div> + </div> + </div> + </div> +{{end}} +{{template "base/footer" .}} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl new file mode 100644 index 00000000..477b838b --- /dev/null +++ b/templates/user/profile.tmpl @@ -0,0 +1,76 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content user profile"> + <div class="ui container"> + {{template "base/alert" .}} + <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" .}} + {{if eq .TabName "activity"}} + {{if eq .SignedUserID .ContextUser.ID}} + <p id="visibility-hint"> + {{if .ContextUser.KeepActivityPrivate}} + {{ctx.Locale.Tr "user.public_activity.visibility_hint.self_private" "/user/settings#keep-activity-private"}} + {{else}} + {{ctx.Locale.Tr "user.public_activity.visibility_hint.self_public" "/user/settings#keep-activity-private"}} + {{end}} + </p> + {{else}} + {{if .IsAdmin}} + <div id="visibility-hint" class="ui info message"> + {{if .ContextUser.KeepActivityPrivate}} + {{ctx.Locale.Tr "user.public_activity.visibility_hint.admin_private"}} + {{else}} + {{ctx.Locale.Tr "user.public_activity.visibility_hint.admin_public"}} + {{end}} + </div> + {{else}} + {{if .ContextUser.KeepActivityPrivate}} + <p id="visibility-hint">{{ctx.Locale.Tr "user.disabled_public_activity"}}</p> + {{end}} + {{end}} + {{end}} + {{if or .IsAdmin (eq .SignedUserID .ContextUser.ID) (not .ContextUser.KeepActivityPrivate)}} + {{template "user/heatmap" .}} + {{template "user/dashboard/feeds" .}} + {{end}} + {{else if eq .TabName "stars"}} + <div class="stars"> + {{template "shared/repo_search" .}} + {{template "explore/repo_list" .}} + {{template "base/paginate" .}} + </div> + {{else if eq .TabName "following"}} + {{template "repo/user_cards" .}} + {{else if eq .TabName "followers"}} + {{template "repo/user_cards" .}} + {{else if eq .TabName "overview"}} + <div id="readme_profile" class="markup">{{.ProfileReadme}}</div> + {{else}} + {{template "shared/repo_search" .}} + {{template "explore/repo_list" .}} + {{template "base/paginate" .}} + {{end}} + </div> + </div> + </div> +</div> + +<div class="ui g-modal-confirm delete modal" id="block-user"> + <div class="header"> + {{ctx.Locale.Tr "user.block_user"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "user.block_user.detail"}}</p> + <ul> + <li>{{ctx.Locale.Tr "user.block_user.detail_1"}}</li> + <li>{{ctx.Locale.Tr "user.block_user.detail_2"}}</li> + <li>{{ctx.Locale.Tr "user.block_user.detail_3"}}</li> + </ul> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "base/footer" .}} diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl new file mode 100644 index 00000000..a97136f4 --- /dev/null +++ b/templates/user/settings/account.tmpl @@ -0,0 +1,180 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings account")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.change_password"}} + </h4> + <div class="ui attached segment"> + {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}} + <form class="ui form ignore-dirty" action="{{AppSubUrl}}/user/settings/account" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + {{if .SignedUser.IsPasswordSet}} + <div class="required field {{if .Err_OldPassword}}error{{end}}"> + <label for="old_password">{{ctx.Locale.Tr "settings.old_password"}}</label> + <input id="old_password" name="old_password" type="password" autocomplete="current-password" autofocus required> + </div> + {{end}} + <div class="required field {{if .Err_Password}}error{{end}}"> + <label for="password">{{ctx.Locale.Tr "settings.new_password"}}</label> + <input id="password" name="password" type="password" autocomplete="new-password" required> + </div> + <div class="required field {{if .Err_Password}}error{{end}}"> + <label for="retype">{{ctx.Locale.Tr "settings.retype_new_password"}}</label> + <input id="retype" name="retype" type="password" autocomplete="new-password" required> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_password"}}</button> + <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{ctx.Locale.Tr "auth.forgot_password"}}</a> + </div> + </form> + {{else}} + <div class="ui info message"> + <p class="text left">{{ctx.Locale.Tr "settings.password_change_disabled"}}</p> + </div> + {{end}} + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_emails"}} + </h4> + <div class="ui attached segment"> + <div class="ui list"> + {{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"> + {{$.CsrfTokenHtml}} + <input name="_method" type="hidden" value="NOTIFICATION"> + <div class="tw-flex tw-flex-wrap tw-gap-2"> + <div class="ui selection dropdown"> + <input name="preference" type="hidden" value="{{.EmailNotificationsPreference}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text"></div> + <div class="menu"> + <div data-value="enabled" class="{{if eq .EmailNotificationsPreference "enabled"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.enable"}}</div> + <div data-value="andyourown" class="{{if eq .EmailNotificationsPreference "andyourown"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.andyourown"}}</div> + <div data-value="onmention" class="{{if eq .EmailNotificationsPreference "onmention"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.onmention"}}</div> + <div data-value="disabled" class="{{if eq .EmailNotificationsPreference "disabled"}}active selected {{end}}item">{{ctx.Locale.Tr "settings.email_notifications.disable"}}</div> + </div> + </div> + <button class="ui primary button">{{ctx.Locale.Tr "settings.email_notifications.submit"}}</button> + </div> + </form> + </div> + {{end}} + {{range .Emails}} + <div class="item"> + {{if not .IsPrimary}} + <div class="right floated content"> + <button class="ui red tiny button delete-button" data-modal-id="delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_email"}} + </button> + </div> + {{if .CanBePrimary}} + <div class="right floated content"> + <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> + {{$.CsrfTokenHtml}} + <input name="_method" type="hidden" value="PRIMARY"> + <input name="id" type="hidden" value="{{.ID}}"> + <button class="ui primary tiny button">{{ctx.Locale.Tr "settings.primary_email"}}</button> + </form> + </div> + {{end}} + {{end}} + {{if not .IsActivated}} + <div class="right floated content"> + <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> + {{$.CsrfTokenHtml}} + <input name="_method" type="hidden" value="SENDACTIVATION"> + <input name="id" type="hidden" value="{{.ID}}"> + {{if $.ActivationsPending}} + <button disabled class="ui primary tiny button">{{ctx.Locale.Tr "settings.activations_pending"}}</button> + {{else}} + <button class="ui primary tiny button">{{ctx.Locale.Tr "settings.activate_email"}}</button> + {{end}} + </form> + </div> + {{end}} + <div class="content tw-py-2"> + <strong>{{.Email}}</strong> + {{if .IsPrimary}} + <div class="ui primary label">{{ctx.Locale.Tr "settings.primary"}}</div> + {{end}} + {{if .IsActivated}} + <div class="ui green label">{{ctx.Locale.Tr "settings.activated"}}</div> + {{else}} + <div class="ui label">{{ctx.Locale.Tr "settings.requires_activation"}}</div> + {{end}} + </div> + </div> + {{end}} + </div> + </div> + <div class="ui attached bottom segment"> + <form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_Email}}error{{end}}"> + <label for="email">{{ctx.Locale.Tr "settings.add_new_email"}}</label> + <input id="email" name="email" type="email" required {{if not .CanAddEmails}}disabled{{end}}> + </div> + <button class="ui primary button" {{if not .CanAddEmails}}disabled{{end}}> + {{ctx.Locale.Tr "settings.add_email"}} + </button> + </form> + {{/* if ActivationsPending is false, then CanAddEmails must be true, so if CanAddEmails is false, ActivationsPending must be true */}} + {{if not .CanAddEmails}} + <div class="ui warning message">{{ctx.Locale.Tr "settings.can_not_add_email_activations_pending"}}</div> + {{end}} + </div> + + {{if not ($.UserDisabledFeatures.Contains "deletion")}} + <h4 class="ui top attached error header"> + {{ctx.Locale.Tr "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 "settings.delete_prompt"}}</p> + {{if .UserDeleteWithComments}} + <p class="text left tw-font-semibold">{{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime}}</p> + {{end}} + </div> + <form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post"> + {{template "base/disable_form_autofill"}} + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_Password}}error{{end}}"> + <label for="password-confirmation">{{ctx.Locale.Tr "password"}}</label> + <input id="password-confirmation" name="password" type="password" autocomplete="off" required> + </div> + <div class="field"> + <button class="ui red button delete-button" data-modal-id="delete-account" data-type="form" data-form="#delete-form"> + {{ctx.Locale.Tr "settings.confirm_delete_account"}} + </button> + </div> + </form> + <div class="ui g-modal-confirm delete modal" id="delete-account"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.delete_account_title"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.delete_account_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> + </div> + {{end}} + </div> + +<div class="ui g-modal-confirm delete modal" id="delete-email"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.email_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.email_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/actions.tmpl b/templates/user/settings/actions.tmpl new file mode 100644 index 00000000..abc54433 --- /dev/null +++ b/templates/user/settings/actions.tmpl @@ -0,0 +1,12 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings actions")}} + <div class="user-setting-content"> + {{if eq .PageType "secrets"}} + {{template "shared/secrets/add_list" .}} + {{else if eq .PageType "runners"}} + {{template "shared/actions/runner_list" .}} + {{else if eq .PageType "variables"}} + {{template "shared/variables/variable_list" .}} + {{end}} + </div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/appearance.tmpl b/templates/user/settings/appearance.tmpl new file mode 100644 index 00000000..c1d7ac2c --- /dev/null +++ b/templates/user/settings/appearance.tmpl @@ -0,0 +1,189 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings sshkeys")}} + <div class="user-setting-content"> + + <!-- Theme --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_themes"}} + </h4> + <div class="ui attached segment"> + <div class="ui email list"> + <div class="item"> + {{ctx.Locale.Tr "settings.theme_desc"}} + </div> + + <form class="ui form" action="{{.Link}}/theme" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <label for="ui">{{ctx.Locale.Tr "settings.ui"}}</label> + <div class="ui selection dropdown" id="ui"> + <input name="theme" type="hidden" value="{{.SignedUser.Theme}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text"> + {{range $i,$a := .AllThemes}} + {{if eq $.SignedUser.Theme $a}}{{$a}}{{end}} + {{end}} + </div> + + <div class="menu"> + {{range $i,$a := .AllThemes}} + <div class="item{{if eq $.SignedUser.Theme $a}} active selected{{end}}" data-value="{{$a}}"> + {{$a}} + </div> + {{end}} + </div> + </div> + </div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_theme"}}</button> + </div> + </form> + </div> + </div> + + <!-- Language --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.language.title"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}/language" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <div class="ui language selection dropdown" id="language"> + <input name="language" type="hidden" value="{{.SignedUser.Language}}"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="text">{{range .AllLangs}}{{if eq $.SignedUser.Language .Lang}}{{.Name}}{{end}}{{end}}</div> + <div class="menu"> + {{range .AllLangs}} + <div class="item{{if eq $.SignedUser.Language .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div> + {{end}} + </div> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_language"}}</button> + </div> + </form> + </div> + + <!-- Hints --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.hints"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}/hints" method="post"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "settings.additional_repo_units_hint_description"}}"> + <input name="enable_repo_unit_hints" type="checkbox" {{if $.SignedUser.EnableRepoUnitHints}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.additional_repo_units_hint"}}</label> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_hints"}}</button> + </div> + </form> + </div> + + <!-- Shown comment event types --> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.hidden_comment_types"}} + </h4> + <div class="ui attached segment"> + <p class="help"> + {{ctx.Locale.Tr "settings.hidden_comment_types_description"}} + </p> + <form class="ui form" action="{{.Link}}/hidden_comments" method="post"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "settings.hidden_comment_types.ref_tooltip"}}"> + <input name="reference" type="checkbox" {{if(call .IsCommentTypeGroupChecked "reference")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_reference"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="label" type="checkbox" {{if (call .IsCommentTypeGroupChecked "label")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_label"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="milestone" type="checkbox" {{if (call .IsCommentTypeGroupChecked "milestone")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_milestone"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="assignee" type="checkbox" {{if (call .IsCommentTypeGroupChecked "assignee")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_assignee"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="title" type="checkbox" {{if (call .IsCommentTypeGroupChecked "title")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_title"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="branch" type="checkbox" {{if (call .IsCommentTypeGroupChecked "branch")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_branch"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="time_tracking" type="checkbox" {{if (call .IsCommentTypeGroupChecked "time_tracking")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_time_tracking"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="deadline" type="checkbox" {{if (call .IsCommentTypeGroupChecked "deadline")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_deadline"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="dependency" type="checkbox" {{if (call .IsCommentTypeGroupChecked "dependency")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_dependency"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="lock" type="checkbox" {{if (call .IsCommentTypeGroupChecked "lock")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_lock"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="review_request" type="checkbox" {{if (call .IsCommentTypeGroupChecked "review_request")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_review_request"}}</label> + </div> + </div> + + <div class="inline field"> + <div class="ui checkbox"> + <input name="pull_request_push" type="checkbox" {{if (call .IsCommentTypeGroupChecked "pull_request_push")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_pull_request_push"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="project" type="checkbox" {{if (call .IsCommentTypeGroupChecked "project")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_project"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox" data-tooltip-content="{{ctx.Locale.Tr "settings.hidden_comment_types.issue_ref_tooltip"}}"> + <input name="issue_ref" type="checkbox" {{if (call .IsCommentTypeGroupChecked "issue_ref")}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.comment_type_group_issue_ref"}}</label> + </div> + </div> + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "save"}}</button> + </div> + </form> + </div> + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl new file mode 100644 index 00000000..04d4dcdb --- /dev/null +++ b/templates/user/settings/applications.tmpl @@ -0,0 +1,113 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings applications")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_access_token"}} + </h4> + <div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.tokens_desc"}} + </div> + {{range .Tokens}} + <div class="flex-item"> + <div class="flex-item-leading"> + <span class="text {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.token_state_desc"}}"{{end}}> + {{svg "fontawesome-send" 32}} + </span> + </div> + <div class="flex-item-main"> + <details> + <summary><span class="flex-item-title">{{.Name}}</span></summary> + <p class="tw-my-1"> + {{ctx.Locale.Tr "settings.repo_and_org_access"}}: + {{if .DisplayPublicOnly}} + {{ctx.Locale.Tr "settings.permissions_public_only"}} + {{else}} + {{ctx.Locale.Tr "settings.permissions_access_all"}} + {{end}} + </p> + <p class="tw-my-1">{{ctx.Locale.Tr "settings.permissions_list"}}</p> + <ul class="tw-my-1"> + {{range .Scope.StringSlice}} + {{if (ne . $.AccessTokenScopePublicOnly)}} + <li>{{.}}</li> + {{end}} + {{end}} + </ul> + </details> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-token" data-url="{{$.Link}}/delete" data-id="{{.ID}}"> + {{svg "octicon-trash" 16 "tw-mr-1"}} + {{ctx.Locale.Tr "settings.delete_token"}} + </button> + </div> + </div> + {{end}} + </div> + </div> + <div class="ui attached bottom 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"> + <p>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://forgejo.org/docs/latest/user/token-scope/" target="_blank"`|SafeHTML)}}</p> + </p> + <div class="scoped-access-token" + 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"}}" + ></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> + + {{if .EnableOAuth2}} + {{template "user/settings/grants_oauth2" .}} + {{template "user/settings/applications_oauth2" .}} + {{end}} + </div> + +<div class="ui g-modal-confirm delete modal" id="delete-token"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.access_token_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.access_token_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" (dict "ModalButtonColors" "primary")}} +</div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/applications_oauth2.tmpl b/templates/user/settings/applications_oauth2.tmpl new file mode 100644 index 00000000..866a1f87 --- /dev/null +++ b/templates/user/settings/applications_oauth2.tmpl @@ -0,0 +1,6 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_oauth2_applications"}} +</h4> + +{{template "user/settings/applications_oauth2_list" .}} + diff --git a/templates/user/settings/applications_oauth2_edit.tmpl b/templates/user/settings/applications_oauth2_edit.tmpl new file mode 100644 index 00000000..2858ecd0 --- /dev/null +++ b/templates/user/settings/applications_oauth2_edit.tmpl @@ -0,0 +1,6 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings applications")}} + <div class="user-setting-content"> + + {{template "user/settings/applications_oauth2_edit_form" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/applications_oauth2_edit_form.tmpl b/templates/user/settings/applications_oauth2_edit_form.tmpl new file mode 100644 index 00000000..199d43a6 --- /dev/null +++ b/templates/user/settings/applications_oauth2_edit_form.tmpl @@ -0,0 +1,54 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.edit_oauth2_application"}} +</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.oauth2_application_create_description"}}</p> +</div> +<div class="ui attached segment form ignore-dirty"> + {{.CsrfTokenHtml}} + <div class="field"> + <label for="client-id">{{ctx.Locale.Tr "settings.oauth2_client_id"}}</label> + <input id="client-id" readonly value="{{.App.ClientID}}"> + </div> + {{if .ClientSecret}} + <div class="field"> + <label for="client-secret">{{ctx.Locale.Tr "settings.oauth2_client_secret"}}</label> + <input id="client-secret" type="text" readonly value="{{.ClientSecret}}"> + </div> + {{else}} + <div class="field"> + <label for="client-secret">{{ctx.Locale.Tr "settings.oauth2_client_secret"}}</label> + <input id="client-secret" type="password" readonly value="averysecuresecret"> + </div> + {{end}} + <div class="item"> + <!-- TODO add regenerate secret functionality */ --> + <form class="ui form ignore-dirty" action="{{.FormActionPath}}/regenerate_secret" method="post"> + {{.CsrfTokenHtml}} + {{ctx.Locale.Tr "settings.oauth2_regenerate_secret_hint"}} + <button class="ui mini button tw-ml-2" type="submit">{{ctx.Locale.Tr "settings.oauth2_regenerate_secret"}}</button> + </form> + </div> +</div> +<div class="ui attached bottom segment"> + <form class="ui form ignore-dirty" action="{{.FormActionPath}}" 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" value="{{.App.Name}}" name="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" required>{{StringUtils.Join .App.RedirectURIs "\n"}}</textarea> + </div> + <div class="field {{if .Err_ConfidentialClient}}error{{end}}"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label> + <input type="checkbox" name="confidential_client" {{if .App.ConfidentialClient}}checked{{end}}> + </div> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.save_application"}} + </button> + </form> +</div> diff --git a/templates/user/settings/applications_oauth2_list.tmpl b/templates/user/settings/applications_oauth2_list.tmpl new file mode 100644 index 00000000..74cdac49 --- /dev/null +++ b/templates/user/settings/applications_oauth2_list.tmpl @@ -0,0 +1,74 @@ +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.oauth2_application_create_description"}} + </div> + {{range .Applications}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "octicon-apps" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + {{ctx.Locale.Tr "settings.oauth2_client_id"}} + <span class="ui label">{{.ClientID}}</span> + </div> + </div> + {{$isBuiltin := and $.BuiltinApplications (index $.BuiltinApplications .ClientID)}} + <div class="flex-item-trailing"> + {{if $isBuiltin}} + <span class="ui basic label" data-tooltip-content="{{ctx.Locale.Tr "settings.oauth2_application_locked"}}">{{ctx.Locale.Tr "locked"}}</span> + {{else}} + <a href="{{$.Link}}/oauth2/{{.ID}}" class="ui primary tiny button"> + {{svg "octicon-pencil" 16 "tw-mr-1"}} + {{ctx.Locale.Tr "settings.oauth2_application_edit"}} + </a> + <button class="ui red tiny button delete-button" data-modal-id="remove-gitea-oauth2-application" + data-url="{{$.Link}}/oauth2/{{.ID}}/delete"> + {{svg "octicon-trash" 16 "tw-mr-1"}} + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + {{end}} + </div> + </div> + {{end}} + </div> + + <div class="ui g-modal-confirm delete modal" id="remove-gitea-oauth2-application"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.remove_oauth2_application"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.oauth2_application_remove_description"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> + +<div class="ui attached bottom 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" required></textarea> + </div> + <div class="field {{if .Err_ConfidentialClient}}error{{end}}"> + <div class="ui checkbox"> + <label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label> + <input type="checkbox" name="confidential_client" checked> + </div> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.create_oauth2_application_button"}} + </button> + </form> +</div> diff --git a/templates/user/settings/blocked_users.tmpl b/templates/user/settings/blocked_users.tmpl new file mode 100644 index 00000000..5256503e --- /dev/null +++ b/templates/user/settings/blocked_users.tmpl @@ -0,0 +1,10 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings blocked-users")}} +<div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.blocked_users"}} + </h4> + <div class="ui attached segment"> + {{template "shared/blocked_users_list" .}} + </div> +</div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/grants_oauth2.tmpl b/templates/user/settings/grants_oauth2.tmpl new file mode 100644 index 00000000..e89d2756 --- /dev/null +++ b/templates/user/settings/grants_oauth2.tmpl @@ -0,0 +1,40 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.authorized_oauth2_applications"}} +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.authorized_oauth2_applications_description"}} + </div> + {{range .Grants}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg "octicon-key" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Application.Name}}</div> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="revoke-gitea-oauth2-grant" + data-url="{{AppSubUrl}}/user/settings/applications/oauth2/{{.ApplicationID}}/revoke/{{.ID}}"> + {{ctx.Locale.Tr "settings.revoke_key"}} + </button> + </div> + </div> + {{end}} + </div> + + <div class="ui g-modal-confirm delete modal" id="revoke-gitea-oauth2-grant"> + <div class="header"> + {{svg "octicon-shield" 16 "tw-mr-1"}} + {{ctx.Locale.Tr "settings.revoke_oauth2_grant"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.revoke_oauth2_grant_description"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/hook_new.tmpl b/templates/user/settings/hook_new.tmpl new file mode 100644 index 00000000..be21f59b --- /dev/null +++ b/templates/user/settings/hook_new.tmpl @@ -0,0 +1,7 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings new webhook")}} + <div class="user-setting-content"> + {{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}} + {{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}} + {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/hooks.tmpl b/templates/user/settings/hooks.tmpl new file mode 100644 index 00000000..477c3332 --- /dev/null +++ b/templates/user/settings/hooks.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings webhooks")}} + <div class="user-setting-content"> + {{template "repo/settings/webhook/list" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/keys.tmpl b/templates/user/settings/keys.tmpl new file mode 100644 index 00000000..e0f5e426 --- /dev/null +++ b/templates/user/settings/keys.tmpl @@ -0,0 +1,11 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings sshkeys")}} + <div class="user-setting-content"> + {{if not ($.UserDisabledFeatures.Contains "manage_ssh_keys")}} + {{template "user/settings/keys_ssh" .}} + {{end}} + {{template "user/settings/keys_principal" .}} + {{if not ($.UserDisabledFeatures.Contains "manage_gpg_keys")}} + {{template "user/settings/keys_gpg" .}} + {{end}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl new file mode 100644 index 00000000..f5e91ced --- /dev/null +++ b/templates/user/settings/keys_gpg.tmpl @@ -0,0 +1,129 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_gpg_keys"}} + <div class="ui right"> + <button class="ui primary tiny show-panel toggle button" data-panel="#add-gpg-key-panel">{{ctx.Locale.Tr "settings.add_key"}}</button> + </div> +</h4> +<div class="ui attached segment"> + <div class="{{if not .HasGPGError}}tw-hidden{{end}} tw-mb-4" id="add-gpg-key-panel"> + <form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <input type="hidden" name="title" value="none"> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="gpg-key-content">{{ctx.Locale.Tr "settings.key_content"}}</label> + <textarea id="gpg-key-content" name="content" placeholder="{{ctx.Locale.Tr "settings.key_content_gpg_placeholder"}}" required>{{.content}}</textarea> + </div> + {{if .Err_Signature}} + <div class="ui error message"> + <p>{{ctx.Locale.Tr "settings.gpg_token_required"}}</p> + </div> + <div class="field"> + <label for="token">{{ctx.Locale.Tr "settings.gpg_token"}}</label> + <input readonly="" value="{{.TokenToSign}}"> + <div class="help"> + <p>{{ctx.Locale.Tr "settings.gpg_token_help"}}</p> + <p><code>{{printf `echo "%s" | gpg -a --default-key %s --detach-sig` .TokenToSign .PaddedKeyID}}</code></p> + </div> + </div> + <div class="field"> + <label for="gpg-key-signature">{{ctx.Locale.Tr "settings.gpg_token_signature"}}</label> + <textarea id="gpg-key-signature" name="signature" placeholder="{{ctx.Locale.Tr "settings.key_signature_gpg_placeholder"}}" required>{{.signature}}</textarea> + </div> + {{end}} + <input name="type" type="hidden" value="gpg"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_key"}} + </button> + <button class="ui hide-panel button" data-panel="#add-gpg-key-panel"> + {{ctx.Locale.Tr "cancel"}} + </button> + </form> + </div> + <div class="flex-list"> + <div class="flex-item"> + <p> + {{ctx.Locale.Tr "settings.gpg_desc"}}<br> + {{ctx.Locale.Tr "settings.gpg_helper" "https://docs.codeberg.org/security/gpg-key/"}} + </p> + </div> + {{range .GPGKeys}} + <div class="flex-item"> + <div class="flex-item-leading"> + <span class="text {{if or .ExpiredUnix.IsZero ($.PageStartTime.Before .ExpiredUnix.AsTime)}}green{{end}}">{{svg "octicon-key" 32}}</span> + </div> + <div class="flex-item-main"> + {{if .Verified}} + <span class="flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.gpg_key_verified_long"}}">{{svg "octicon-verified"}} <strong>{{ctx.Locale.Tr "settings.gpg_key_verified"}}</strong></span> + {{end}} + {{if .Emails}} + <span class="flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.gpg_key_matched_identities_long"}}">{{svg "octicon-mail"}} {{ctx.Locale.Tr "settings.gpg_key_matched_identities"}} {{range .Emails}}<strong>{{.Email}} </strong>{{end}}</span> + {{end}} + <div class="flex-item-body"> + <b>{{ctx.Locale.Tr "settings.key_id"}}:</b> {{.PaddedKeyID}} + <b>{{ctx.Locale.Tr "settings.subkeys"}}:</b> {{range .SubsKey}} {{.PaddedKeyID}} {{end}} + </div> + <div class="flex-item-body"> + <p> + {{ctx.Locale.Tr "settings.added_on" (DateTime "short" .AddedUnix)}} + - + {{if not .ExpiredUnix.IsZero}} + {{ctx.Locale.Tr "settings.valid_until_date" (DateTime "short" .ExpiredUnix)}} + {{else}} + {{ctx.Locale.Tr "settings.valid_forever"}} + {{end}} + </p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-gpg" data-url="{{$.Link}}/delete?type=gpg" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + {{if and (not .Verified) (ne $.VerifyingID .KeyID)}} + <a class="ui primary tiny button" href="?verify_gpg={{.KeyID}}">{{ctx.Locale.Tr "settings.gpg_key_verify"}}</a> + {{end}} + </div> + </div> + {{if and (not .Verified) (eq $.VerifyingID .KeyID)}} + <div class="ui segment"> + <h4>{{ctx.Locale.Tr "settings.gpg_token_required"}}</h4> + <form class="ui form{{if $.HasGPGVerifyError}} error{{end}}" action="{{$.Link}}" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="title" value="none"> + <input type="hidden" name="content" value="{{.KeyID}}"> + <input type="hidden" name="key_id" value="{{.KeyID}}"> + <div class="field"> + <label for="token">{{ctx.Locale.Tr "settings.gpg_token"}}</label> + <input readonly="" value="{{$.TokenToSign}}"> + <div class="help"> + <p>{{ctx.Locale.Tr "settings.gpg_token_help"}}</p> + <p><code>{{printf `echo "%s" | gpg -a --default-key %s --detach-sig` $.TokenToSign .PaddedKeyID}}</code></p> + </div> + <br> + </div> + <div class="field"> + <label for="signature">{{ctx.Locale.Tr "settings.gpg_token_signature"}}</label> + <textarea id="gpg-key-signature" name="signature" placeholder="{{ctx.Locale.Tr "settings.key_signature_gpg_placeholder"}}" required>{{$.signature}}</textarea> + </div> + <input name="type" type="hidden" value="verify_gpg"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.gpg_key_verify"}} + </button> + <a class="ui red button" href="{{$.Link}}"> + {{ctx.Locale.Tr "settings.cancel"}} + </a> + </form> + </div> + {{end}} + {{end}} + </div> + <div class="ui g-modal-confirm delete modal" id="delete-gpg"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.gpg_key_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.gpg_key_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/keys_principal.tmpl b/templates/user/settings/keys_principal.tmpl new file mode 100644 index 00000000..94b1b2c8 --- /dev/null +++ b/templates/user/settings/keys_principal.tmpl @@ -0,0 +1,69 @@ +{{if .AllowPrincipals}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_ssh_principals"}} + <div class="ui right"> + {{if not .DisableSSH}} + <button class="ui primary tiny show-panel button" data-panel="#add-ssh-principal-panel">{{ctx.Locale.Tr "settings.add_new_principal"}}</button> + {{else}} + <button class="ui primary tiny button disabled">{{ctx.Locale.Tr "settings.ssh_disabled"}}</button> + {{end}} + </div> + </h4> + <div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.principal_desc"}} + </div> + {{range .Principals}} + <div class="flex-item"> + <div class="flex-item-leading"> + <span class="text {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.principal_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span> + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-principal" data-url="{{$.Link}}/delete?type=principal" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + </div> + <br> + + <div {{if not .HasPrincipalError}}class="tw-hidden"{{end}} id="add-ssh-principal-panel"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.add_new_principal"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="ssh-principal-content">{{ctx.Locale.Tr "settings.principal_content"}}</label> + <input id="ssh-principal-content" name="content" value="{{.content}}" autofocus required> + </div> + <input name="title" type="hidden" value="principal"> + <input name="type" type="hidden" value="principal"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_new_principal"}} + </button> + </form> + </div> + </div> + + <div class="ui g-modal-confirm delete modal" id="delete-principal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.ssh_principal_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.ssh_principal_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +{{end}} diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl new file mode 100644 index 00000000..058dc9ce --- /dev/null +++ b/templates/user/settings/keys_ssh.tmpl @@ -0,0 +1,111 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_ssh_keys"}} + <div class="ui right"> + <button id="add-ssh-button" class="ui primary tiny show-panel toggle button" data-panel="#add-ssh-key-panel"> + {{ctx.Locale.Tr "settings.add_key"}} + </button> + </div> +</h4> +<div class="ui attached segment"> + <div class="{{if not .HasSSHError}}tw-hidden{{end}} tw-mb-4" id="add-ssh-key-panel"> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="field {{if .Err_Title}}error{{end}}"> + <label for="ssh-key-title">{{ctx.Locale.Tr "settings.key_name"}}</label> + <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required maxlength="50"> + </div> + <div class="field {{if .Err_Content}}error{{end}}"> + <label for="ssh-key-content">{{ctx.Locale.Tr "settings.key_content"}}</label> + <textarea id="ssh-key-content" name="content" class="js-quick-submit" placeholder="{{ctx.Locale.Tr "settings.key_content_ssh_placeholder"}}" required>{{.content}}</textarea> + </div> + <input name="type" type="hidden" value="ssh"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_key"}} + </button> + <button id="cancel-ssh-button" class="ui hide-panel button" data-panel="#add-ssh-key-panel"> + {{ctx.Locale.Tr "cancel"}} + </button> + </form> + </div> + <div id="keys-ssh" class="flex-list"> + <div class="flex-item"> + <p> + {{ctx.Locale.Tr "settings.ssh_desc"}}<br> + {{ctx.Locale.Tr "settings.ssh_helper" "https://docs.codeberg.org/security/ssh-key/" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/troubleshooting-ssh"}} + </p> + </div> + {{if .DisableSSH}} + <div class="flex-item"> + {{ctx.Locale.Tr "settings.ssh_signonly"}} + </div> + {{end}} + {{range $index, $key := .Keys}} + <div class="flex-item"> + <div class="flex-item-leading"> + <span class="text {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.key_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span> + </div> + <div class="flex-item-main"> + {{if .Verified}} + <div class="flex-item-title flex-text-block" data-tooltip-content="{{ctx.Locale.Tr "settings.ssh_key_verified_long"}}">{{svg "octicon-verified"}}{{ctx.Locale.Tr "settings.ssh_key_verified"}}</div> + {{end}} + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + {{.Fingerprint}} + </div> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button{{if index $.ExternalKeys $index}} disabled{{end}}" data-modal-id="delete-ssh" data-url="{{$.Link}}/delete?type=ssh" data-id="{{.ID}}"{{if index $.ExternalKeys $index}} title="{{ctx.Locale.Tr "settings.ssh_externally_managed"}}"{{end}}> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + {{if and (not .Verified) (ne $.VerifyingFingerprint .Fingerprint)}} + <a class="ui primary tiny button" href="?verify_ssh={{.Fingerprint}}">{{ctx.Locale.Tr "settings.ssh_key_verify"}}</a> + {{end}} + </div> + </div> + {{if and (not .Verified) (eq $.VerifyingFingerprint .Fingerprint)}} + <div class="ui segment"> + <h4>{{ctx.Locale.Tr "settings.ssh_token_required"}}</h4> + <form class="ui form{{if $.HasSSHVerifyError}} error{{end}}" action="{{$.Link}}" method="post"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="title" value="none"> + <input type="hidden" name="content" value="{{.Content}}"> + <input type="hidden" name="fingerprint" value="{{.Fingerprint}}"> + <div class="field"> + <label for="token">{{ctx.Locale.Tr "settings.ssh_token"}}</label> + <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> + </div> + <br> + </div> + <div class="field"> + <label for="signature">{{ctx.Locale.Tr "settings.ssh_token_signature"}}</label> + <textarea id="ssh-key-signature" name="signature" class="js-quick-submit" placeholder="{{ctx.Locale.Tr "settings.key_signature_ssh_placeholder"}}" required>{{$.signature}}</textarea> + </div> + <input name="type" type="hidden" value="verify_ssh"> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.ssh_key_verify"}} + </button> + <a class="ui red button" href="{{$.Link}}"> + {{ctx.Locale.Tr "settings.cancel"}} + </a> + </form> + </div> + {{end}} + {{end}} + </div> + <div class="ui g-modal-confirm delete modal" id="delete-ssh"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.ssh_key_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.ssh_key_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/layout_footer.tmpl b/templates/user/settings/layout_footer.tmpl new file mode 100644 index 00000000..46120d51 --- /dev/null +++ b/templates/user/settings/layout_footer.tmpl @@ -0,0 +1,11 @@ +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} +<div class="page-content"> + <div class="user-layout-right"> + <div> + {{/* block: user-setting-content */}} +{{end}} + + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/user/settings/layout_head.tmpl b/templates/user/settings/layout_head.tmpl new file mode 100644 index 00000000..dce496e7 --- /dev/null +++ b/templates/user/settings/layout_head.tmpl @@ -0,0 +1,13 @@ +{{template "base/head" .ctxData}} +<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}"> + <div class="ui container flex-container"> + {{template "user/settings/navbar" .ctxData}} + <div class="flex-container-main"> + {{template "base/alert" .ctxData}} + {{/* block: user-setting-content */}} + +{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}} + </div> + </div> +</div> +{{end}} diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl new file mode 100644 index 00000000..d45d89ee --- /dev/null +++ b/templates/user/settings/navbar.tmpl @@ -0,0 +1,58 @@ +<div class="flex-container-nav"> + <div class="ui fluid vertical menu"> + <div class="header item">{{ctx.Locale.Tr "user.settings"}}</div> + <a class="{{if .PageIsSettingsProfile}}active {{end}}item" href="{{AppSubUrl}}/user/settings"> + {{ctx.Locale.Tr "settings.profile"}} + </a> + <a class="{{if .PageIsSettingsAccount}}active {{end}}item" href="{{AppSubUrl}}/user/settings/account"> + {{ctx.Locale.Tr "settings.account"}} + </a> + <a class="{{if .PageIsSettingsAppearance}}active {{end}}item" href="{{AppSubUrl}}/user/settings/appearance"> + {{ctx.Locale.Tr "settings.appearance"}} + </a> + <a class="{{if .PageIsSettingsSecurity}}active {{end}}item" href="{{AppSubUrl}}/user/settings/security"> + {{ctx.Locale.Tr "settings.security"}} + </a> + <a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{AppSubUrl}}/user/settings/applications"> + {{ctx.Locale.Tr "settings.applications"}} + </a> + <a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{AppSubUrl}}/user/settings/keys"> + {{ctx.Locale.Tr "settings.ssh_gpg_keys"}} + </a> + {{if .EnableActions}} + <details class="item toggleable-item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables}}open{{end}}> + <summary>{{ctx.Locale.Tr "actions.actions"}}</summary> + <div class="menu"> + <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{AppSubUrl}}/user/settings/actions/runners"> + {{ctx.Locale.Tr "actions.runners"}} + </a> + <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{AppSubUrl}}/user/settings/actions/secrets"> + {{ctx.Locale.Tr "secrets.secrets"}} + </a> + <a class="{{if .PageIsSharedSettingsVariables}}active {{end}}item" href="{{AppSubUrl}}/user/settings/actions/variables"> + {{ctx.Locale.Tr "actions.variables"}} + </a> + </div> + </details> + {{end}} + {{if .EnablePackages}} + <a class="{{if .PageIsSettingsPackages}}active {{end}}item" href="{{AppSubUrl}}/user/settings/packages"> + {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} + {{if not DisableWebhooks}} + <a class="{{if .PageIsSettingsHooks}}active {{end}}item" href="{{AppSubUrl}}/user/settings/hooks"> + {{ctx.Locale.Tr "repo.settings.hooks"}} + </a> + {{end}} + <a class="{{if .PageIsSettingsOrganization}}active {{end}}item" href="{{AppSubUrl}}/user/settings/organization"> + {{ctx.Locale.Tr "settings.organization"}} + </a> + <a class="{{if .PageIsSettingsRepos}}active {{end}}item" href="{{AppSubUrl}}/user/settings/repos"> + {{ctx.Locale.Tr "settings.repos"}} + </a> + <a class="{{if .PageIsBlockedUsers}}active {{end}}item" href="{{AppSubUrl}}/user/settings/blocked_users"> + {{ctx.Locale.Tr "settings.blocked_users"}} + </a> + </div> +</div> diff --git a/templates/user/settings/organization.tmpl b/templates/user/settings/organization.tmpl new file mode 100644 index 00000000..16c27b52 --- /dev/null +++ b/templates/user/settings/organization.tmpl @@ -0,0 +1,55 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings organization")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.orgs"}} + {{if .SignedUser.CanCreateOrganization}} + <div class="ui right"> + <a class="ui primary tiny button" href="{{AppSubUrl}}/org/create">{{ctx.Locale.Tr "admin.orgs.new_orga"}}</a> + </div> + {{end}} + </h4> + <div class="ui attached segment orgs"> + {{if .Orgs}} + <div class="flex-list"> + {{range .Orgs}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{ctx.AvatarUtils.Avatar . 28 "mini"}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{template "shared/user/name" .}}</div> + <div class="flex-text-body"> + {{.Description}} + </div> + </div> + <div class="flex-item-trailing"> + <form> + {{$.CsrfTokenHtml}} + <button class="ui red button delete-button" data-modal-id="leave-organization" + data-url="{{.OrganisationLink}}/members/action/leave" data-datauid="{{$.SignedUser.ID}}" + data-name="{{$.SignedUser.DisplayName}}" + data-data-organization-name="{{.DisplayName}}">{{ctx.Locale.Tr "org.members.leave"}} + </button> + </form> + </div> + </div> + {{end}} + </div> + {{template "base/paginate" .}} + {{else}} + {{ctx.Locale.Tr "settings.orgs_none"}} + {{end}} + </div> + </div> + +<div class="ui g-modal-confirm delete modal" id="leave-organization"> + <div class="header"> + {{ctx.Locale.Tr "org.members.leave"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "org.members.leave.detail" (`<span class="dataOrganizationName"></span>`|SafeHTML)}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/packages.tmpl b/templates/user/settings/packages.tmpl new file mode 100644 index 00000000..bd7d69b2 --- /dev/null +++ b/templates/user/settings/packages.tmpl @@ -0,0 +1,24 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings packages")}} + <div class="user-setting-content"> + {{template "package/shared/cleanup_rules/list" .}} + {{template "package/shared/cargo" .}} + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "packages.owner.settings.chef.title"}} + </h4> + <div class="ui attached segment"> + <div class="ui form"> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.owner.settings.chef.keypair.description"}}</label> + </div> + <form class="field" action="{{.Link}}/chef/regenerate_keypair" method="post"> + {{.CsrfTokenHtml}} + <button class="ui primary button">{{ctx.Locale.Tr "packages.owner.settings.chef.keypair"}}</button> + </form> + <div class="field"> + <label>{{ctx.Locale.Tr "packages.registry.documentation" "Chef" "https://forgejo.org/docs/latest/user/packages/chef/"}}</label> + </div> + </div> + </div> + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/packages_cleanup_rules_edit.tmpl b/templates/user/settings/packages_cleanup_rules_edit.tmpl new file mode 100644 index 00000000..522b5248 --- /dev/null +++ b/templates/user/settings/packages_cleanup_rules_edit.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings packages")}} + <div class="user-setting-content"> + {{template "package/shared/cleanup_rules/edit" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/packages_cleanup_rules_preview.tmpl b/templates/user/settings/packages_cleanup_rules_preview.tmpl new file mode 100644 index 00000000..d99aee4b --- /dev/null +++ b/templates/user/settings/packages_cleanup_rules_preview.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user packages admin")}} + <div class="user-setting-content"> + {{template "package/shared/cleanup_rules/preview" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl new file mode 100644 index 00000000..cd6efbfc --- /dev/null +++ b/templates/user/settings/profile.tmpl @@ -0,0 +1,164 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings profile")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.public_profile"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.profile_desc"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_Name}}error{{end}}"> + <label for="username">{{ctx.Locale.Tr "username"}} + <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) .IsReverseProxy}}disabled{{end}} maxlength="40"> + {{if or (not .SignedUser.IsLocal) .IsReverseProxy}} + <p class="help text blue">{{ctx.Locale.Tr "settings.password_username_disabled"}}</p> + {{end}} + </div> + <div class="field {{if .Err_FullName}}error{{end}}"> + <label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label> + <input id="full_name" name="full_name" value="{{.SignedUser.FullName}}" maxlength="100"> + </div> + <div class="inline field"> + <span class="inline field"><label for="pronouns">{{ctx.Locale.Tr "settings.pronouns"}}</label></span> + <div id="pronouns-dropdown" style="display: none" class="ui selection dropdown"> + <input type="hidden" value="{{.SignedUser.Pronouns}}"> + <div class="text"> + {{if .PronounsAreCustom}} + {{ctx.Locale.Tr "settings.pronouns_custom"}} + {{else if eq "" .SignedUser.Pronouns}} + {{ctx.Locale.Tr "settings.pronouns_unspecified"}} + {{else}} + {{.SignedUser.Pronouns}} + {{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item{{if eq "" .SignedUser.Pronouns}} active selected{{end}}" data-value=""><p>{{ctx.Locale.Tr "settings.pronouns_unspecified"}}</p></div> + <div class="item{{if eq "he/him" .SignedUser.Pronouns}} active selected{{end}}" data-value="he/him">he/him</div> + <div class="item{{if eq "she/her" .SignedUser.Pronouns}} active selected{{end}}" data-value="she/her">she/her</div> + <div class="item{{if eq "they/them" .SignedUser.Pronouns}} active selected{{end}}" data-value="they/them">they/them</div> + <div class="item{{if eq "it/its" .SignedUser.Pronouns}} active selected{{end}}" data-value="it/its">it/its</div> + <div class="item{{if eq "any pronouns" .SignedUser.Pronouns}} active selected{{end}}" data-value="any pronouns">any pronouns</div> + {{if .PronounsAreCustom}} + <div class="item active selected" data-value="{{.SignedUser.Pronouns}}"><p>{{ctx.Locale.Tr "settings.pronouns_custom"}}</p></div> + {{else}} + <div class="item" data-value="!"><i>{{ctx.Locale.Tr "settings.pronouns_custom"}}</i></div> + {{end}} + </div> + </div> + <input id="pronouns-custom" name="pronouns" value="{{.SignedUser.Pronouns}}" maxlength="50"> + </div> + <div class="field {{if .Err_Email}}error{{end}}"> + <label>{{ctx.Locale.Tr "email"}}</label> + <p id="signed-user-email">{{.SignedUser.Email}}</p> + </div> + <div class="field {{if .Err_Biography}}error{{end}}"> + <label for="biography">{{ctx.Locale.Tr "user.user_bio"}}</label> + <textarea id="biography" name="biography" rows="2" placeholder="{{ctx.Locale.Tr "settings.biography_placeholder"}}" maxlength="255">{{.SignedUser.Description}}</textarea> + </div> + <div class="field {{if .Err_Website}}error{{end}}"> + <label for="website">{{ctx.Locale.Tr "settings.website"}}</label> + <input id="website" name="website" type="url" value="{{.SignedUser.Website}}" maxlength="255"> + </div> + <div class="field"> + <label for="location">{{ctx.Locale.Tr "settings.location"}}</label> + <input id="location" name="location" placeholder="{{ctx.Locale.Tr "settings.location_placeholder"}}" value="{{.SignedUser.Location}}" maxlength="50"> + </div> + + <div class="divider"></div> + <!-- private block --> + + <div class="field" id="privacy-user-settings"> + <label><strong>{{ctx.Locale.Tr "settings.privacy"}}</strong></label> + </div> + + <div class="inline field {{if .Err_Visibility}}error{{end}}"> + <span class="inline required field"><label>{{ctx.Locale.Tr "settings.visibility"}}</label></span> + <div class="ui selection type dropdown"> + {{if .SignedUser.Visibility.IsPublic}}<input type="hidden" id="visibility" name="visibility" value="0">{{end}} + {{if .SignedUser.Visibility.IsLimited}}<input type="hidden" id="visibility" name="visibility" value="1">{{end}} + {{if .SignedUser.Visibility.IsPrivate}}<input type="hidden" id="visibility" name="visibility" value="2">{{end}} + <div class="text"> + {{if .SignedUser.Visibility.IsPublic}}{{ctx.Locale.Tr "settings.visibility.public"}}{{end}} + {{if .SignedUser.Visibility.IsLimited}}{{ctx.Locale.Tr "settings.visibility.limited"}}{{end}} + {{if .SignedUser.Visibility.IsPrivate}}{{ctx.Locale.Tr "settings.visibility.private"}}{{end}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + {{range $mode := .AllowedUserVisibilityModes}} + {{if $mode.IsPublic}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.public_tooltip"}}" data-value="0">{{ctx.Locale.Tr "settings.visibility.public"}}</div> + {{else if $mode.IsLimited}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.limited_tooltip"}}" data-value="1">{{ctx.Locale.Tr "settings.visibility.limited"}}</div> + {{else if $mode.IsPrivate}} + <div class="item" data-tooltip-content="{{ctx.Locale.Tr "settings.visibility.private_tooltip"}}" data-value="2">{{ctx.Locale.Tr "settings.visibility.private"}}</div> + {{end}} + {{end}} + </div> + </div> + </div> + + <div class="field"> + <div class="ui checkbox"> + <label data-tooltip-content="{{ctx.Locale.Tr "settings.keep_email_private_popup" .SignedUser.GetPlaceholderEmail}}"><strong>{{ctx.Locale.Tr "settings.keep_email_private"}}</strong></label> + <input name="keep_email_private" type="checkbox" {{if .SignedUser.KeepEmailPrivate}}checked{{end}}> + </div> + </div> + + <div class="field"> + <div class="ui checkbox" id="keep-activity-private"> + <label data-tooltip-content="{{ctx.Locale.Tr "settings.keep_activity_private_popup"}}"><strong>{{ctx.Locale.Tr "settings.keep_activity_private"}}</strong></label> + <input name="keep_activity_private" type="checkbox" {{if .SignedUser.KeepActivityPrivate}}checked{{end}}> + </div> + </div> + + <div class="divider"></div> + + <div class="field"> + <button class="ui primary button">{{ctx.Locale.Tr "settings.update_profile"}}</button> + </div> + </form> + </div> + + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.avatar"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + {{if not .DisableGravatar}} + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.lookup_avatar_by_mail"}}</label> + </div> + </div> + <div class="field tw-pl-4 {{if .Err_Gravatar}}error{{end}}"> + <label for="gravatar">Avatar {{ctx.Locale.Tr "email"}}</label> + <input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}"> + </div> + {{end}} + + <div class="inline field"> + <div class="ui radio checkbox"> + <input name="source" value="local" type="radio" {{if .SignedUser.UseCustomAvatar}}checked{{end}}> + <label>{{ctx.Locale.Tr "settings.enable_custom_avatar"}}</label> + </div> + </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"> + <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 "user/settings/layout_footer" .}} diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl new file mode 100644 index 00000000..09b00f0c --- /dev/null +++ b/templates/user/settings/repos.tmpl @@ -0,0 +1,130 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings repos")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.repos"}} + </h4> + <div class="ui attached segment"> + {{if or .allowAdopt .allowDelete}} + {{if .Dirs}} + <div class="ui list"> + {{range $dirI, $dir := .Dirs}} + {{$repo := index $.ReposMap $dir}} + <div class="item {{if not $repo}}tw-py-1{{end}}">{{/* if not repo, then there are "adapt" buttons, so the padding shouldn't be that default large*/}} + <div class="content"> + {{if $repo}} + {{if $repo.IsPrivate}} + <span class="text gold icon">{{svg "octicon-lock"}}</span> + {{else if $repo.IsFork}} + <span class="icon">{{svg "octicon-repo-forked"}}</span> + {{else if $repo.IsMirror}} + <span class="icon">{{svg "octicon-mirror"}}</span> + {{else if $repo.IsTemplate}} + <span class="icon">{{svg "octicon-repo-template"}}</span> + {{else}} + <span class="icon">{{svg "octicon-repo"}}</span> + {{end}} + <a class="muted name" href="{{$repo.Link}}">{{$repo.OwnerName}}/{{$repo.Name}}</a> + <span class="text light-3" {{if not (eq $repo.Size 0)}} data-tooltip-content="{{$repo.SizeDetailsString ctx.Locale}}"{{end}}>{{ctx.Locale.TrSize $repo.Size}}</span> + {{if $repo.IsFork}} + {{ctx.Locale.Tr "repo.forked_from"}} + <span><a href="{{$repo.BaseRepo.Link}}">{{$repo.BaseRepo.OwnerName}}/{{$repo.BaseRepo.Name}}</a></span> + {{end}} + {{else}} + <span class="icon tw-inline-block tw-pt-2">{{svg "octicon-file-directory-fill"}}</span> + <span class="name tw-inline-block tw-pt-2">{{$.ContextUser.Name}}/{{$dir}}</span> + <div class="tw-float-right"> + {{if $.allowAdopt}} + <button class="ui button primary show-modal tw-p-2" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{ctx.Locale.Tr "repo.adopt_preexisting_label"}}</span></button> + <div class="ui g-modal-confirm modal" id="adopt-unadopted-modal-{{$dirI}}"> + <div class="header"> + <span class="label">{{ctx.Locale.Tr "repo.adopt_preexisting"}}</span> + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.adopt_preexisting_content" $dir}}</p> + </div> + <form class="ui form" method="post" action="{{AppSubUrl}}/user/settings/repos/unadopted"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{$dir}}"> + <input type="hidden" name="action" value="adopt"> + {{template "base/modal_actions_confirm" $}} + </form> + </div> + {{end}} + {{if $.allowDelete}} + <button class="ui button red show-modal tw-p-2" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{ctx.Locale.Tr "repo.delete_preexisting_label"}}</span></button> + <div class="ui g-modal-confirm modal" id="delete-unadopted-modal-{{$dirI}}"> + <div class="header"> + <span class="label">{{ctx.Locale.Tr "repo.delete_preexisting"}}</span> + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.delete_preexisting_content" $dir}}</p> + </div> + <form class="ui form" method="post" action="{{AppSubUrl}}/user/settings/repos/unadopted"> + {{$.CsrfTokenHtml}} + <input type="hidden" name="id" value="{{$dir}}"> + <input type="hidden" name="action" value="delete"> + {{template "base/modal_actions_confirm" $}} + </form> + </div> + {{end}} + </div> + {{end}} + </div> + </div> + {{end}} + </div> + {{template "base/paginate" .}} + {{else}} + <div class="item"> + {{ctx.Locale.Tr "settings.repos_none"}} + </div> + {{end}} + {{else}} + {{if .Repos}} + <div class="ui middle aligned divided list"> + {{range .Repos}} + <div class="item"> + <div class="content"> + {{if .IsPrivate}} + {{svg "octicon-lock" 16 "tw-mr-1 iconFloat text gold"}} + {{else if .IsFork}} + {{svg "octicon-repo-forked" 16 "tw-mr-1 iconFloat"}} + {{else if .IsMirror}} + {{svg "octicon-mirror" 16 "tw-mr-1 iconFloat"}} + {{else if .IsTemplate}} + {{svg "octicon-repo-template" 16 "tw-mr-1 iconFloat"}} + {{else}} + {{svg "octicon-repo" 16 "tw-mr-1 iconFloat"}} + {{end}} + <a class="name" href="{{.Link}}">{{.OwnerName}}/{{.Name}}</a> + <span>{{ctx.Locale.TrSize .Size}}</span> + {{if .IsFork}} + {{ctx.Locale.Tr "repo.forked_from"}} + <span><a href="{{.BaseRepo.Link}}">{{.BaseRepo.OwnerName}}/{{.BaseRepo.Name}}</a></span> + {{end}} + </div> + </div> + {{end}} + </div> + {{template "base/paginate" .}} + {{else}} + <div class="item"> + {{ctx.Locale.Tr "settings.repos_none"}} + </div> + {{end}} + {{end}} + </div> + </div> + +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.remove_account_link"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.remove_account_link_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/runner_edit.tmpl b/templates/user/settings/runner_edit.tmpl new file mode 100644 index 00000000..90c58c16 --- /dev/null +++ b/templates/user/settings/runner_edit.tmpl @@ -0,0 +1,5 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings runners")}} + <div class="user-setting-content"> + {{template "shared/actions/runner_edit" .}} + </div> +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/security/accountlinks.tmpl b/templates/user/settings/security/accountlinks.tmpl new file mode 100644 index 00000000..08208445 --- /dev/null +++ b/templates/user/settings/security/accountlinks.tmpl @@ -0,0 +1,62 @@ +{{/* No account links, no way to add account links: Menu will not be shown. */}} +{{if or .AccountLinks .OrderedOAuth2Names}} +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_account_links"}} + {{if .OrderedOAuth2Names}} + <div class="ui right"> + <div class="ui dropdown"> + <div class="ui primary tiny button">{{ctx.Locale.Tr "settings.link_account"}}</div> + <div class="menu"> + {{range $key := .OrderedOAuth2Names}} + {{$provider := index $.OAuth2Providers $key}} + <a class="item" href="{{AppSubUrl}}/user/oauth2/{{$key}}"> + {{$provider.IconHTML 20}} + {{$provider.DisplayName}} + </a> + {{end}} + </div> + </div> + </div> + {{end}} +</h4> + +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.manage_account_links_desc"}} + </div> + {{range $loginSource, $provider := .AccountLinks}} + <div class="flex-item"> + {{$providerData := index $.OAuth2Providers $loginSource.Name}} + <div class="flex-item-leading"> + {{$providerData.IconHTML 20}} + </div> + <div class="flex-item-main"> + <span class="flex-item-title" data-tooltip-content="{{$provider}}"> + {{$loginSource.Name}} + </span> + {{if $loginSource.IsActive}} + <span class="flex-text-body text primary">{{ctx.Locale.Tr "repo.settings.active"}}</span> + {{end}} + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-account-link" data-url="{{AppSubUrl}}/user/settings/security/account_link" data-id="{{$loginSource.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + + <div class="ui g-modal-confirm delete modal" id="delete-account-link"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.remove_account_link"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.remove_account_link_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> +{{end}} diff --git a/templates/user/settings/security/openid.tmpl b/templates/user/settings/security/openid.tmpl new file mode 100644 index 00000000..b0473c9d --- /dev/null +++ b/templates/user/settings/security/openid.tmpl @@ -0,0 +1,63 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.manage_openid"}} +</h4> +<div class="ui attached segment"> + <div class="flex-list"> + <div class="flex-item"> + {{ctx.Locale.Tr "settings.openid_desc"}} + </div> + {{range .OpenIDs}} + <div class="flex-item tw-items-center"> + <div class="flex-item-leading"> + {{svg "fontawesome-openid" 20}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.URI}}</div> + </div> + <div class="flex-item-trailing"> + <form action="{{AppSubUrl}}/user/settings/security/openid/toggle_visibility" method="post"> + {{$.CsrfTokenHtml}} + <input name="id" type="hidden" value="{{.ID}}"> + {{if .Show}} + <button class="ui tiny button"> + {{svg "octicon-eye" 16 "icon"}} + {{ctx.Locale.Tr "settings.hide_openid"}} + </button> + {{else}} + <button class="ui tiny button"> + {{svg "octicon-eye-closed" 16 "icon"}} + {{ctx.Locale.Tr "settings.show_openid"}} + </button> + {{end}} + </form> + <button class="ui red tiny button delete-button" data-modal-id="delete-openid" data-url="{{AppSubUrl}}/user/settings/security/openid/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> +</div> +<div class="ui attached bottom segment"> + <form class="ui form" action="{{AppSubUrl}}/user/settings/security/openid" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_OpenID}}error{{end}}"> + <label for="openid">{{ctx.Locale.Tr "settings.add_new_openid"}}</label> + <input id="openid" name="openid" type="text" required> + </div> + <button class="ui primary button"> + {{ctx.Locale.Tr "settings.add_openid"}} + </button> + </form> + + <div class="ui g-modal-confirm delete modal" id="delete-openid"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.openid_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.openid_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/security/security.tmpl b/templates/user/settings/security/security.tmpl new file mode 100644 index 00000000..aee0456b --- /dev/null +++ b/templates/user/settings/security/security.tmpl @@ -0,0 +1,11 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings security")}} + <div class="user-setting-content"> + {{template "user/settings/security/twofa" .}} + {{template "user/settings/security/webauthn" .}} + {{template "user/settings/security/accountlinks" .}} + {{if .EnableOpenIDSignIn}} + {{template "user/settings/security/openid" .}} + {{end}} + </div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/security/twofa.tmpl b/templates/user/settings/security/twofa.tmpl new file mode 100644 index 00000000..adebce42 --- /dev/null +++ b/templates/user/settings/security/twofa.tmpl @@ -0,0 +1,37 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.twofa"}} +</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.twofa_desc"}}</p> + {{if .TOTPEnrolled}} + <p>{{ctx.Locale.Tr "settings.twofa_is_enrolled"}}</p> + <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data"> + {{.CsrfTokenHtml}} + <p>{{ctx.Locale.Tr "settings.regenerate_scratch_token_desc"}}</p> + <button class="ui primary button">{{ctx.Locale.Tr "settings.twofa_scratch_token_regenerate"}}</button> + </form> + <form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/disable" method="post" enctype="multipart/form-data" id="disable-form"> + {{.CsrfTokenHtml}} + <p>{{ctx.Locale.Tr "settings.twofa_disable_note"}}</p> + <button class="ui red button delete-button" data-modal-id="disable-twofa" data-type="form" data-form="#disable-form">{{ctx.Locale.Tr "settings.twofa_disable"}}</button> + </form> + {{else}} + {{/* The recovery tip is there as a means of encouraging a user to enroll */}} + <p>{{ctx.Locale.Tr "settings.twofa_recovery_tip"}}</p> + <p>{{ctx.Locale.Tr "settings.twofa_not_enrolled"}}</p> + <div class="inline field"> + <a class="ui primary button" href="{{AppSubUrl}}/user/settings/security/two_factor/enroll">{{ctx.Locale.Tr "settings.twofa_enroll"}}</a> + </div> + {{end}} + + <div class="ui g-modal-confirm delete modal" id="disable-twofa"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.twofa_disable"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.twofa_disable_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/user/settings/security/twofa_enroll.tmpl b/templates/user/settings/security/twofa_enroll.tmpl new file mode 100644 index 00000000..d6bfadf0 --- /dev/null +++ b/templates/user/settings/security/twofa_enroll.tmpl @@ -0,0 +1,25 @@ +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings twofa")}} + <div class="user-setting-content"> + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "settings.twofa_enroll"}} + </h4> + <div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.scan_this_image"}}</p> + <img src="{{.QrUri}}" alt="{{.TwofaSecret}}"> + <p>{{ctx.Locale.Tr "settings.or_enter_secret" .TwofaSecret}}</p> + <p>{{ctx.Locale.Tr "settings.then_enter_passcode"}}</p> + <form class="ui form" action="{{.Link}}" method="post"> + {{.CsrfTokenHtml}} + <div class="inline required field {{if .Err_Passcode}}error{{end}}"> + <label for="passcode">{{ctx.Locale.Tr "passcode"}}</label> + <input id="passcode" name="passcode" autofocus required> + </div> + <div class="inline field"> + <label></label> + <button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button> + </div> + </form> + </div> + </div> + +{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/security/webauthn.tmpl b/templates/user/settings/security/webauthn.tmpl new file mode 100644 index 00000000..764844b2 --- /dev/null +++ b/templates/user/settings/security/webauthn.tmpl @@ -0,0 +1,43 @@ +<h4 class="ui top attached header">{{ctx.Locale.Tr "settings.webauthn"}}</h4> +<div class="ui attached segment"> + <p>{{ctx.Locale.Tr "settings.webauthn_desc"}}</p> + <p>{{ctx.Locale.Tr "settings.webauthn_key_loss_warning"}} {{ctx.Locale.Tr "settings.webauthn_alternative_tip"}}</p> + {{template "user/auth/webauthn_error" .}} + <div class="flex-list"> + {{range .WebAuthnCredentials}} + <div class="flex-item"> + <div class="flex-item-leading"> + {{svg "octicon-key" 32}} + </div> + <div class="flex-item-main"> + <div class="flex-item-title">{{.Name}}</div> + <div class="flex-item-body"> + <p>{{ctx.Locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix)}}</p> + </div> + </div> + <div class="flex-item-trailing"> + <button class="ui red tiny button delete-button" data-modal-id="delete-registration" data-url="{{$.Link}}/webauthn/delete" data-id="{{.ID}}"> + {{ctx.Locale.Tr "settings.delete_key"}} + </button> + </div> + </div> + {{end}} + </div> + <div class="ui form"> + <div class="required field"> + <label for="nickname">{{ctx.Locale.Tr "settings.webauthn_nickname"}}</label> + <input id="nickname" name="nickname" type="text" required> + </div> + <button id="register-webauthn" class="ui primary button">{{svg "octicon-key"}} {{ctx.Locale.Tr "settings.webauthn_register_key"}}</button> + </div> + <div class="ui g-modal-confirm delete modal" id="delete-registration"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "settings.webauthn_delete_key"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "settings.webauthn_delete_key_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} + </div> +</div> diff --git a/templates/webhook/new.tmpl b/templates/webhook/new.tmpl new file mode 100644 index 00000000..a3fd8965 --- /dev/null +++ b/templates/webhook/new.tmpl @@ -0,0 +1,44 @@ +<h4 class="ui top attached header"> + {{.CustomHeaderTitle}} + <div class="ui right type dropdown"> + <div class="text tw-flex tw-items-center"> + {{.ctxData.WebhookHandler.Icon 20}} + {{ctx.Locale.Tr (print "repo.settings.web_hook_name_" .ctxData.HookType)}} + </div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{template "repo/settings/webhook/link_menu" .ctxData}} + </div> +</h4> +<div class="ui attached segment"> + {{with .ctxData}} + <!-- the template argument cannot be dynamic --> + {{if eq .HookType "forgejo"}} + {{template "webhook/new/forgejo" .}} + {{else if eq .HookType "gitea"}} + {{template "webhook/new/gitea" .}} + {{else if eq .HookType "gogs"}} + {{template "webhook/new/gogs" .}} + {{else if eq .HookType "slack"}} + {{template "webhook/new/slack" .}} + {{else if eq .HookType "discord"}} + {{template "webhook/new/discord" .}} + {{else if eq .HookType "dingtalk"}} + {{template "webhook/new/dingtalk" .}} + {{else if eq .HookType "telegram"}} + {{template "webhook/new/telegram" .}} + {{else if eq .HookType "msteams"}} + {{template "webhook/new/msteams" .}} + {{else if eq .HookType "feishu"}} + {{template "webhook/new/feishu" .}} + {{else if eq .HookType "matrix"}} + {{template "webhook/new/matrix" .}} + {{else if eq .HookType "wechatwork"}} + {{template "webhook/new/wechatwork" .}} + {{else if eq .HookType "packagist"}} + {{template "webhook/new/packagist" .}} + {{else if eq .HookType "sourcehut_builds"}} + {{template "webhook/new/sourcehut_builds" .}} + {{end}} + {{end}} +</div> +{{template "repo/settings/webhook/history" .ctxData}} diff --git a/templates/webhook/new/dingtalk.tmpl b/templates/webhook/new/dingtalk.tmpl new file mode 100644 index 00000000..e805eadc --- /dev/null +++ b/templates/webhook/new/dingtalk.tmpl @@ -0,0 +1,9 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://dingtalk.com" (ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "dingtalk/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 "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/discord.tmpl b/templates/webhook/new/discord.tmpl new file mode 100644 index 00000000..48ac84fc --- /dev/null +++ b/templates/webhook/new/discord.tmpl @@ -0,0 +1,17 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://discord.com" (ctx.Locale.Tr "repo.settings.web_hook_name_discord")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "discord/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> + <div class="field"> + <label for="username">{{ctx.Locale.Tr "repo.settings.discord_username"}}</label> + <input id="username" name="username" value="{{.HookMetadata.Username}}" placeholder="Forgejo"> + </div> + <div class="field"> + <label for="icon_url">{{ctx.Locale.Tr "repo.settings.discord_icon_url"}}</label> + <input id="icon_url" name="icon_url" value="{{.HookMetadata.IconURL}}" placeholder="https://example.com/assets/img/logo.svg"> + </div> + {{template "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/feishu.tmpl b/templates/webhook/new/feishu.tmpl new file mode 100644 index 00000000..10c2827d --- /dev/null +++ b/templates/webhook/new/feishu.tmpl @@ -0,0 +1,10 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://feishu.cn" (ctx.Locale.Tr "repo.settings.web_hook_name_feishu_only")}}</p> +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://larksuite.com" (ctx.Locale.Tr "repo.settings.web_hook_name_larksuite_only")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "feishu/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 "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/forgejo.tmpl b/templates/webhook/new/forgejo.tmpl new file mode 100644 index 00000000..cdb33346 --- /dev/null +++ b/templates/webhook/new/forgejo.tmpl @@ -0,0 +1,38 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_forgejo")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "forgejo/new"}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.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> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.http_method"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" id="http_method" name="http_method" value="{{if .Webhook.HTTPMethod}}{{.Webhook.HTTPMethod}}{{else}}POST{{end}}"> + <div class="default text"></div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="POST">POST</div> + <div class="item" data-value="GET">GET</div> + </div> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.content_type"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" id="content_type" name="content_type" value="{{if .Webhook.ContentType}}{{.Webhook.ContentType}}{{else}}1{{end}}"> + <div class="default text"></div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="1">application/json</div> + <div class="item" data-value="2">application/x-www-form-urlencoded</div> + </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 "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/gitea.tmpl b/templates/webhook/new/gitea.tmpl new file mode 100644 index 00000000..3926370b --- /dev/null +++ b/templates/webhook/new/gitea.tmpl @@ -0,0 +1,38 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gitea")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "gitea/new"}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.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> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.http_method"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" id="http_method" name="http_method" value="{{if .Webhook.HTTPMethod}}{{.Webhook.HTTPMethod}}{{else}}POST{{end}}"> + <div class="default text"></div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="POST">POST</div> + <div class="item" data-value="GET">GET</div> + </div> + </div> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.content_type"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" id="content_type" name="content_type" value="{{if .Webhook.ContentType}}{{.Webhook.ContentType}}{{else}}1{{end}}"> + <div class="default text"></div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="1">application/json</div> + <div class="item" data-value="2">application/x-www-form-urlencoded</div> + </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 "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/gogs.tmpl b/templates/webhook/new/gogs.tmpl new file mode 100644 index 00000000..5b6cd723 --- /dev/null +++ b/templates/webhook/new/gogs.tmpl @@ -0,0 +1,26 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://forgejo.org/docs/latest/user/webhooks/" (ctx.Locale.Tr "repo.settings.web_hook_name_gogs")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "gogs/new"}}" method="post"> + {{template "base/disable_form_autofill"}} + {{.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> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.content_type"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" id="content_type" name="content_type" value="{{if .Webhook.ContentType}}{{.Webhook.ContentType}}{{else}}1{{end}}"> + <div class="default text"></div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="1">application/json</div> + <div class="item" data-value="2">application/x-www-form-urlencoded</div> + </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 "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/matrix.tmpl b/templates/webhook/new/matrix.tmpl new file mode 100644 index 00000000..920180d4 --- /dev/null +++ b/templates/webhook/new/matrix.tmpl @@ -0,0 +1,32 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://matrix.org/" (ctx.Locale.Tr "repo.settings.web_hook_name_matrix")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "matrix/new"}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_HomeserverURL}}error{{end}}"> + <label for="homeserver_url">{{ctx.Locale.Tr "repo.settings.matrix.homeserver_url"}}</label> + <input id="homeserver_url" name="homeserver_url" type="url" value="{{.HookMetadata.HomeserverURL}}" autofocus required> + </div> + <!-- Access Token --> + <div class="field required {{if .Err_AccessToken}}error{{end}}"> + <label for="access_token">{{ctx.Locale.Tr "form.AccessToken"}}</label> + <input id="access_token" name="access_token" type="password" value="{{.Webhook.HeaderAuthorizationTrimPrefix "Bearer "}}" required> + <span class="help">{{ctx.Locale.Tr "repo.settings.matrix.access_token_helper"}}</span> + </div> + <div class="required field {{if .Err_Room}}error{{end}}"> + <label for="room_id">{{ctx.Locale.Tr "repo.settings.matrix.room_id"}}</label> + <input id="room_id" name="room_id" type="text" value="{{.HookMetadata.Room}}" placeholder="!opaque_id:domain" pattern="^!.+:.+$" maxlength="255" required> + <span class="help">{{ctx.Locale.Tr "repo.settings.matrix.room_id_helper" ("<code>!opaque_id:example.org</code>"|SafeHTML)}}</span> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.matrix.message_type"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" id="message_type" name="message_type" value="{{if .HookMetadata.MessageType}}{{.HookMetadata.MessageType}}{{else}}1{{end}}"> + <div class="default text"></div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="1">m.notice</div> + <div class="item" data-value="2">m.text</div> + </div> + </div> + </div> + {{template "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/msteams.tmpl b/templates/webhook/new/msteams.tmpl new file mode 100644 index 00000000..535d0fc3 --- /dev/null +++ b/templates/webhook/new/msteams.tmpl @@ -0,0 +1,9 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://teams.microsoft.com" (ctx.Locale.Tr "repo.settings.web_hook_name_msteams")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "msteams/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 "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/packagist.tmpl b/templates/webhook/new/packagist.tmpl new file mode 100644 index 00000000..04240bbf --- /dev/null +++ b/templates/webhook/new/packagist.tmpl @@ -0,0 +1,17 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://packagist.org" (ctx.Locale.Tr "repo.settings.web_hook_name_packagist")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "packagist/new"}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_Username}}error{{end}}"> + <label for="username">{{ctx.Locale.Tr "repo.settings.packagist_username"}}</label> + <input id="username" name="username" value="{{.HookMetadata.Username}}" placeholder="Forgejo" autofocus required> + </div> + <div class="required field {{if .Err_APIToken}}error{{end}}"> + <label for="api_token">{{ctx.Locale.Tr "repo.settings.packagist_api_token"}}</label> + <input id="api_token" name="api_token" value="{{.HookMetadata.APIToken}}" placeholder="X5F_tZ-Wj3c1vqaU2Rky" required> + </div> + <div class="required field {{if .Err_PackageURL}}error{{end}}"> + <label for="package_url">{{ctx.Locale.Tr "repo.settings.packagist_package_url"}}</label> + <input id="package_url" name="package_url" value="{{.HookMetadata.PackageURL}}" placeholder="https://packagist.org/packages/laravel/framework" required> + </div> + {{template "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/slack.tmpl b/templates/webhook/new/slack.tmpl new file mode 100644 index 00000000..cfaeb41f --- /dev/null +++ b/templates/webhook/new/slack.tmpl @@ -0,0 +1,26 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://slack.com" (ctx.Locale.Tr "repo.settings.web_hook_name_slack")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "slack/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> + <div class="required field {{if .Err_Channel}}error{{end}}"> + <label for="channel">{{ctx.Locale.Tr "repo.settings.slack_channel"}}</label> + <input id="channel" name="channel" value="{{.HookMetadata.Channel}}" placeholder="#general" required> + </div> + + <div class="field"> + <label for="username">{{ctx.Locale.Tr "repo.settings.slack_username"}}</label> + <input id="username" name="username" value="{{.HookMetadata.Username}}" placeholder="Forgejo"> + </div> + <div class="field"> + <label for="icon_url">{{ctx.Locale.Tr "repo.settings.slack_icon_url"}}</label> + <input id="icon_url" name="icon_url" value="{{.HookMetadata.IconURL}}" placeholder="https://example.com/img/favicon.png"> + </div> + <div class="field"> + <label for="color">{{ctx.Locale.Tr "repo.settings.slack_color"}}</label> + <input id="color" name="color" value="{{.HookMetadata.Color}}" placeholder="#dd4b39, good, warning, danger"> + </div> + {{template "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/sourcehut_builds.tmpl b/templates/webhook/new/sourcehut_builds.tmpl new file mode 100644 index 00000000..3bcbe1bf --- /dev/null +++ b/templates/webhook/new/sourcehut_builds.tmpl @@ -0,0 +1,39 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://sourcehut.org/" (ctx.Locale.Tr "repo.settings.web_hook_name_sourcehut_builds")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "sourcehut_builds/new"}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_PayloadURL}}error{{end}}"> + <label for="payload_url">{{ctx.Locale.Tr "repo.settings.graphql_url"}}</label> + <input id="payload_url" name="payload_url" type="url" value="{{or .Webhook.URL "https://builds.sr.ht/query"}}" autofocus required> + </div> + <div class="required field {{if .Err_ManifestPath}}error{{end}}"> + <label for="manifest_path">{{ctx.Locale.Tr "repo.settings.sourcehut_builds.manifest_path"}}</label> + <input id="manifest_path" name="manifest_path" type="text" value="{{or .HookMetadata.ManifestPath ".build.yml"}}" required> + </div> + <div class="field"> + <label>{{ctx.Locale.Tr "repo.settings.sourcehut_builds.visibility"}}</label> + <div class="ui selection dropdown"> + <input type="hidden" id="visibility" name="visibility" value="{{if .HookMetadata.Visibility}}{{.HookMetadata.Visibility}}{{else}}PRIVATE{{end}}"> + <div class="default text"></div> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <div class="item" data-value="PUBLIC">PUBLIC</div> + <div class="item" data-value="UNLISTED">UNLISTED</div> + <div class="item" data-value="PRIVATE">PRIVATE</div> + </div> + </div> + </div> + <div class="field"> + <div class="ui checkbox"> + <input name="secrets" type="checkbox" {{if .HookMetadata.Secrets}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.sourcehut_builds.secrets"}}</label> + <span class="help">{{ctx.Locale.Tr "repo.settings.sourcehut_builds.secrets_helper"}}</span> + </div> + </div> + <!-- Access Token --> + <div class="field required {{if .Err_AccessToken}}error{{end}}"> + <label for="access_token">{{ctx.Locale.Tr "form.AccessToken"}}</label> + <input id="access_token" name="access_token" type="password" value="{{.Webhook.HeaderAuthorizationTrimPrefix "Bearer "}}" required> + <span class="help">{{ctx.Locale.Tr "repo.settings.sourcehut_builds.access_token_helper" "https://meta.sr.ht/oauth2/personal-token?grants=builds.sr.ht/JOBS:RW" "https://meta.sr.ht/oauth2/personal-token?grants=builds.sr.ht/JOBS:RW+builds.sr.ht/SECRETS:RO"}}</span> + </div> + {{template "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/telegram.tmpl b/templates/webhook/new/telegram.tmpl new file mode 100644 index 00000000..3627dff3 --- /dev/null +++ b/templates/webhook/new/telegram.tmpl @@ -0,0 +1,17 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://core.telegram.org/bots" (ctx.Locale.Tr "repo.settings.web_hook_name_telegram")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "telegram/new"}}" method="post"> + {{.CsrfTokenHtml}} + <div class="required field {{if .Err_BotToken}}error{{end}}"> + <label for="bot_token">{{ctx.Locale.Tr "repo.settings.bot_token"}}</label> + <input id="bot_token" name="bot_token" type="text" value="{{.HookMetadata.BotToken}}" autofocus required> + </div> + <div class="required field {{if .Err_ChatID}}error{{end}}"> + <label for="chat_id">{{ctx.Locale.Tr "repo.settings.chat_id"}}</label> + <input id="chat_id" name="chat_id" type="text" value="{{.HookMetadata.ChatID}}" required> + </div> + <div class="field {{if .Err_ThreadID}}error{{end}}"> + <label for="thread_id">{{ctx.Locale.Tr "repo.settings.thread_id"}}</label> + <input id="thread_id" name="thread_id" type="text" value="{{.HookMetadata.ThreadID}}"> + </div> + {{template "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/new/wechatwork.tmpl b/templates/webhook/new/wechatwork.tmpl new file mode 100644 index 00000000..ae9d36a7 --- /dev/null +++ b/templates/webhook/new/wechatwork.tmpl @@ -0,0 +1,9 @@ +<p>{{ctx.Locale.Tr "repo.settings.add_web_hook_desc" "https://work.weixin.qq.com" (ctx.Locale.Tr "repo.settings.web_hook_name_wechatwork")}}</p> +<form class="ui form" action="{{.BaseLink}}/{{or .Webhook.ID "wechatwork/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 "webhook/shared-settings" .}} +</form> diff --git a/templates/webhook/shared-settings.tmpl b/templates/webhook/shared-settings.tmpl new file mode 100644 index 00000000..80caad72 --- /dev/null +++ b/templates/webhook/shared-settings.tmpl @@ -0,0 +1,289 @@ +{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}} +<div class="field"> + <h4>{{ctx.Locale.Tr "repo.settings.event_desc"}}</h4> + <div class="grouped event type fields"> + <div class="field"> + <div class="ui radio non-events checkbox"> + <input name="events" type="radio" value="push_only" {{if or $isNew .Webhook.PushOnly}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_push_only"}}</label> + </div> + </div> + <div class="field"> + <div class="ui radio non-events checkbox"> + <input name="events" type="radio" value="send_everything" {{if .Webhook.SendEverything}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_send_everything"}}</label> + </div> + </div> + <div class="field"> + <div class="ui radio events checkbox"> + <input name="events" type="radio" value="choose_events" {{if .Webhook.ChooseEvents}}checked{{end}}> + <label>{{ctx.Locale.Tr "repo.settings.event_choose"}}</label> + </div> + </div> + </div> + + <div class="events fields ui grid {{if not .Webhook.ChooseEvents}}tw-hidden{{end}}"> + <!-- Repository Events --> + <div class="fourteen wide column"> + <label>{{ctx.Locale.Tr "repo.settings.event_header_repository"}}</label> + </div> + <!-- Create --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="create" type="checkbox" {{if .Webhook.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> + </div> + </div> + <!-- Delete --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="delete" type="checkbox" {{if .Webhook.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> + </div> + </div> + <!-- Fork --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="fork" type="checkbox" {{if .Webhook.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> + </div> + </div> + <!-- Push --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="push" type="checkbox" {{if .Webhook.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> + </div> + </div> + <!-- Repository --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="repository" type="checkbox" {{if .Webhook.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> + </div> + </div> + <!-- Release --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="release" type="checkbox" {{if .Webhook.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> + </div> + </div> + <!-- Package --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="package" type="checkbox" {{if .Webhook.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> + </div> + </div> + + <!-- Wiki --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="wiki" type="checkbox" {{if .Webhook.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> + + <!-- Issue Events --> + <div class="fourteen wide column"> + <label>{{ctx.Locale.Tr "repo.settings.event_header_issue"}}</label> + </div> + <!-- Issues --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="issues" type="checkbox" {{if .Webhook.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> + </div> + </div> + <!-- Issue Assign --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="issue_assign" type="checkbox" {{if .Webhook.IssueAssign}}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> + </div> + </div> + <!-- Issue Label --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="issue_label" type="checkbox" {{if .Webhook.IssueLabel}}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> + </div> + </div> + <!-- Issue Milestone --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="issue_milestone" type="checkbox" {{if .Webhook.IssueMilestone}}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> + </div> + </div> + <!-- Issue Comment --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="issue_comment" type="checkbox" {{if .Webhook.IssueComment}}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> + </div> + </div> + + <!-- Pull Request Events --> + <div class="fourteen wide column"> + <label>{{ctx.Locale.Tr "repo.settings.event_header_pull_request"}}</label> + </div> + <!-- Pull Request --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="pull_request" type="checkbox" {{if .Webhook.PullRequest}}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> + </div> + </div> + <!-- Pull Request Assign --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="pull_request_assign" type="checkbox" {{if .Webhook.PullRequestAssign}}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> + </div> + </div> + <!-- Pull Request Label --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="pull_request_label" type="checkbox" {{if .Webhook.PullRequestLabel}}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> + </div> + </div> + <!-- Pull Request Milestone --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="pull_request_milestone" type="checkbox" {{if .Webhook.PullRequestMilestone}}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> + </div> + </div> + <!-- Pull Request Comment --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="pull_request_comment" type="checkbox" {{if .Webhook.PullRequestComment}}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> + </div> + </div> + <!-- Pull Request Review --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="pull_request_review" type="checkbox" {{if .Webhook.PullRequestReview}}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> + </div> + </div> + <!-- Pull Request Sync --> + <div class="seven wide column"> + <div class="field"> + <div class="ui checkbox"> + <input name="pull_request_sync" type="checkbox" {{if .Webhook.PullRequestSync}}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> + </div> + </div> + <!-- Pull Request Review Request --> + <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}}> + <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> + </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"}}</span> +</div> + +{{$skipAuthorizationHeader := or (eq .HookType "sourcehut_builds") (eq .HookType "matrix")}} +{{if not $skipAuthorizationHeader}} + <!-- Authorization Header --> + <div class="field {{if .Err_AuthorizationHeader}}error{{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}}"> + <span class="help">{{ctx.Locale.Tr "repo.settings.authorization_header_desc" ("<code>Bearer token123456</code>, <code>Basic YWxhZGRpbjpvcGVuc2VzYW1l</code>" | SafeHTML)}}</span> + </div> +{{end}} + +<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> + {{end}} +</div> + +{{template "repo/settings/webhook/delete_modal" .}} |