Core

/views/vadmin/Sitemap.html (2.0 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% import (
"slices"

"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cmenu"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/lib/menu"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/layout"
"{{{ .Package }}}/views/vutil"
) %}

{% code type Sitemap struct {
layout.Basic
} %}

{% func (p *Sitemap) Body(as *app.State, ps *cutil.PageState) %}
<div class="card">
<h3>{%= components.SVGRefIcon(`star`, ps) %}Sitemap</h3>
<div class="mt">
{%= SitemapDetail(ps.Menu, 1, ps) %}
</div>
</div>
{% endfunc %}

{% func SitemapDetail(m menu.Items, indent int, ps *cutil.PageState) %}{% stripspace %}
{%= vutil.Indent(true, 1) %}
<div class="mt">
{%= vutil.Indent(true, 2) %}
<ul class="level-0">
{% for _, i := range m %}
{% if i.Key != "" %}
{%= sitemapItemDetail(i, []string{}, ps.Breadcrumbs, 3, ps) %}
{% endif %}
{% endfor %}
{%= vutil.Indent(true, 2) %}
</ul>
{%= vutil.Indent(true, 1) %}
</div>
{% endstripspace %}{% endfunc %}

{% func sitemapItemDetail(i *menu.Item, path []string, breadcrumbs cmenu.Breadcrumbs, indent int, ps *cutil.PageState) %}{% stripspace %}
{%= vutil.Indent(true, indent) %}
<li>
<div class="mts">
{%= vutil.Indent(true, indent + 1) %}
<a href="{%s i.Route %}" title="{%s i.Desc() %}">
{% if i.Icon != "" %}
{%= components.SVGRef(i.Icon, 16, 16, "icon", ps) %}
{% endif %}
{%s i.Title %}
</a>
<div><em>{%s i.Desc() %}</em></div>
{% if len(i.Children) > 0 %}
<ul class="level-{%d len(path) %}">
{% for _, kid := range i.Children %}
{% if kid.Key != "" %}
{%= sitemapItemDetail(kid, append(slices.Clone(path), i.Key), breadcrumbs, indent + 2, ps) %}
{% endif %}
{% endfor %}
</ul>
{% endif %}
</div>
{%= vutil.Indent(true, indent) %}
</li>
{% endstripspace %}{% endfunc %}