Skip to content

Commit 80b72ec

Browse files
create templates for group selection menu displayed in organization dashboard header, and update dashboard template to show said selection menu
1 parent 1a6a5dc commit 80b72ec

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-4
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<div class="ui floating dropdown jump">
2+
<span class="text">
3+
{{if .Group}}
4+
{{.Group.Name}}
5+
{{else}}
6+
{{ctx.Locale.Tr "org.groups"}}
7+
{{ end }}
8+
</span>
9+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
10+
<div class="context user overflow menu" data-variation="basic">
11+
<div class="ui header">
12+
{{ctx.Locale.Tr "home.filter_by_group_repositories"}}
13+
</div>
14+
<div class="scrolling menu items">
15+
{{template "group/dashboard/submenu" dict "." . "Items" .GroupNavItems "Depth" 0}}
16+
</div>
17+
</div>
18+
</div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<a
2+
class="item {{if .Group}}{{if eq $.Group.ID .Item.ID}}active selected{{
3+
end
4+
}}{{ end }}"
5+
style="--depth: {{.Depth}};"
6+
href="{{
7+
$.Org.OrganisationLink
8+
}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{
9+
end
10+
}}/group/{{.Item.ID}}"
11+
>
12+
<span style="padding-left: calc(0.75rem * var(--depth))">
13+
{{.Item.Title}}
14+
</span>
15+
</a>
16+
{{$d := .Depth}}
17+
{{$one := 1}}
18+
{{$d1 := Eval $d "+" $one}}
19+
{{template "group/dashboard/submenu" dict "." . "Items" (.Item.Children .SignedUser) "Depth" $d1}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{ range.Items}}
2+
{{if .IsGroup}}
3+
4+
{{ template "group/dashboard/menu_item" dict "." $ "Item" . "Depth" $.Depth}}
5+
{{ end }}
6+
{{ end }}

templates/user/dashboard/navbar.tmpl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,34 @@
7474
</div>
7575
</div>
7676
</div>
77+
<div class="item">
78+
{{template "group/dashboard/menu" .}}
79+
</div>
7780
{{end}}
7881

7982
{{if .ContextUser.IsOrganization}}
83+
{{$suffix := ""}}
84+
{{if .Team}}
85+
{{$suffix = PathEscape .Team.Name}}
86+
{{else if .Group}}
87+
{{$suffix = URLJoin "group" (StringUtils.ToString .Group.ID)}}
88+
{{end}}
8089
<div class="right menu tw-flex-wrap tw-justify-end">
81-
<a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
90+
<a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}/{{$suffix}}">
8291
{{svg "octicon-rss"}}&nbsp;{{ctx.Locale.Tr "activities"}}
8392
</a>
8493
{{if not ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}}
85-
<a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
94+
<a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues/{{$suffix}}">
8695
{{svg "octicon-issue-opened"}}&nbsp;{{ctx.Locale.Tr "issues"}}
8796
</a>
8897
{{end}}
8998
{{if not ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}}
90-
<a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
99+
<a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls/{{$suffix}}">
91100
{{svg "octicon-git-pull-request"}}&nbsp;{{ctx.Locale.Tr "pull_requests"}}
92101
</a>
93102
{{end}}
94103
{{if and .ShowMilestonesDashboardPage (not (and ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled))}}
95-
<a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
104+
<a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones/{{$suffix}}">
96105
{{svg "octicon-milestone"}}&nbsp;{{ctx.Locale.Tr "milestones"}}
97106
</a>
98107
{{end}}

0 commit comments

Comments
 (0)