{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% block javascript %}
<script>
$(function(){
$(".ec-headerCategoryArea__heading").on("click", function() {
$(this).next().slideToggle();
if($(this).hasClass('active')) {
$(this).find('img').attr('src','{{ asset("assets/icon/side-arrow-right-gray.svg") }}');
$(this).removeClass('active');
} else {
$(this).find('img').attr('src','{{ asset("assets/icon/side-arrow-down-gray.svg") }}');
$(this).addClass('active');
}
});
$(".ec-headerCategoryArea .ec-itemNav__nav a").on("click", function() {
if($(this).hasClass('active')) {
$(this).find('img').attr('src','{{ asset("assets/icon/side-arrow-right-gray.svg") }}');
$(this).removeClass('active');
} else {
$(this).parent('li').next().find('a').css({
'border-top':'1px solid #DDDDDD'
});
$(this).css({
'border':'none'
});
$(this).find('img').attr('src','{{ asset("assets/icon/side-arrow-down-gray.svg") }}');
$(this).addClass('active');
}
});
});
</script>
{% endblock javascript %}
{% set Categories = repository('Eccube\\Entity\\Category').getList() %}
{% macro tree(Category) %}
{% from _self import tree %}
<a href="{{ url('product_list') }}?category_id={{ Category.id }}">
{{ Category.name }}
<img src="{{ asset('assets/icon/side-arrow-right-gray.svg') }}" alt="">
</a>
{% if Category.children|length > 0 %}
<ul>
{% for ChildCategory in Category.children %}
<li>
{{ tree(ChildCategory) }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{# @see https://github.com/bolt/bolt/pull/2388 #}
{% from _self import tree %}
<div class="ec-headerCategoryArea">
<div class="ec-headerCategoryArea__heading">
<p>{{ 'Categories'|trans }}<img src="{{ asset('assets/icon/side-arrow-right-gray.svg') }}" alt=""></p>
</div>
<div class="ec-itemNav">
<ul class="ec-itemNav__nav">
<li class="ec-sideCategoryList__all">
<a href="{{ url('product_list') }}?category_id=">全ての商品</a>
</li>
{% for Category in Categories %}
<li>
{{ tree(Category) }}
</li>
{% endfor %}
</ul>
</div>
</div>