50 lines
1.7 KiB
Smarty
50 lines
1.7 KiB
Smarty
{function sectionsTree}
|
|
<ul class="list-unstyled sidebar-sections-nav">
|
|
{foreach $sectionList as $item}
|
|
<li class="sidebar-navitem section_{$item.id}" data-sidesections-navitem>
|
|
{if $item.submenu}
|
|
<i class="navitem-trigger" data-sidesections-trigger></i>
|
|
{/if}
|
|
<a href="{url s=category IDcat=$item.id}" class="navlink">
|
|
<span>{$item.title_short}</span>
|
|
</a>
|
|
|
|
{if $item.submenu and $item.level < $level_max}
|
|
{sectionsTree sectionList=$item.submenu}
|
|
{/if}
|
|
</li>
|
|
{/foreach}
|
|
</ul>
|
|
{/function}
|
|
|
|
{if not $fromCache}
|
|
{if $categories}
|
|
<div class="sidebar-sections" data-sidesections>
|
|
{block "sidebar-sections-header"}{/block}
|
|
{sectionsTree sectionList=$categories}
|
|
</div>
|
|
<script>
|
|
wpj.onReady.push(function() {
|
|
$('[data-sidesections] [data-sidesections-trigger]').on('click', function(e) {
|
|
var $list_item = $(this).closest('[data-sidesections-navitem]');
|
|
$list_item.children('ul').slideToggle();
|
|
if (!$list_item.hasClass('toggle-opened') && $list_item.hasClass('opened'))
|
|
$list_item.removeClass('opened');
|
|
else
|
|
$list_item.toggleClass('toggle-opened');
|
|
});
|
|
});
|
|
</script>
|
|
{/if}
|
|
{else}
|
|
{if $selection}
|
|
<script>
|
|
wpj.onReady.push(function() {
|
|
{foreach $selection as $item}
|
|
$("[data-sidesections] .section_{$item}").addClass('opened'){if $item@last}.addClass('active'){/if};
|
|
{/foreach}
|
|
});
|
|
</script>
|
|
{/if}
|
|
{/if}
|