{{ sylius_template_event('sylius.shop.product.index.before_vertical_menu', {'taxon': taxon}) }}
{{ sylius_template_event('sylius.shop.product.index.after_vertical_menu', {'taxon': taxon}) }}
{% block javascript %}
<script>
$(document).ready(function() {
$(".sidebar-filter .ui.loadable.form").removeClass("loading");
$(".sidebar-filter").on("change", "input[type=checkbox]", function() {
$(this).closest("form").submit();
});
$(".filter-section-header").each(function() {
var header = $(this);
var content = $("#" + header.attr("aria-controls"));
var activeCount = content.find("input[type=checkbox]:checked").length;
content.css({ maxHeight: 0, overflow: "hidden" });
header.attr("aria-expanded", "false");
if (activeCount > 0) {
header.find(".filter-section-title").after('<span class="filter-section-count">' + activeCount + '</span>');
}
});
$(".sidebar-filter").on("click", ".filter-section-header", function(e) {
e.preventDefault();
var header = $(this);
var content = $("#" + header.attr("aria-controls"));
var isOpen = header.attr("aria-expanded") === "true";
if (isOpen) {
content.css("maxHeight", "0");
header.attr("aria-expanded", "false");
header.removeClass("is-open");
} else {
content.css("maxHeight", content[0].scrollHeight + "px");
header.attr("aria-expanded", "true");
header.addClass("is-open");
}
});
});
</script>
{% endblock %}