mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-04 03:35:05 +02:00
create templates to display a sidebar containing a user's groups in a tree-like hierarchy
This commit is contained in:
parent
ff828442f3
commit
8a56edb0c1
18
templates/group/sidebar/menu.tmpl
Normal file
18
templates/group/sidebar/menu.tmpl
Normal file
@ -0,0 +1,18 @@
|
||||
<h4 class="ui top attached header tw-flex tw-items-center">
|
||||
<strong class="tw-flex-1 tw-flex-grow">{{ctx.Locale.Tr "org.groups"}}</strong>
|
||||
{{if .IsOrganizationMember}}
|
||||
<a class="text grey tw-items-center tw-block tw-h-4" href="{{.OrgLink}}/groups/new">
|
||||
<span class="tw-block tw-h-full">
|
||||
{{svg "octicon-plus" 16 "tw-inline-block"}}
|
||||
</span>
|
||||
</a>
|
||||
{{end}}
|
||||
</h4>
|
||||
<div class="ui attached segment" id="group-navigation-menu">
|
||||
<ul class="tw-list-none tw-px-0 expandable-menu tw-m-0 tw-space-y-4{{if .IsOrganizationMember}} sortable{{end}}"{{if .IsOrganizationMember}}
|
||||
data-url="{{ctx.Org.HomeLink}}/groups"{{end}}>
|
||||
{{ range .GroupNavItems }}
|
||||
{{template "group/sidebar/sidebar_item" dict "item" . "root" $}}
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
25
templates/group/sidebar/sidebar_item.tmpl
Normal file
25
templates/group/sidebar/sidebar_item.tmpl
Normal file
@ -0,0 +1,25 @@
|
||||
{{$item := (call (index $.root "AsGroupItem") .item)}}
|
||||
{{$parent := $item.Parent}}
|
||||
<li class="expandable-menu-item item tw-px-0" {{if $item.IsGroup}} data-is-group="true"{{end}}
|
||||
data-sort-id="{{if $item.IsGroup}}group{{else}}repo{{end}}-{{$item.ID}}-{{$item.Sort}}"
|
||||
data-id="{{$item.ID}}">
|
||||
<label class="tw-gap-2{{if $item.HasChildren $.root.Doer}} has-children{{end}}">
|
||||
{{ $active := (and $item.IsGroup (call $.root.GroupIsCurrent $item.ID))}}
|
||||
{{ $childContains := (call $.root.GroupHasChild $item)}}
|
||||
<input type="checkbox"
|
||||
class="toggle tw-h-0 tw-w-0 tw-overflow-hidden tw-opacity-0 tw-absolute"{{if or $active $childContains}} checked{{end}}>
|
||||
{{svg "octicon-chevron-right" 16 "collapse-icon"}}
|
||||
<a href="{{$item.Link}}" class="{{if $active}}active tw-font-bold{{end}}">
|
||||
{{$item.Title}}
|
||||
</a>
|
||||
</label>
|
||||
<div class="menu-expandable-content">
|
||||
<div class="menu-expandable-content-inner">
|
||||
<ul class="tw-list-none tw-ps-5"{{if .root.IsOrganizationMember}} data-url="{{ctx.RootData.Org.HomeLink}}/groups"{{end}}>
|
||||
{{- range $i, $childItem := $item.Children $.root.Doer -}}
|
||||
{{- template "group/sidebar/sidebar_item" dict "item" $childItem "root" $.root -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
Loading…
x
Reference in New Issue
Block a user