Skip to content

Commit 116ef72

Browse files
committed
update sub menu
1 parent 957b0d4 commit 116ef72

File tree

1 file changed

+55
-8
lines changed

1 file changed

+55
-8
lines changed

resources/views/partials/menu.twig

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,74 @@
77
{% set parent = "anomaly.module.settings" %}
88
{% endif %}
99

10+
11+
1012
{% if not parent %}
1113
{% for section in template.cp.sections.root().visible() %}
1214
{{ menu.sections(template.cp.sections, section) }}
1315
{% endfor %}
1416

15-
{% for navigation in getSubmenus(template.module.namespace) %}
16-
<li>
17-
<a href="{{ url(navigation.href) }}">
18-
{{ trans(navigation.title) }}
19-
</a>
20-
</li>
21-
{% endfor %}
17+
{% set submenus = getSubmenus(template.module.namespace) %}
18+
19+
{% if count(submenus) %}
20+
{% for addon in submenus %}
21+
<li class="dropdown d-inline-block">
22+
<a type="button" data-toggle="dropdown">
23+
{{ addon.name }}
24+
<span class="caret"></span></a>
25+
<ul class="dropdown-menu ml-0 my-0 py-0"
26+
style="position: relative; background-color: transparent !important; border: 0;padding-left: 1.3rem">
27+
28+
{% for navigation in addon.links %}
29+
<li>
30+
<a href="{{ url(navigation.href) }}"
31+
style="font-size: 14px;color: #ccc !important;">
32+
{{ trans(navigation.title) }}
33+
</a>
34+
</li>
35+
{% endfor %}
36+
</ul>
37+
</li>
38+
{% endfor %}
39+
40+
{% endif %}
2241
{% else %}
23-
{% for navigation in getSections(parent) %}
42+
43+
{% set menu = getSections(parent) %}
44+
{% set main_menu = menu['main'] %}
45+
{% set sub_menus = menu['sub_menus'] %}
46+
47+
{% for navigation in main_menu %}
2448
<li>
2549
<a href="{{ url(navigation.href) }}">
2650
{{ trans(navigation.title) }}
2751
</a>
2852
</li>
2953
{% endfor %}
3054

55+
{% if count(sub_menus) %}
56+
{% for addon in sub_menus %}
57+
<li class="dropdown d-inline-block">
58+
<a type="button" data-toggle="dropdown">
59+
{{ addon.name }}
60+
<span class="caret"></span></a>
61+
<ul class="dropdown-menu ml-0 my-0 py-0"
62+
style="position: relative; background-color: transparent !important; border: 0;padding-left: 1.3rem">
63+
64+
{% for navigation in addon.links %}
65+
<li>
66+
<a href="{{ url(navigation.href) }}"
67+
style="font-size: 14px;color: #ccc !important;">
68+
{{ trans(navigation.title) }}
69+
</a>
70+
</li>
71+
{% endfor %}
72+
</ul>
73+
</li>
74+
{% endfor %}
75+
76+
{% endif %}
77+
3178
{% endif %}
3279
</ul>
3380
</aside>

0 commit comments

Comments
 (0)