Newer
Older
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{% comment %}
This page creates a submenu item. It expects an appropriate `item` as argument.
Furthermore, it requires the page_priors global variable
{% endcomment %}
{% unless item.menu_hidden %}
<!-- Figure out our current location -->
{% assign url_parts = page.url | split: '/' %}
{% assign base_url = url_parts | last %}
{% assign base_folder = url_parts[1] %}
<!-- Find out if we are active -->
{% assign menu_active = false %}
<!-- if we are in the right folder, we are active -->
{% if base_folder == item.folder %}
{% assign menu_active = true %}
{% endif %}
<!-- find all our priorities and also check for activity -->
{% capture priors %}
{{ page_priors }}
{% for item in item.items %}
{% unless item.menu_page %}
{% unless item.external_page %}
{% if item.url == page.url %}
{% assign menu_active = true %}
{% endif %}
{% endunless %}
{% endunless %}
{% assign value = item.menu_order %}
{% include print_number.liquid %},
{% endfor %}
{% endcapture %}
{% assign priors = priors | normalize_whitespace | replace: " ", "" | split:"," | uniq | sort %}
<!-- Find the current folder -->
{% assign item_folder = item.folder %}
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold">
<a class="collapsible-header {% if menu_active %}active{% endif %}">
{% if item.menu_title %}
{{ item.menu_title }}
{% else %}
{{ item.title }}
{% endif %}
</a>
<div class="collapsible-body">
<ul>
<!-- Start by iteratig over the priorities -->
{% for p in priors %}
<!-- If we have folders, iterate over them -->
{% if item.folder %}
{% for item in site.pages %}
<!-- read item priority -->
{% assign value = item.menu_order %}
{% capture ip %}{% include print_number.liquid %}{% endcapture %}
{% assign ip = ip | normalize_whitespace | replace: " ", "" %}
<!-- pick all the ones with the current priority -->
{% if ip == p %}
<!-- get the current page -->
{% assign sub_parts = item.url | split: '/' %}
{% assign sub_url = sub_parts | last %}
{% assign sub_folder = sub_parts[1] %}
<!-- if we are in the right folder, include it -->
{% if sub_folder == item_folder %}
{% include menu_single.html %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
<!-- if we have items, iterate over them -->
{% if item.items %}
{% for item in item.items %}
<!-- read item priority -->
{% assign value = item.menu_order %}
{% capture ip %}{% include print_number.liquid %}{% endcapture %}
{% assign ip = ip | normalize_whitespace | replace: " ", "" %}
<!-- pick all the ones with the current priority -->
{% if ip == p %}
{% include menu_single.html %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</ul>
</div>
</li>
</ul>
</li>
{% endunless %}