-
Notifications
You must be signed in to change notification settings - Fork 1
/
blocketdtopmenu.tpl
executable file
·114 lines (108 loc) · 4.33 KB
/
blocketdtopmenu.tpl
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
107
108
109
110
111
112
113
114
{**
* @package blocketdtopmenu
*
* @version 2.2.0
* @copyright Copyright (C) 2017 ETD Solutions. Tous droits réservés.
* @license https://raw.githubusercontent.com/jbanety/blocketdcustom/master/LICENSE
* @author Jean-Baptiste Alleaume http://alleau.me
*}
{strip}
{addScript src=$modules_dir|cat:"blocketdtopmenu/js/menu.js"}
{$breakCount = []}
{$count = []}
{$currentCol = []}
{$colWidths = []}
{$groupChildren = []}
{$id = ''}
{if $tagId|strlen > 0}
{$id = ' id="'|cat:$tagId|cat:'"'}
{addScriptDeclaration content="jQuery(document).ready(function() {ldelim}
\$('#$tagId').etdtopmenu();
{rdelim});"}
{/if}
{/strip}
<!--[ETDHOOK:NAVIGATION]-->
<nav class="navbar{if $tagClass|strlen > 0} {$tagClass}{/if}"{$id}>
<div class="container">
<div class="row">
<ul class="nav navbar-nav">
<li id="navbar-close" class="visible-xs visible-sm"><a href="#">{l s='Close'} <span class="fa fa-times-circle"></span></a></li>
{foreach $list as $i => $item}
{strip}
{$class = 'item-'|cat:$item.id}
{$ulClass = ''}
{if $item.css|strlen > 0}
{$class = $class|cat: ' '|cat:$item.css}
{/if}
{if $item.children > 0 && $item.params->columns > 1}
{$breakCount[$item.level+1] = floor($item.children / $item.params->columns)}
{if $breakCount[$item.level+1] == 0 && $item.children / $item.params->columns > 0}
{$breakCount[$item.level+1] = 1}
{/if}
{$groupChildren[$item.level+1] = $item.params->group_child_items}
{$count[$item.level+1] = 0}
{$currentCol[$item.level+1] = 0}
{$colWidths[$item.level+1] = $item.params->columns_widths}
{$ulClass = ' class="row"'}
{/if}
{if $item.deeper}
{if $item.level == 1}
{$class = $class|cat:' dropdown'}
{/if}
{/if}
{if isset($breakCount[$item.level]) && $breakCount[$item.level] > 0}
{if $count[$item.level] % $breakCount[$item.level] == 0}
{$currentCol[$item.level] = $currentCol[$item.level] + 1}
{if isset($groupChildren[$item.level]) && $groupChildren[$item.level] }
{if $item.deeper}
{$class=$class|cat:" ":$colWidths[$item.level]->{$currentCol[$item.level]}}
{else}
{if $count[$item.level] > 0}
</ul></li>
{/if}
<li class="{$colWidths[$item.level]->{$currentCol[$item.level]}}"><ul>
{/if}
{/if}
{/if}
{$count[$item.level] = $count[$item.level] + 1}
{/if}
{/strip}
<li class="{$class}">
{if $item.params->group_child_items == 0 || $item.params->group_child_items && $item.params->show_title}{include $item_tpl item=$item}{/if}
{if $item.deeper}
{if $item.level == 1}
<div class="subnavbar">
<div class="container">
{/if}
<ul{$ulClass}>
<li class="subnavbar-close visible-xs visible-sm"><a href="#">{l s='Close'} <span class="fa fa-chevron-circle-left"></span></a></li>
{elseif $item.shallower}
</li>
{strip}
{for $j = 0; $j < $item.level_diff; $j++ }
{if isset($breakCount[$item.level - $j]) && $breakCount[$item.level - $j] > 0}
{if isset($groupChildren[$item.level - $j]) && $groupChildren[$item.level - $j] }
</ul></li>
</ul>
{if $item.level - $j == 2}
</div></div>
{/if}
{/if}
{$breakCount[$item.level - $j] = 0}
{$groupChildren[$item.level - $j] = 0}
{$count[$item.level - $j] = 0}
{$currentCol[$item.level - $j] = 0}
{$colWidths[$item.level - $j] = null}
{/if}
{/for}
{/strip}
</li>
{else}
</li>
{/if}
{/foreach}
</ul>
</div>
</div>
</nav>
<!--[/ETDHOOK:NAVIGATION]-->