diff options
Diffstat (limited to 'templates/org')
32 files changed, 1152 insertions, 0 deletions
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" .}} |