Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/build-output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,15 @@ describe("Forgejo 15 native integration", () => {
expect(read("sidebar.tmpl")).toContain('href="{{AppSubUrl}}/notifications/watching"');
});

it("gives a team GitHub's sidebar and underline tabs without Forgejo's teal button", () => {
const read = (...parts: string[]) =>
fs.readFileSync(path.join(ROOT_DIR, "templates", "org", "team", ...parts), "utf-8");
const sidebar = read("sidebar.tmpl");
expect(sidebar).not.toContain("teal");
expect(sidebar).toContain('class="ui button theme-control theme-team-settings"');
expect(read("navbar.tmpl")).toContain('<span class="theme-counter theme-counter-tab">{{.Team.NumMembers}}</span>');
});

it("matches GitHub's repository About, visibility, and code-search details", () => {
const headerStyle = fs.readFileSync(path.join(ROOT_DIR, "styles", "templates", "repo", "header.ts"), "utf-8");
const headerTemplate = fs.readFileSync(path.join(ROOT_DIR, "templates", "repo", "home_header.tmpl"), "utf-8");
Expand Down
87 changes: 85 additions & 2 deletions styles/pages/organization.css
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,91 @@
height: 24px;
}

.organization.teams .org-team-navbar {
background: var(--color-box-header);
/* A team: GitHub's sidebar (the name with Leave or Join, the summary, Settings) beside underline tabs over a box. */
.theme-team-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 8px;
}

.theme-team-header > h2 {
margin: 0;
font-size: 20px;
font-weight: 600;
line-height: 30px;
overflow-wrap: anywhere;
}

.theme-team-detail > .item {
padding: 8px 0;
color: var(--color-text-light-1);
font-size: 14px;
line-height: 21px;
}

.theme-team-detail > .item + .item {
border-top: 1px solid var(--color-light-border);
}

.theme-team-detail h3 {
margin: 0 0 4px;
color: var(--color-text);
font-size: 14px;
font-weight: 600;
}

.theme-team-detail ul {
margin: 0 0 12px;
padding-left: 20px;
}

.theme-team-settings {
width: 100%;
margin-top: 8px;
}

.theme-team-tabs {
display: flex;
gap: 8px;
margin-bottom: 16px;
border-bottom: 1px solid var(--color-light-border);
}

.theme-team-tabs > a {
position: relative;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 0 8px 8px;
color: var(--color-text);
font-size: 14px;
line-height: 30px;
text-decoration: none;
}

.theme-team-tabs > a > .svg {
color: var(--color-text-light-1);
}

.theme-team-tabs > a[aria-current]::after {
content: "";
position: absolute;
inset: auto 0 -1px;
height: 2px;
border-radius: var(--border-radius);
background: var(--github-underlineNav-borderColor-active);
}

.theme-team-tabs > a[aria-current] {
font-weight: 600;
}

/* Under the tabs the add form and the list are one box instead of Forgejo's attached segments. */
.organization.teams .ten.wide.column > .theme-team-tabs + .ui.attached.segment {
border-top-width: 1px;
border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Inner team pages retain the permission summary beside members/repositories. */
Expand Down
5 changes: 5 additions & 0 deletions templates/org/team/navbar.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{/* GitHub's underline tabs for a team's members and repositories, each with its counter. */}}
<nav class="theme-team-tabs" aria-label="{{.Team.Name}}">
<a{{if .PageIsOrgTeamMembers}} aria-current="page"{{end}} href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}">{{svg "octicon-person" 16}}{{ctx.Locale.Tr "org.members"}}<span class="theme-counter theme-counter-tab">{{.Team.NumMembers}}</span></a>
<a{{if .PageIsOrgTeamRepos}} aria-current="page"{{end}} href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/repositories">{{svg "octicon-repo" 16}}{{ctx.Locale.Tr "user.repositories"}}<span class="theme-counter theme-counter-tab">{{.Team.NumRepos}}</span></a>
</nav>
88 changes: 88 additions & 0 deletions templates/org/team/sidebar.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{{/* Forgejo 17's team summary as a GitHub sidebar: the team's name with Leave or Join, its description and
permissions, then Settings as a default button. */}}
<div class="ui six wide column theme-team-sidebar">
<div class="theme-team-header">
<h2>{{.Team.Name}}</h2>
{{if .Team.IsMember ctx $.SignedUser.ID}}
<form>
<button class="ui button theme-control theme-control-small theme-team-leave 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">
<input type="hidden" name="page" value="team">
<button type="submit" class="ui primary button theme-control theme-control-small" name="uid" value="{{$.SignedUser.ID}}">{{ctx.Locale.Tr "org.teams.join"}}</button>
</form>
{{end}}
</div>
<div class="theme-team-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 "settings.specific_repo_access"}}</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>
<h3>{{ctx.Locale.Tr "org.settings.permission"}}</h3>
{{if (eq .Team.AccessMode 3)}}
{{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}}
<a class="ui button theme-control theme-team-settings" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit">{{svg "octicon-gear" 16}}{{ctx.Locale.Tr "org.teams.settings"}}</a>
{{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>`|TrustHTML)}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</div>
Loading