mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-04 03:35:05 +02:00
create templates for group selection menu displayed in organization dashboard header, and update dashboard template to show said selection menu
This commit is contained in:
parent
e91c1db2cb
commit
b32762ae23
18
templates/group/dashboard/menu.tmpl
Normal file
18
templates/group/dashboard/menu.tmpl
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="ui floating dropdown jump">
|
||||
<span class="text">
|
||||
{{if .Group}}
|
||||
{{.Group.Name}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "org.groups"}}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
<div class="context user overflow menu" data-variation="basic">
|
||||
<div class="ui header">
|
||||
{{ctx.Locale.Tr "home.filter_by_group_repositories"}}
|
||||
</div>
|
||||
<div class="scrolling menu items">
|
||||
{{template "group/dashboard/submenu" dict "." . "Items" .GroupNavItems "Depth" 0}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
19
templates/group/dashboard/menu_item.tmpl
Normal file
19
templates/group/dashboard/menu_item.tmpl
Normal file
@ -0,0 +1,19 @@
|
||||
<a
|
||||
class="item {{if .Group}}{{if eq $.Group.ID .Item.ID}}active selected{{
|
||||
end
|
||||
}}{{ end }}"
|
||||
style="--depth: {{.Depth}};"
|
||||
href="{{
|
||||
$.Org.OrganisationLink
|
||||
}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{
|
||||
end
|
||||
}}/group/{{.Item.ID}}"
|
||||
>
|
||||
<span style="padding-left: calc(0.75rem * var(--depth))">
|
||||
{{.Item.Title}}
|
||||
</span>
|
||||
</a>
|
||||
{{$d := .Depth}}
|
||||
{{$one := 1}}
|
||||
{{$d1 := Eval $d "+" $one}}
|
||||
{{template "group/dashboard/submenu" dict "." . "Items" (.Item.Children .SignedUser) "Depth" $d1}}
|
||||
6
templates/group/dashboard/submenu.tmpl
Normal file
6
templates/group/dashboard/submenu.tmpl
Normal file
@ -0,0 +1,6 @@
|
||||
{{ range.Items}}
|
||||
{{if .IsGroup}}
|
||||
|
||||
{{ template "group/dashboard/menu_item" dict "." $ "Item" . "Depth" $.Depth}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@ -74,25 +74,34 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
{{template "group/dashboard/menu" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .ContextUser.IsOrganization}}
|
||||
{{$suffix := ""}}
|
||||
{{if .Team}}
|
||||
{{$suffix = PathEscape .Team.Name}}
|
||||
{{else if .Group}}
|
||||
{{$suffix = URLJoin "group" (StringUtils.ToString .Group.ID)}}
|
||||
{{end}}
|
||||
<div class="right menu tw-flex-wrap tw-justify-end">
|
||||
<a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
<a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}/{{$suffix}}">
|
||||
{{svg "octicon-rss"}} {{ctx.Locale.Tr "activities"}}
|
||||
</a>
|
||||
{{if not ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}}
|
||||
<a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
<a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues/{{$suffix}}">
|
||||
{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "issues"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if not ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}}
|
||||
<a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
<a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls/{{$suffix}}">
|
||||
{{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "pull_requests"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if and .ShowMilestonesDashboardPage (not (and ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled))}}
|
||||
<a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
|
||||
<a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones/{{$suffix}}">
|
||||
{{svg "octicon-milestone"}} {{ctx.Locale.Tr "milestones"}}
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user